SA-MP Forums Archive
Kill Timer Problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Kill Timer Problem (/showthread.php?tid=394907)



Kill Timer Problem - jakejohnsonusa - 24.11.2012

I can't kill this timer for some reason here is what I have:
How do I fix this so it kills the timer on /detectoroff

pawn Код:
new DetectorTimer[MAX_PLAYERS];
    new DetectorOn[MAX_PLAYERS]=1;
    if (strcmp("/detectoron", cmdtext, true, 11) == 0)
    {
        if(PlayerInfo[playerid][pDetector])
        {
            if(IsPlayerInAnyVehicle(playerid))
            {
                if(DetectorTimer[playerid] != -1) KillTimer(DetectorTimer[playerid]);//
                SetTimerEx("RunDetector", 2000, true, "i", playerid);
                SendClientMessage(playerid,-1,"Detector On");
                DetectorOn[playerid]=1;
                return 1;
            }
            SendClientMessage(playerid, COLOR_GREY, "** You aren't in a vehicle!");
            return 1;
        }
        SendClientMessage(playerid, COLOR_GREY, "** You don't have a Radar Detector!");
        return 1;
    }
    if (strcmp("/detectoroff", cmdtext, true, 12) == 0)
    {
        if(PlayerInfo[playerid][pDetector])
        {
            if(IsPlayerInAnyVehicle(playerid))
            {
                if(DetectorOn[playerid]==0)return SendClientMessage(playerid,-1,"Detector Already OFF");
                SendClientMessage(playerid,-1,"Detector OFF");
                KillTimer(DetectorTimer[playerid]);
                DetectorOn[playerid]=0;
                return 1;
            }
            SendClientMessage(playerid, COLOR_GREY, "** You aren't in a vehicle!");
            return 1;
        }
        SendClientMessage(playerid, COLOR_GREY, "** You don't have a Radar Detector!");
        return 1;
    }



Re: Kill Timer Problem - -=Dar[K]Lord=- - 24.11.2012

pawn Код:
new DetectorTimer[MAX_PLAYERS];
    new DetectorOn[MAX_PLAYERS]=1;
    if (strcmp("/detectoron", cmdtext, true, 11) == 0)
    {
        if(PlayerInfo[playerid][pDetector])
        {
            if(IsPlayerInAnyVehicle(playerid))
            {
                if(DetectorTimer[playerid] != -1) KillTimer(DetectorTimer[playerid]);//
                DetectorTimer[playerid] = SetTimerEx("RunDetector", 2000, true, "i", playerid);
                SendClientMessage(playerid,-1,"Detector On");
                DetectorOn[playerid]=1;
                return 1;
            }
            SendClientMessage(playerid, COLOR_GREY, "** You aren't in a vehicle!");
            return 1;
        }
        SendClientMessage(playerid, COLOR_GREY, "** You don't have a Radar Detector!");
        return 1;
    }
    if (strcmp("/detectoroff", cmdtext, true, 12) == 0)
    {
        if(PlayerInfo[playerid][pDetector])
        {
            if(IsPlayerInAnyVehicle(playerid))
            {
                if(DetectorOn[playerid]==0)return SendClientMessage(playerid,-1,"Detector Already OFF");
                SendClientMessage(playerid,-1,"Detector OFF");
                KillTimer(DetectorTimer[playerid]);
                DetectorOn[playerid]=0;
                return 1;
            }
            SendClientMessage(playerid, COLOR_GREY, "** You aren't in a vehicle!");
            return 1;
        }
        SendClientMessage(playerid, COLOR_GREY, "** You don't have a Radar Detector!");
        return 1;
    }



Re: Kill Timer Problem - jakejohnsonusa - 24.11.2012

DetectorTimer[playerid] = SetTimerEx("RunDetector", 2000, true, "i", playerid); Didn't fix it... It still won't turn off.


Re: Kill Timer Problem - jakejohnsonusa - 24.11.2012

Anyone know how to kill my timer, I've just finished looking through tutorials and I can figure it out. What did I do wrong