How to load someone in a vehicle? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How to load someone in a vehicle? (
/showthread.php?tid=309895)
How to load someone in a vehicle? -
Gooday - 09.01.2012
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?
Re: How to load someone in a vehicle? -
AstonDA-G - 09.01.2012
use PutPlayerInVehicle
https://sampwiki.blast.hk/wiki/PutPlayerInVehicle
Re: How to load someone in a vehicle? -
Gooday - 09.01.2012
and how i could set the nearest PD car?
Re: How to load someone in a vehicle? -
Konstantinos - 09.01.2012
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.
Re: How to load someone in a vehicle? -
Gooday - 09.01.2012
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...)