SA-MP Forums Archive
Timer Question [reps] - 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: Timer Question [reps] (/showthread.php?tid=499439)



Timer Question [reps] - SPA - 08.03.2014

Hello, iv wondering if my functions working well,
Код:
	CMD:minievent(playerid, params[])
    {
        #pragma unused params

    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "You must be an RCON Admin to use this command.");
    if(MinigunEvent) return SendClientMessage(playerid, 0xFF0000FF, "There is already a minigun event running. Wait for it to finish.");
    for(new i = 0; i < MAX_PLAYERS; i++) //Foreach is recommended here...
    {
        if(!IsPlayerConnected(i)) continue;
        if(DMZone[i] < 1 && GodMode[i] == 0)
        {
        GivePlayerWeapon(i, 38, 50000); //Gives a minigun with 5000 ammo.
        }
    }
    MinigunEvent = true;
    SetTimer("ResetMinigunEvent", 60000, false); //Sets a timer for 60 seconds (1 minute).
    SendClientMessageToAll(0xFFFF00FF, "A Minigun Event has begun. It will end in 1 minute.");
    GameTextForAll("~N~~N~~N~~N~~N~~r~~h~MINIGUN~n~~h~Fight!",5000,5);
    return 1;
    }
CALL:
Код:
forward ResetMinigunEvent();
public ResetMinigunEvent()
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(DMZone[i] < 1 && GodMode[i] == 0)
        {
        if(!IsPlayerConnected(i)) continue;
        SetPlayerAmmo(i,38, 0);
		//RemovePlayerWeapon(i, 38);
        }
    }
    MinigunEvent = false;
    GameTextForAll("~N~~N~~N~~N~~r~~h~MINIGUN-EVENT ~R~ENDED",5000,5);
    return 1;
}
I meant the timer, it will keep repeating ? because iv tried SetTimerEX and it was keep repeating "MINIGUN EVENT ENDED"


Re: Timer Question [reps] - SPA - 08.03.2014

bump!


Re: Timer Question [reps] - Chrillzen - 08.03.2014

https://sampwiki.blast.hk/wiki/SetTimer

It won't keep repeating because you set the boolean as false.