SA-MP Forums Archive
Is it possible to change GetTickCount format? - 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: Is it possible to change GetTickCount format? (/showthread.php?tid=633443)



Is it possible to change GetTickCount format? - alexjanjaj - 30.04.2017

As an output im using:
format(string, sizeof(string), "It took %d milliseconds to get a right answer!", GetTickCount() - count);
So it will display It took 123456 milliseconds to get a right answer
Is it possible to make it display as "It took 0.1234 milliseconds" , "it took 1.123" milliseconds and so on?

EDIT:If i use %f i will get everytime 0.00000,but this is the format i need thought.


Re: Is it possible to change GetTickCount format? - Dignity - 30.04.2017

https://sampwiki.blast.hk/wiki/Float


Re: Is it possible to change GetTickCount format? - alexjanjaj - 01.05.2017

How would i implement that in my code thought.This is how im using GetTickCount()
count = GetTickCount();
format(string, sizeof(string), "It took %d milliseconds to get a right answer!", GetTickCount() - count);
count = 0;

EDIT:Fixed it,i needed to call it as
format(string, sizeof(string), "It took %f milliseconds to get a right answer!", floatdiv(GetTickCount() - count, 1000));