Taking a percentage of playr money - 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: Taking a percentage of playr money (
/showthread.php?tid=236602)
Taking a percentage of playr money -
Snowman12 - 07.03.2011
right im making a payday for my server how do i take away a percentage as tax lets say 4% i want to take that away from pay check how can i do this
Re: Taking a percentage of playr money -
Hiddos - 07.03.2011
You simply multiply the amount of monies he has with the percentage, in this case 4%:
pawn Код:
GivePlayerMoney(playerid, GetPlayerMoney(playerid) * 0.04);
Should work ^^
Re: Taking a percentage of playr money -
Mauzen - 07.03.2011
This is most basic calculation of percentage.
Money * ( 1.0 - (percent / 100) ) will return the money reduces by <percent> percent.
E.g.
10000 * (1.0 - (4 / 100))
= 10000 * (0.96)
will decrease 10000 by 4%
@Hiddos: your code will increase the players money by 4% instead of decreasing it
Re: Taking a percentage of playr money -
Sujer - 19.03.2011
I have a problem here
https://sampforum.blast.hk/showthread.php?pid=1127124#pid1127124
Re: Taking a percentage of playr money -
Biesmen - 19.03.2011
It has been answered, Sujer.