14.04.2020, 10:52
Then you should check if they are spawned I think.
PHP Code:
public OnPlayerSpawn(playerid)
{
if(GetPVarInt(playerid, "is_connected")==0) SetPVarInt(playerid, "is_connected", 1); // set the pvar to 1 for the check later
return 1;
}
IsPlayerConnectedEx(playerid)
{
if (IsPlayerConnected(playerid)&&GetPVarInt(playerid, "is_connected")==1&&playerid!=INVALID_PLAYER_ID) return 1;
return 0;
}
CMD:gotoplayer(playerid, params[])
{
new ID, string[128];
if(sscanf(params, "u", ID))
return errormessage(playerid,"/gotoplayer -ID-");
if(!IsPlayerConnectedEx(ID))
return errormessage(playerid,"No players found");
new Float: Pos[3];
GetPlayerPos(ID, Pos[0], Pos[1], Pos[2]);
SetPlayerPos(playerid, Pos[0] + 2, Pos[1], Pos[2]);
SendClientMessage(playerid, COLOR_ADMIN, "Teleported");
return 1;
}

