SA-MP Forums Archive
MapTimer Help - 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: MapTimer Help (/showthread.php?tid=532209)



MapTimer Help - Phyzic - 17.08.2014

Hello...

I have a map changing system and it got 13 maps at all.
I want that once the case reaches to 13, which means MapChange==13, it should set it back to 0.

My Code -
Код:
public NewMapTimer(playerid)                      // The callback we forwarded on the beginning of the tutorial
{
	if(MapChange == 13)
	{
	    MapChange=0;
	}
    MapChange++;                                  // this makes it to go to the second MapChange++ part basically does it
    GameTextForAll("~b~Loading ~n~~g~Next Map",4000,3);
    SetTimer("StartedNewRound",4000,false);       // Starts a new timer for the MapChangechange 4 seconds this basically starts the new MapChangeand always must be in false
    return 1;
}
It doesnt give any error but it isn't working.


Re: MapTimer Help - Phyzic - 17.08.2014

Quote:
Originally Posted by sTreamE
Посмотреть сообщение
Read before posting...


Re: MapTimer Help - [KHK]Khalid - 17.08.2014

It can never be zero because you have this code which increases it by one AFTER setting it to zero:

pawn Код:
MapChange ++;
Just move that MapChange increment code to above the 'if' statement and it should be fine.

pawn Код:
public NewMapTimer(playerid)                      // The callback we forwarded on the beginning of the tutorial
{
    MapChange ++; // this makes it to go to the second MapChange++ part basically does it
    if(MapChange == 13)
    {
        MapChange=0;
    }
    GameTextForAll("~b~Loading ~n~~g~Next Map",4000,3);
    SetTimer("StartedNewRound",4000,false);       // Starts a new timer for the MapChangechange 4 seconds this basically starts the new MapChangeand always must be in false
    return 1;
}



Re: MapTimer Help - Phyzic - 17.08.2014

Quote:
Originally Posted by [KHK]Khalid
Посмотреть сообщение
It can never be zero because you have this code which increases it by one AFTER setting it to zero:

pawn Код:
MapChange ++;
Just move that MapChange increment code to above the 'if' statement and it should be fine.

pawn Код:
public NewMapTimer(playerid)                      // The callback we forwarded on the beginning of the tutorial
{
    MapChange ++; // this makes it to go to the second MapChange++ part basically does it
    if(MapChange == 13)
    {
        MapChange=0;
    }
    GameTextForAll("~b~Loading ~n~~g~Next Map",4000,3);
    SetTimer("StartedNewRound",4000,false);       // Starts a new timer for the MapChangechange 4 seconds this basically starts the new MapChangeand always must be in false
    return 1;
}
Same Problem, didnt worked.


Re: MapTimer Help - [KHK]Khalid - 17.08.2014

What do you mean didn't work? It didn't get to zero? Did it reach 13 then?


Re: MapTimer Help - Phyzic - 17.08.2014

Quote:
Originally Posted by [KHK]Khalid
Посмотреть сообщение
What do you mean didn't work? It didn't get to zero? Did it reach 13 then?
Sorry! Mate it worked.. I was doing it in a wrong way, Thank you man!
Cheers