SA-MP Forums Archive
Map 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: Map timer problem.. (/showthread.php?tid=504404)



Map timer problem.. - MythicalMarauder - 04.04.2014

Hi..
I really can't describe the problem, so I recorded a video. Here it is:
http://www.youtube.com/watch?v=57a8M...ature=*********
It skips 30 seconds everytime..
Here's the code:
pawn Код:
// at the top
new GameMinutes =5;
new GameSeconds =30;
//-------------//
public MainTimer() // my own timer, updates every 1 second.
{
        if(GameSeconds || GameMinutes) {
        GameSeconds--;
        if(GameSeconds <= -1) {
            GameMinutes--;
            GameSeconds=30;
        }
        new TimeString[128];
        format(TimeString,sizeof(TimeString),"~b~%02d:%02d",GameMinutes,GameSeconds);
        TextDrawSetString(Textdraw5,TimeString);
    }
}
//---------------//
public NewRound(playerid) {
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        SpawnPlayer(i);
        switch(CurrentMap)
        {
            case 0:
            {
                SetPlayerInterior(i,0);
                GameMinutes =5;
                GameSeconds =30;
            }
            case 1:
            {
                SetPlayerInterior(i,0);
                GameMinutes =5;
                GameSeconds =30;
            }
            case 2:
            {
                SetPlayerInterior(i,0);
                GameMinutes =5;
                GameSeconds =30;
            }
            case 3:
            {
                SetPlayerInterior(i,0);
                GameMinutes =5;
                GameSeconds =30;
            }
            case 4:
            {
                SetPlayerInterior(i,0);
                GameMinutes =5;
                GameSeconds =30;
            }
            case 5:
            {
                SetPlayerInterior(i,0);
                GameMinutes =5;
                GameSeconds =30;
            }
        }
    }
    return 1;
}
I took this map switching system from The Renaissance project by vasillis.


Re: Map timer problem.. - Jay_ - 04.04.2014

On line 8 of your code you are resetting the GameSeconds variable to 30. This should be 59.


Re: Map timer problem.. - MythicalMarauder - 04.04.2014

lol! Sorry for failing :P

Thank you, it works, but now it switches the map and there are 2 minutes left.. :/


Re: Map timer problem.. - MythicalMarauder - 04.04.2014

uhm ?


Re: Map timer problem.. - MythicalMarauder - 06.04.2014

Guys.. ?


Re: Map timer problem.. - MythicalMarauder - 06.04.2014

For God's sake. I need to host this server soon! Someone help me..