SA-MP Forums Archive
Problem with multiplication - 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: Problem with multiplication (/showthread.php?tid=298434)



Problem with multiplication - RenisiL - 20.11.2011

What could be the problem?

Код:
warning 213: tag mismatch
pawn Код:
GivePlayerMoney( playerid, SERVERIO_NAMAI[ ID ][ Namo_Kaina ] * 0.08);
Thanks : )


AW: Problem with multiplication - Babul - 20.11.2011

GivePlayerMoney() uses an interger. due to the multiplication by 0.08, it becomes a float. simple solution:
Код:
GivePlayerMoney( playerid, floatround( SERVERIO_NAMAI[ ID ][ Namo_Kaina ] * 0.08),floatround_floor);



Re: Problem with multiplication - Ash. - 20.11.2011

Is: "SERVERIO_NAMAI[ ID ][ Namo_Kaina ]" a float?
GivePlayerMoney(..) can only use Integers, as SA does not support decimalised currency.
And, what is "ID"?

Edit: I posted at the same time as Babul (a)


Re: Problem with multiplication - RenisiL - 20.11.2011

Thanks, but now: data/GUI.pwn(1690) : warning 202: number of arguments does not match definition


Re: Problem with multiplication - SmiT - 20.11.2011

pawn Код:
GivePlayerMoney( playerid, ( floatround ( SERVERIO_NAMAI[ ID ][ Namo_Kaina ] * 0.08 ), floatround_floor ) );



Re: Problem with multiplication - RenisiL - 20.11.2011

funky: it's house id from cycle for

pawn Код:
for( new ID; ID < MAX_HOUSES; ID++ )



Re: Problem with multiplication - Ash. - 20.11.2011

Quote:
Originally Posted by RenisiL
Посмотреть сообщение
funky: it's house id from cycle for

pawn Код:
for( new ID; ID < MAX_HOUSES; ID++ )
Ah

Use floatround(..) as Babul suggested, or don't multiply it by 0.08. Why are you multiplying it by that anyway, what's it for?


Re: Problem with multiplication - RenisiL - 20.11.2011

Thanks all, problem solved : )