/find command
#4

the hfind variable is global, and can be used by 1 player at a time only. i suggest to add
pawn Код:
new hfind[MAX_PLAYERS];
...to make a variable for each player. then you need to change each hfind by f.ex. hfind[playerid]:
pawn Код:
CMD:hfind(playerid,params[])
{
    if(!IsPlayerAdmin(playerid)) return 1;//Rcon admin
    hfind[playerid]=1-hfind[playerid];//this will trigger 1-0-1-0-1 etc.
    if(hfind[playerid] == true)
    {
        new targetid; new Float:x, Float:y, Float:z;
        if(sscanf(params,"u", targetid)) return SendClientMessage(playerid, -1, "Usage: /hfind (ID) ");
        GetPlayerPos(targetid, x, y, z);
        SetPlayerCheckpoint(playerid, x, y, z, 6.0);
        SetTimerEx("findPlayer", 1000, 1, "ii", targetid, playerid);
    }
    else // if(hfind[playerid] == false)//not required, since the first "if" checks for the only truth. else its false here.
    {
        DisablePlayerCheckpoint(playerid);
    }
    return 1;
}
can you please explain how the system is supposed to do? how does it work? especially the timer "findPlayer".

btw, there was a "possible unintented assignment" in if(hfind[playerid] = true), its supposed to be == for comparing values.

edit: editing my post, since i get what you want, i hope. done.
one trick for modifying a bollean (hfind), is to simply subtract it from 1.
1-0=1 and 1-1=0 an endless loop...
the question remains: whats the timer containing? is it removing the checkpoint?
Reply


Messages In This Thread
/find command - by morha12 - 30.04.2013, 04:16
Re: /find command - by morha12 - 30.04.2013, 14:40
Re : /find command - by DaTa[X] - 30.04.2013, 14:45
Re: /find command - by Babul - 30.04.2013, 14:52
Re: /find command - by morha12 - 30.04.2013, 15:15
Re: /find command - by morha12 - 30.04.2013, 16:11
Re: /find command - by morha12 - 01.05.2013, 13:46
Re: /find command - by morha12 - 02.05.2013, 04:15

Forum Jump:


Users browsing this thread: 1 Guest(s)