05.07.2014, 17:01
Hello. I would need some help in making a moving checkpoint to use it in a /find command. The idea is that I want to create a checkpoint that moves along with its target, so when I use /find x and X is moving, the checkpoint will go after him, until I use /cancel find.
I tried this:
and here is the public:
The publics are forwarded, but using this will crash my server, because it's an infinite cycle. How should I make it right?
I tried this:
Код:
CMD:find(playerid,params[]) // /find { new pname2[25], id, string[200]; if(sscanf(params, "u",id)) return SendClientMessage(playerid,COL_SYN, "USAGE: /find <player name/ID>"); if(PlayerInfo[playerid][pJob]==2) { if(IsPlayerConnected(id)) { if(id!=INVALID_PLAYER_ID) { if(id!=playerid) { PlayerInfo[playerid][pCheckpointactive]=1; PlayerInfo[playerid][pCPid]=id; GetPlayerName(id,pname2,sizeof(pname2)); format(string,sizeof(string),"* Marker set on %s (%d). To clear it type /cancel find.",pname2,id); SendClientMessage(playerid,COL_GREEN,string); MovingCheckpoint(playerid); } else SendClientMessage(playerid,COL_ERROR,"You cannot use this command on yourself."); } else SendClientMessage(playerid,COL_ERROR,"Player not connected."); } else SendClientMessage(playerid,COL_ERROR,"Player not connected."); } else SendClientMessage(playerid,COL_ERROR,"You are not a Detective."); return 1; }
Код:
public MovingCheckpoint(playerid) { new Float:x,Float:y,Float:z,id; id=PlayerInfo[playerid][pCPid]; while(PlayerInfo[playerid][pCheckpointactive]==1) { GetPlayerPos(id,x,y,z); SetPlayerCheckpoint(playerid,x,y,z,3); SetTimer("DisableCheckpoint",1000,0); } }
Код:
public DisableCheckpoint(playerid) { DisablePlayerCheckpoint(playerid); }