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



change number - Dreftas - 27.06.2009

How -5555 change to 5555 ?


Re: change number - Serediucr - 27.06.2009

be more explicit


Re: change number - Dreftas - 27.06.2009

I need to change any number that is negative variable (< 0) to its positive variable (> 0), remove - from variable if it has it.

Damn, example:

new a = -number;
new b;

How to make b = +number ?


Re: change number - member - 27.06.2009

i think it's possible with strdel, just delete the "-" from the number.


Re: change number - Dreftas - 27.06.2009

Isn't there some function like:
pawn Код:
new a = -5, b;
b = modulus(a);
and then b automatically = 5
??



Re: change number - dice7 - 27.06.2009

pawn Код:
-5555 * (-1) = 5555
Sixth grade people ?


Re: change number - Dreftas - 27.06.2009

I have problems with mathematic, so not everything i can remember and do easily Thx for help


Re: change number - arnutisz - 27.06.2009

Well, I think this should work:

pawn Код:
new a = -5, b;

b = a-2*a;
Hope this works. Simple, right?


Re: change number - gytisx - 27.06.2009

Quote:
Originally Posted by Dreftas
I have problems with mathematic, so not everything i can remember and do easily Thx for help
What do you do with this formule?


Re: change number - Weirdosport - 27.06.2009

I don't know what the hell you're doing with all this a/b nonsense, looks like BODMAS disaster in the making.

All you need to do is check if it's below 0, then either times it by -1, or subtract it from 0.

Eg. you have -5555

-5555 x -1 = 5555

0 - ( - 5555) = 5555