30.07.2010, 15:15
Here try this :
I used sscanf + zcmd.
pawn Код:
CMD:goto(playerid, params[])
{
new Float:x, Float:y, Float:z;
new playerid2;
if(sscanf(params, "u", playerid2))
{
SendClientMessage(playerid, Orange, "USAGE : /goto [playerid]");
SendClientMessage(playerid, Lightblue, "FUNCTION : Goto a particular players position");
}
else if(playerid2 == INVALID_PLAYER_ID) SendClientMessage(playerid, Red, "ERROR : That player is not connected!");
else if(playerid2 == playerid) SendClientMessage(playerid, Red, "ERROR : You cant go to yourself!");
else
{
GetPlayerPos(playerid2, x, y, z);
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
LinkVehicleToInterior(GetPlayerVehicleID(playerid), GetPlayerInterior(playerid2));
SetVehicleVirtualWorld(GetPlayerVehicleID(playerid), GetPlayerVirtualWorld(playerid2));
SetVehiclePos(GetPlayerVehicleID(playerid), x+2, y,z);
SetVehicleZAngle(GetPlayerVehicleID(playerid),0.0);
}
else
{
SetPlayerPos(playerid, x+2, y, z);
SetPlayerInterior(playerid, GetPlayerInterior(playerid2));
SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(playerid2));
}
}
return 1;
}