Multiplication in sa-mp
#1

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

You just did it...?
Reply
#3

Uhm, yeah you did...?
Reply
#4

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"
Reply
#5

Oh, I see it now, lol

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

Oh, so it was a float, thanks.
Reply
#7

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);
Reply
#8

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


Forum Jump:


Users browsing this thread: 1 Guest(s)