How to load someone in a vehicle?
#1

Eample /LOAD ID:

and teleport the selected id sitted in the back of a car?

Example for the cops /load ID and load the id in the nearest PD car how i can?
Reply
#2

use PutPlayerInVehicle
https://sampwiki.blast.hk/wiki/PutPlayerInVehicle
Reply
#3

and how i could set the nearest PD car?
Reply
#4

pawn Код:
stock GetClosestVehicle(playerid, Float:range)
{
    new     Float:p_X;
    new     Float:p_Y;
    new     Float:p_Z;

    new     Float:Distance;
    new     Float:PretendentDistance = range +1;
    new     Pretendent;

    GetPlayerPos(playerid, p_X, p_Y, p_Z);

    for(new vehicleid=1; vehicleid < MAX_VEHICLES; vehicleid++)
    {
        Distance = GetVehicleDistanceFromPoint(vehicleid, p_X, p_Y, p_Z);

        if(Distance <= range && Distance <= PretendentDistance)
        {
            Pretendent = vehicleid;
            PretendentDistance = Distance;
        }
    }

    return Pretendent;
}
pawn Код:
new vehicleid;
vehicleid = GetClosestVehicle(playerid, 20);
This will find the nearest vehicle to you in radius of 20.
By Skorch.
Reply
#5

So thanks but how i can include to this code:
pawn Код:
CMD:loadtest(playerid, vehicleid, params[])
{
    new id;
    if (sscanf(params, "u", id)) SendClientMessage(playerid, COLOR_LIGHTBLUE, "Usage: /load [ID]");
    else if (id == INVALID_PLAYER_ID) SendClientMessage(playerid, COLOR_RED, "[INFO]Player not found");
    else
    {
        PutPlayerInVehicle(id, vehicleid, 3);
        TogglePlayerControllable(id, 0);
        SendClientMessage(id, COLOR_GOLD, "[INFO]You have been loaded in a BCSD Vehicle.");
        SendClientMessage(playerid, COLOR_GOLD, "[INFO]Client Loaded succesfully");
    }
    return 1;
}
And just in the near Police vehicles? (just post 1 example...)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)