Help editing this Radar Detector Command
#1

Ok so someone helped me put together this Radar Detector command (it will detect Poice Officers in the area).

My question is how can I make it constantly check when they type /detector instead of just doing one check. I want it so that /detector begins checking and /detectoroff stope the detection. I think I need to make a timer for this, but I have no idea how to. I also want it to be on a player message and not a dialoge. Can someone help me finish this code?

Thanks: jakejohnsonusa


Here is what I have:
pawn Код:
if (strcmp("/detector", cmdtext, true, 10) == 0)
    {
        new counter = 0, player[268];
        new Float:x, Float:y, Float:z;
        GetPlayerPos(playerid, x, y, z);
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerInRangeOfPoint(i, 30.0, x, y, z) && i != playerid && IsPlayerConnected(i) && IsACop(i))
            {
                counter++;
            }
        }
        if(counter == 0) return SendClientMessage(playerid, 0xFF0000FF, "No one is in your range.");
        strdel(string, 0, strlen(string));
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerInRangeOfPoint(i, 30.0, x, y, z) && i != playerid && IsPlayerConnected(i) && IsACop(i))
            {
                format(player, sizeof(player), "%s (%d)\n", Nick(i), i);
                strins(string, player, strlen(string), sizeof(string));
            }
        }
        ShowPlayerDialog(playerid, 1592, DIALOG_STYLE_MSGBOX, "Radar", string, "Okay", "");
        strdel(string, 0, strlen(string));
        return 1;
    }
pawn Код:
stock Nick(playerid)
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    return name;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)