ALERT!
Click here to register with a few steps and explore all our cool stuff we have to offer!
Home
Upgrade
Credits
Help
Search
Awards
Achievements
 1536

Snippet Codes

by FBModderFresh - 08-02-2018 - 02:23 AM
#1
Here are some codes for people that are starting to code. Feel free to post your own codes too.

Hijack players vehicle
Code:
void Freeze(Ped selectedPed)
    {
        AI::CLEAR_PED_TASKS_IMMEDIATELY(selectedPed);
        AI::CLEAR_PED_SECONDARY_TASK(selectedPed);
    }

void JackCar(Ped selectedPlayer)
    {
        Vehicle selectedPlayerVeh = PED::GET_VEHICLE_PED_IS_IN(selectedPlayer, 0);
        if (PED::IS_PED_IN_ANY_VEHICLE(selectedPlayer, false))
        {
            if (ENTITY::DOES_ENTITY_EXIST(selectedPlayer))
            {
                if (PED::IS_PED_IN_ANY_VEHICLE(selectedPlayer, 0))
                {
                    Freeze(selectedPlayer);
                    Objects::RequestNetworkControl(selectedPlayerVeh);
                    Vector3 playerPedPos = ENTITY::GET_ENTITY_COORDS(PLAYER::PLAYER_PED_ID(), 0);
                    for (int i = 0; i < 18; i++)
                    {
                        if (PED::IS_PED_IN_VEHICLE(PLAYER::GET_PLAYER_PED(i), selectedPlayerVeh, 0))
                        {
                            Freeze(PLAYER::GET_PLAYER_PED(i));
                        }
                    }
                    ENTITY::SET_ENTITY_COORDS(selectedPlayerVeh, playerPedPos.x, playerPedPos.y, playerPedPos.z, 0, 0, 0, 1);
                    PED::SET_PED_INTO_VEHICLE(PLAYER::PLAYER_PED_ID(), selectedPlayerVeh, -1);
                }
            }
        }
    }
Spectate Selected Player
Code:
void SpectateMode(bool Active, Ped selectedPed)
    {
        NETWORK::NETWORK_SET_IN_SPECTATOR_MODE(Active, selectedPed);
    }

    void AIWanderCar(Ped playerPed)
    {
        Vehicle playerVeh = PED::GET_VEHICLE_PED_IS_USING(playerPed);
        AI::TASK_VEHICLE_DRIVE_WANDER(playerPed, playerVeh, 100.0f, 0);
    }
    void SpectatePlayer(Ped playerped)
    {
        Any SpectateCam;
        Vector3 playerPosition = ENTITY::GET_ENTITY_COORDS(playerped, false);
        SpectateCam = CAM::CREATE_CAM_WITH_PARAMS("DEFAULT_SCRIPTED_FLY_CAMERA", playerPosition.x, playerPosition.y, playerPosition.z, 0.0, 0.0, 0.0, 50.0, 0, 2);
        CAM::ATTACH_CAM_TO_ENTITY(SpectateCam, playerped, 0, -5, 1, 1);
        CAM::SET_CAM_ACTIVE(playerped, 1);
    }
example: addBoolOption("Spectate Player", SPECTATE);


if (SPECTATE == true)
    {
        AIWanderCar(PLAYER::PLAYER_PED_ID());
        SpectateMode(true, PLAYER::GET_PLAYER_PED(selectedPlayer));
    }
    if (SPECTATE == false)
    {
        SpectateMode(false, PLAYER::GET_PLAYER_PED(selectedPlayer));
        AI::CLEAR_PED_TASKS(PLAYER::PLAYER_ID());
    }

Maybe these codes have been released before but not sure sorry if they have its just a few you help people if you need help comment below.
Code:
if (Fresh)
{
   Notify("FBModderFresh");
   Notify("SanjuroDev");
}
Reply
#2
I finally got this code thanks a lot
Reply
#3
good job for ps3 users
Reply
#4
did u get it worked??
Reply
#5
(08-02-2018 - 02:23 AM)FBModderFresh Wrote: Here are some codes for people that are starting to code. Feel free to post your own codes too.

Hijack players vehicle
Code:
void Freeze(Ped selectedPed)
{
AI::CLEAR_PED_TASKS_IMMEDIATELY(selectedPed);
AI::CLEAR_PED_SECONDARY_TASK(selectedPed);
}

void JackCar(Ped selectedPlayer)
{
Vehicle selectedPlayerVeh = PED::GET_VEHICLE_PED_IS_IN(selectedPlayer, 0);
if (PED::IS_PED_IN_ANY_VEHICLE(selectedPlayer, false))
{
if (ENTITY::DOES_ENTITY_EXIST(selectedPlayer))
{
if (PED::IS_PED_IN_ANY_VEHICLE(selectedPlayer, 0))
{
Freeze(selectedPlayer);
Objects::RequestNetworkControl(selectedPlayerVeh);
Vector3 playerPedPos = ENTITY::GET_ENTITY_COORDS(PLAYER::PLAYER_PED_ID(), 0);
for (int i = 0; i < 18; i++)
{
if (PED::IS_PED_IN_VEHICLE(PLAYER::GET_PLAYER_PED(i), selectedPlayerVeh, 0))
{
Freeze(PLAYER::GET_PLAYER_PED(i));
}
}
ENTITY::SET_ENTITY_COORDS(selectedPlayerVeh, playerPedPos.x, playerPedPos.y, playerPedPos.z, 0, 0, 0, 1);
PED::SET_PED_INTO_VEHICLE(PLAYER::PLAYER_PED_ID(), selectedPlayerVeh, -1);
}
}
}
}
Spectate Selected Player
Code:
void SpectateMode(bool Active, Ped selectedPed)
{
NETWORK::NETWORK_SET_IN_SPECTATOR_MODE(Active, selectedPed);
}

void AIWanderCar(Ped playerPed)
{
Vehicle playerVeh = PED::GET_VEHICLE_PED_IS_USING(playerPed);
AI::TASK_VEHICLE_DRIVE_WANDER(playerPed, playerVeh, 100.0f, 0);
}
void SpectatePlayer(Ped playerped)
{
Any SpectateCam;
Vector3 playerPosition = ENTITY::GET_ENTITY_COORDS(playerped, false);
SpectateCam = CAM::CREATE_CAM_WITH_PARAMS("DEFAULT_SCRIPTED_FLY_CAMERA", playerPosition.x, playerPosition.y, playerPosition.z, 0.0, 0.0, 0.0, 50.0, 0, 2);
CAM::ATTACH_CAM_TO_ENTITY(SpectateCam, playerped, 0, -5, 1, 1);
CAM::SET_CAM_ACTIVE(playerped, 1);
}
example: addBoolOption("Spectate Player", SPECTATE);


if (SPECTATE == true)
{
AIWanderCar(PLAYER::PLAYER_PED_ID());
SpectateMode(true, PLAYER::GET_PLAYER_PED(selectedPlayer));
}
if (SPECTATE == false)
{
SpectateMode(false, PLAYER::GET_PLAYER_PED(selectedPlayer));
AI::CLEAR_PED_TASKS(PLAYER::PLAYER_ID());
}

Maybe these codes have been released before but not sure sorry if they have its just a few you help people if you need help comment below.
thx
This account is currently banned
Ban reason: Leeching and Spamming is not allowed, please read the forum Rules upon your return.
Reply

Users browsing: 1 Guest(s)