SA-MP Forums Archive
How do I? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How do I? (/showthread.php?tid=221029)



How do I? - ŔлŁiĸ - 04.02.2011

How do I make my script auto. move on to another minigame after five minutes? I know the commands to make it go to another minigame but is there a way to make the script know when five minutes is up to just go to the next?

Example:
Код:
I got three minigames so far. One called Hay Climb, gungame & Mini Wars IV. I want a timer to go off after five minutes when its on the minigame Mini Wars to just go straight to a new one.
I just need the code to make it switch after a 5 minute period. Hopefully this makes since I cannot really explain it that well, but hopefully someone gets what I mean.



Re: How do I? - admantis - 04.02.2011

For a basic idea. You need to create a global variable will specify the current game.
pawn Код:
forward SwitchGame();
new CurrentGame = 1;
#define MAX_GAMES 3 // The ammount of your games
/* You will also need to identify / define your games, EX:
1 = hay climb
2 = gun game
3 = miniwars_IV
or use #define miniwars_IV 1
pawn Код:
public OnGameModeInit()
{
    SetTimer("SwitchGame",60*1000*5,true);
}
pawn Код:
public SwitchGame()
{
   if (CurrentGame == MAX_GAMES) CurrentGame = 1;
   CurrentGame++;
}
pawn Код:
public OnPlayerSpawn(playerid)
{
   switch (CurrentGame)
   {
        case 1:
        {
            // Set positions, etc, according to game 1.
        }
        case 2:
        {
            // Set positions, etc, according to game 2.
        }
        case 3:
        {
            // Set positions, etc, according to game 3.
        }
         return 1;
}
I hope you get the basic idea, and If you can't manage to script it yourself basing off this, you should not make it, it will give you a headache.
Ye sorry for identation