SA-MP Forums Archive
Simple timer doesn't work.. - 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: Simple timer doesn't work.. (/showthread.php?tid=483970)



Simple timer doesn't work.. - kubeba59 - 28.12.2013

pawn Код:
new Float:RandomSpawn[][3] =
{
    {2327.1094,-1169.7896,28.0864},
    {2327.1094,-1169.7896,28.0864},
    {2327.1094,-1169.7896,28.0864}
};

forward StartFire();


SetTimer("StartFire",60000,1);


public StartFire()
{
    new
        rand = random(sizeof(RandomSpawn))
    ;
   
    CreateFire(RandomSpawn[rand][0], RandomSpawn[rand][1], RandomSpawn[rand][2]);
    SendClientMessageToAll(COLOR_WHITE, "A BIG FIRE HAS STARTED !");

    for(new x = 0; x < MAX_PLAYERS; x++)
    {
        if(IsPlayerConnected(x)) SetPlayerCheckpoint(x, RandomSpawn[rand][0], RandomSpawn[rand][1], RandomSpawn[rand][2], 3.0);
    }

    return 1;
}



Re: Simple timer doesn't work.. - ToiletDuck - 28.12.2013

Add this under OngamemodeInit
pawn Код:
public OnGamemodeInit() {
SetTimer("StartFire",60000,1);

//rest of your code



Re: Simple timer doesn't work.. - kubeba59 - 28.12.2013

Quote:
Originally Posted by ToiletDuck
Посмотреть сообщение
Add this under OngamemodeInit
pawn Код:
public OnGamemodeInit() {
SetTimer("StartFire",60000,1);

//rest of your code
What do you mean.. ?I want that the timer will active the fire bro


Re: Simple timer doesn't work.. - ToiletDuck - 28.12.2013

If you want to start creating fire in random coords.

Just Put this Under your OnGamemodeInit
pawn Код:
SetTimer("StartFire",60000,1); // PUT THIS UNDER YOUR ON GAMEMODEINIT every 1 min the StartFire function will call



Re: Simple timer doesn't work.. - kubeba59 - 28.12.2013

Quote:
Originally Posted by ToiletDuck
Посмотреть сообщение
If you want to start creating fire in random coords.

Just Put this Under your OnGamemodeInit
pawn Код:
SetTimer("StartFire",60000,1); // PUT THIS UNDER YOUR ON GAMEMODEINIT every 1 min the StartFire function will call
Thats what I did from the first try..


Re: Simple timer doesn't work.. - kubeba59 - 29.12.2013

Up.. Plz help ..


Re: Simple timer doesn't work.. - Stereotype - 29.12.2013

pawn Код:
public StartFire()
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            new rand = random(sizeof(RandomSpawn));
            CreateFire(RandomSpawn[rand][0], RandomSpawn[rand][1], RandomSpawn[rand][2]);
            SendClientMessageToAll(COLOR_WHITE, "A BIG FIRE HAS STARTED !");
            SetPlayerCheckpoint(i, RandomSpawn[rand][0], RandomSpawn[rand][1], RandomSpawn[rand][2], 3.0);
        }
    } // not connected
    return 1;
}