24.12.2014, 06:23
Failing to ensure the smooth operation of this code, if your parameter is in another world or interior would not make it to their destination, With your code could go to a player invalid, could cause problems, i think this would work better:
pawn Code:
command(goto, playerid, params[])
{
if(sscanf(params, "u", params[0])) return SendClientMessage(playerid, -1, "/goto [playerid/name].");
if(IsPlayerConnected(params[0]) && params[0] != INVALID_PLAYER_ID)
{
if(params[0] != playerid)
{
new Float:cords[3];
SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(params[0]));
SetPlayerInterior(playerid, GetPlayerInterior(params[0]));
GetPlayerPos(params[0], cords[0], cords[1], cords[2]);
SetPlayerPos(playerid, cords[0], cords[1], cords[2]);
}
else
{
SendClientMessage(playerid, -1, "You can't go toward yourself.");
}
}
else
{
SendClientMessage(playerid, -1, "Player not connected.");
}
return true;
}