SA-MP Forums Archive
Multiplication in sa-mp - 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: Multiplication in sa-mp (/showthread.php?tid=114670)



Multiplication in sa-mp - kLx - 20.12.2009

Hello, how I can do this math action in sa-mp?
pawn Код:
new checks = 1000;
new tax = checks*0.02;
print(tax);
Thanks


Re: Multiplication in sa-mp - daalz - 20.12.2009

You just did it...?


Re: Multiplication in sa-mp - LarzI - 20.12.2009

Uhm, yeah you did...?


Re: Multiplication in sa-mp - kLx - 20.12.2009

No. It gives me some kinda error, w8 a sec

Код:
S:\SA-MP Files\VRP\gamemodes\obj.pwn(380) : warning 213: tag mismatch
S:\SA-MP Files\VRP\gamemodes\obj.pwn(381) : error 035: argument type mismatch (argument 1)
S:\SA-MP Files\VRP\gamemodes\obj.pwn(380) : warning 204: symbol is assigned a value that is never used: "tax"



Re: Multiplication in sa-mp - LarzI - 20.12.2009

Oh, I see it now, lol

use:
pawn Код:
new checks = 1000;
new Float:tax = checks*0.02;
printf("%f", tax);



Re: Multiplication in sa-mp - kLx - 20.12.2009

Oh, so it was a float, thanks.


Re: Multiplication in sa-mp - Nero_3D - 20.12.2009

Quote:
Originally Posted by kLx
Oh, so it was a float, thanks.
the float tag isnt important but gives a more accurate result
if you do it like that it will take the number directly without fractional digits

pawn Код:
new checks = 1000;
new tax = checks*0.02;
printf("%d", tax);



Re: Multiplication in sa-mp - Dark_Kostas - 20.12.2009

I think it will also work by
pawn Код:
printf(tag);
but im not sure