SA-MP Forums Archive
How to use ? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Server (https://sampforum.blast.hk/forumdisplay.php?fid=6)
+--- Forum: Server Support (https://sampforum.blast.hk/forumdisplay.php?fid=19)
+--- Thread: How to use ? (/showthread.php?tid=588836)



How to use ? - TheLegend1 - 12.09.2015

Hey guys.
Well i am trying to convert From seconds to minutes but idk how to use this in a script
pls if someone could gimme an example would help me alot.


script
HTML Code:
TimeConvert(time) {
    new minutes;
    new seconds;
    new string[256];
    if(time > 59)
	{
        minutes = floatround(time/60);
        seconds = floatround(time - minutes*60);
        if(seconds>9)format(string,sizeof(string),"%d:%d",minutes,seconds);
        else format(string,sizeof(string),"%d:0%d",minutes,seconds);
    }
    else
	{
        seconds = floatround(time);
        if(seconds>9)format(string,sizeof(string),"0:%d",seconds);
        else format(string,sizeof(string),"0:0%d",seconds);
    }
    return string;
}