if(strcmp(cmd, "/orten", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(!IsACop(playerid))
{
SendClientMessage(playerid, COLOR_GREY, "Du bist kein Polizist!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "Benutzung: /orten [Spieler ID]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
new Float:X,Float:Y,Float:Z;
GetPlayerPos(giveplayerid, X,Y,Z);
SetPlayerCheckpoint(playerid, X,Y,Z, 6);
SetPVarInt(playerid,"SearchedPlayer",giveplayerid);
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "Falsche ID!");
}
}
return 1;
}
Unter OnGameModeInit:
SetTimer("CheckOrtenFunktion",1000,true);
forward CheckOrtenFunktion();
public CheckOrtenFunktion()
{
for (new i=0;i<GetMaxPlayers();i++)
{
if (IsPlayerConnected(i)
{
if(GetPVarInt(i,"SearchedPlayer") !=-1)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(GetPVarInt(i,"SearchedPlayer"),x,y,z);
SetPlayerCheckpoint(playerid, x,y,z, 6.0);
}
}
}
}
So sollte es funktionieren.