Teleporting a car to another ID
#1

Alright, so I'm making a /tp command that works like this /tp oneid anotherid I can't get the car to tp aswell. I've try everything... I've got the ID but I need it to tp aswell.... If anyone can help, please do.


Код:
CMD:tp(playerid, params[])
{
new playerid1;
new playerid2;
new Float:x;
new Float:y;
new Float:z;
new string[128];
new vehicleid=GetPlayerVehicleID(playerid1);

if(sscanf(params, "uu", playerid1, playerid2)) return SendClientMessage(playerid,COLOR_MAGENTA, "USAGE: /tp <FirstID> <SecondID>");
if(!IsPlayerConnected(playerid1)) return SendClientMessage(playerid,COLOR_ORANGE, "ERROR: The first ID you specified is not on the server!");
if(!IsPlayerConnected(playerid2)) return SendClientMessage(playerid,COLOR_ORANGE, "ERROR: The second ID you specified is not on the server!");
format(string, sizeof(string), "You've been teleported, %s.", GetName(playerid1));
SendClientMessage(playerid1, COLOR_CYAN, string);
format(string, sizeof(string), "You teleported %s to ID %d!", GetName(playerid1), playerid2);
SendClientMessage(playerid2, COLOR_CYAN, string);

if(IsPlayerInAnyVehicle(playerid1))
{
GetPlayerPos(playerid2, x, y, z);
SetVehiclePos(vehicleid,Float:x,Float:y,Float:z);
}
else
{
GetPlayerPos(playerid2, x, y, z);
SetPlayerPos(playerid1, x+1, y+1, z+1);
}
return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)