1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

C++ Code Thread

Discussion in 'Grand Theft Auto 5 PS3' started by Venox, May 23, 2016.

  1. Venox

    Venox Moderator Staff Member

    93
    102
    133
    Credits:
    696
    The purpose of this thread is sharing functions.
    I hope you can learn from it .
    most of it is done by me.



    Kick All Players From your Lobby
    Code:
    for (int i = 0; i < 16; i++)
            {
                int id = PLAYER::GET_PLAYER_PED(i);
                if (id > 0 && id != PLAYER::PLAYER_PED_ID())
                {
                            NETWORK_REQUEST_CONTROL_OF_ENTITY(GET_PLAYER_PED(i));                   
                            NETWORK_SESSION_KICK_PLAYER(GET_PLAYER_PED(i));
                        }
    requestLobbyKick = false;    
    }
    
    

    Clone Lobby
    Code:
        void CloneLobby()
        {
            for(int i = 0; i < PlayerCount(); i++)
            {
                if (i >= 0 && i != PlayerSelf())
                {
                    Ped lclone_ = CLONE_PED(GET_PLAYER_PED(i),                        GET_ENTITY_HEADING(GET_PLAYER_PED(i)), 1, 1);
                    Ped* lclone = &lclone_;
                    SET_ENTITY_AS_NO_LONGER_NEEDED(lclone);
                }
            }
        }
    
    

    SuperRun (Button Bind)
    Code:
     
    void super_run() 
    {
           if (CONTROLS::IS_CONTROL_JUST_PRESSED(0, Button_X)) 
          {
                    ENTITY::APPLY_FORCE_TO_ENTITY(PLAYER::PLAYER_PED_ID(), true, 0, 60, 0, 0, 0, 0, true, true, true, true, false, true);
            }
    }
    
    

    Spawn WheelChair
    Code:
        bool doWheelchair = false;
        bool spawnWheelchair()
        {
            uint Handle = PLAYER::PLAYER_PED_ID();
            Vector3 MyCoords = ENTITY::GET_ENTITY_COORDS(PLAYER::PLAYER_PED_ID(), 1);
            Vector3 null; null.x = 0, null.y = 0; null.z = 0;
            Vector3 a; a.x = -0.27, a.y = -0.24, a.z = 0.13f;  
            Vector3 b; b.x = 0, b.y = 0, b.z = 180;
            int hash = GAMEPLAY::GET_HASH_KEY("bati");
            int hash2 = GAMEPLAY::GET_HASH_KEY("prop_wheelchair_01");
            STREAMING::REQUEST_MODEL(hash);
            STREAMING::REQUEST_MODEL(hash2);
            if (STREAMING::HAS_MODEL_LOADED(hash) && STREAMING::HAS_MODEL_LOADED(hash2))
            {
                int Object = OBJECT::CREATE_OBJECT(hash2, null.x, null.y, null.z, 1, 0, 1);
                if (ENTITY::DOES_ENTITY_EXIST(Object))
                {
                    int Vehicle = VEHICLE::CREATE_VEHICLE(hash, MyCoords.x, MyCoords.y, MyCoords.z, ENTITY::GET_ENTITY_HEADING(Handle), 1, 0);
                    if (ENTITY::DOES_ENTITY_EXIST(Vehicle))
                    {
                        PED::SET_PED_INTO_VEHICLE(PLAYER::PLAYER_PED_ID(), Vehicle, -1);
                        STREAMING::SET_MODEL_AS_NO_LONGER_NEEDED(hash);
                        ENTITY::SET_ENTITY_VISIBLE(Vehicle, false);
                        UNK::ATTACH_ENTITY_TO_ENTITY(Object, Vehicle, 0, a.x, a.y, a.z, b.x, b.y, b.z, 0, 1, 0, 0, 2, 1);
                        ENTITY::SET_ENTITY_VISIBLE(Handle, true);  
                        return true;
                    }
                    return false;
                }      
                return false;                                                      
            }
            return false;
        }
    

    Give other player 3Stars
    Code:
    void vOnline3Stars(Entity eEntity)
    {
        if (ENTITY::DOES_ENTITY_EXIST(eEntity))
        {
            const int iPeds = 40;
            Ped pPed[iPeds];
            Vector3 Coordinates = ENTITY::GET_ENTITY_COORDS(eEntity, 0);
    
            for (int i = 0; i < iPeds; i++)
            {
                pPed[i] = PED::CLONE_PED(eEntity, ENTITY::GET_ENTITY_HEADING(PLAYER::PLAYER_PED_ID()), 1, 1);
                ENTITY::SET_ENTITY_COORDS(pPed[i], Coordinates.x, Coordinates.y, Coordinates.z + 25, 0, 0, 0, 1);
                PED::SET_PED_AS_COP(pPed[i], true);
                Wait(20);
                Vector3 pPedCoordinates = ENTITY::GET_ENTITY_COORDS(pPed[i], 0);
                FIRE::ADD_OWNED_EXPLOSION(eEntity, pPedCoordinates.x, pPedCoordinates.y, pPedCoordinates.z, 9, 5.0f, 0, 1, 0.0f);
                PED::DELETE_PED(&pPed[i]);
            }
        }
    }
    
     
    iRnZ likes this.
  2. iRnZ

    iRnZ Active Member

    32
    18
    193
    Credits:
    15
    how to use Spawn WheelChair on menu for spawn cars names
    and did u know how to put label bool on menu ? and thanks
     
  3. Venox

    Venox Moderator Staff Member

    93
    102
    133
    Credits:
    696
    1.put my Wheelchair code in you Func.H
    2.Go to prx.h ( i think you use 2much base)
    3.AddOption("Wheelchair");
    case 1:
    spawnWheelchair();doWheelchair = true;break;

    4.if this method not work try
    case 1:
    doWheelchair = true;break;
     
    iRnZ likes this.
  4. VerTical

    VerTical Head Member Donator

    838
    1,129
    243
    Credits:
    2,433
    nice :b
     
  5. banzai

    banzai New Member

    2
    0
    1
    Credits:
    16
    Vertical-_-MoDz, you conding too ??
     
  6. Gentle

    Gentle Guest

    Credits:
    0
    yas who doesn't cond?
     
  7. banzai

    banzai New Member

    2
    0
    1
    Credits:
    16
    L33T Scrub you coding on SPRX ??
     
  8. Gentle

    Gentle Guest

    Credits:
    0
    Yeh.
     
  9. Gentle

    Gentle Guest

    Credits:
    0
    not GTA doe
     
  10. VerTical

    VerTical Head Member Donator

    838
    1,129
    243
    Credits:
    2,433
    Yea im Coder :grinning:
     
  11. chadbell

    chadbell Active Member

    38
    10
    8
    Credits:
    171
    Hi bud 2much base has no func.h so how would your code go in thank bud
     
  12. chadbell

    chadbell Active Member

    38
    10
    8
    Credits:
    171
    Any one help at all to my above post Thanks to any one with 5 min to reply
     

Share This Page