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



Confused :/ - FireCat - 16.07.2011

Is there any way making this easyer?
Like i have a var called Mins so when he passed the checkpoint with more than 60(1 min) Mins = 1;
Ex:
pawn Код:
if(CountRaceTime[playerid][1] >= 60)
        {
            Mins = 1;
        }
        else if(CountRaceTime[playerid][1] >= 120)
        {
            Mins = 2;
        }
        else if(CountRaceTime[playerid][1] >= 180)
        {
            Mins = 3;
        }
        else if(CountRaceTime[playerid][1] >= 260)
        {
            Mins = 4;
        }
        else if(CountRaceTime[playerid][1] >= 320)
        {
            Mins = 5;
        }
        else if(CountRaceTime[playerid][1] >= 380)
        {
            Mins = 6;
        }
But like instead of writing that all the time.. Is there anyway of a macro or stock so I dont need to write like 60+ seconds?


Re: Confused :/ - Babul - 16.07.2011

Код:
Mins=CountRaceTime[playerid][1]/60;
the Mins is an integer, it wont show values like 1.013, if you want to get the remaining seconds, simply use
Код:
RemainingSeconds=CountRaceTime[playerid][1]%60;
for 222 seconds, it will give you Mins=222/60=3, and RemainingSeconds=222%60=42, thats
3:42