Release Grand Theft Auto 5 PS3 C++ Code Thread

Venox

Moderator
Messages
95
Reaction score
74
Points
808
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

Veteran
Messages
32
Reaction score
18
Points
643
how to use Spawn WheelChair on menu for spawn cars names
and did u know how to put label bool on menu ? and thanks
 

Venox

Moderator
Messages
95
Reaction score
74
Points
808
how to use Spawn WheelChair on menu for spawn cars names
and did u know how to put label bool on menu ? and thanks
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;
 

chadbell

Member
Messages
40
Reaction score
12
Points
18
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;
Hi bud 2much base has no func.h so how would your code go in thank bud
 

FaZeModz

Insane-Known Member
Messages
14
Reaction score
9
Points
358
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]);
        }
    }
}
Nice but use a bool for Super Run... Here is the code
 

Attachments

  • Super Run Func.txt
    271 bytes · Views: 336

Nerf_Herder

Member
Messages
9
Reaction score
2
Points
8
How to add give rp y protection rp using 2muc4u sprx source
you can find it pretty easily if you look around the web. But you'll need to know how to implement it. You probably wont be able to just c/p it without any modifying. But once you see how it works you should be able to get it to work with your base without too much trouble. It's been public for awhile.
 
Last edited:

Nerf_Herder

Member
Messages
9
Reaction score
2
Points
8
Hi bud 2much base has no func.h so how would your code go in thank bud
so make a func.h header for all of your functions.(or separate them i.e. self.h, players.h, peds.h, teleport.h, etc) If you don't know how this is done, You need to learn more about c++ and Visual Studio
 
Top