17.07.2011, 00:39
Hi, I want wondering how I could tp to a certain location and if I was in a vehicle it teleports that to?
Check before setting the position if a player is in a vehicle.
use: https://sampwiki.blast.hk/wiki/Function:...erInAnyVehicle If he is, then set the vehicle position with: https://sampwiki.blast.hk/wiki/SetVehiclePos Simples. |
CMD:goto(playerid,params[])
{
new toplayerid;
if(sscanf(params,"r ",toplayerid)) return SendClientMessage(playerid,SYellow,"Usage: /goto <playerid/name> ~To teleport to certain player.");
else
{
new Float:Pos[3];
GetPlayerPos(toplayerid,Pos[0],Pos[1],Pos[2]);
if(IsPlayerInAnyVehicle(playerid))
{
new vid = GetPlayerVehicleID(playerid);
SetVehiclePos(vid,Pos[0],Pos[1],Pos[2]);
PutPlayerInVehicle(playerid,vid);
}
else SetPlayerPos(playerid,Pos[0],Pos[1],Pos[2]);
}
return 1;
}