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



Counting - trukker1998 - 19.02.2014

Hi, my function return's -1 instead of 1..
Does there exist an substring function or another calculation to change it to the positive count?


Re: Counting - MP2 - 19.02.2014

floatabs()

Or simply 0-value (0 - -5 would be 5).


Re: Counting - trukker1998 - 19.02.2014

Quote:
Originally Posted by MP2
Посмотреть сообщение
floatabs()
Код:
id = floatabs(mysql_fetch_int());
This returns an tag mismatch.


Re: Counting - MP2 - 19.02.2014

FLOATabs takes a FLOAT. There is no integer version. You'll have to use float() and floatround(). Just use 0 - value.


Re: Counting - Konstantinos - 19.02.2014

pawn Код:
id = mysql_fetch_int();
if (id < 0) id *= -1;



Re: Counting - trukker1998 - 19.02.2014

Thankyou!, it worked.