SA-MP Forums Archive
Cargive at teleport? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Cargive at teleport? (/showthread.php?tid=183445)



Cargive at teleport? - knackworst - 15.10.2010

Is there a way like onplayercommand 'example" setcar?
so that when they teleport there they automaticly get that car


Re: Cargive at teleport? - Relixious - 15.10.2010

Код:
new vehid = GetPlayerVehicleID(playerid);
SetVehiclePos(vehid, x, y, z);
SetPlayerPos(playerid, x, y, z);
PutPlayerInVehicle(playerid, vehid, 0);



Re: Cargive at teleport? - Sinner - 15.10.2010

Quote:
Originally Posted by Relixious
Посмотреть сообщение
Код:
new vehid = GetPlayerVehicleID(playerid);
SetVehiclePos(vehid, x, y, z);
SetPlayerPos(playerid, x, y, z);
PutPlayerInVehicle(playerid, vehid, 0);
That would only give a car when the player is already in a car.

Код:
new Float:x, Float:y, Float:z, Float:angle;
if (IsPlayerInAnyVehicle(playerid)) GetVehiclePos(GetPlayerVehicleID(playerid), x, y, z);
else GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, angle);

//teleport player here


new vid = CreateVehicle(id of the car you want to spawn, x, y, z, angle, -1, -1, 180);
LinkVehicleToInterior(vid, GetPlayerInterior(playerid));
SetVehicleVirtualWorld(vid, GetPlayerVirtualWorld(playerid));
GameTextForPlayer(playerid, "~g~Vehicle spawned!", 2000, 4);
PutPlayerInVehicle(playerid, vid, 0);