Taking a percentage of playr money
#1

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
Reply
#2

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 ^^
Reply
#3

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
Reply
#4

I have a problem here https://sampforum.blast.hk/showthread.php?pid=1127124#pid1127124
Reply
#5

It has been answered, Sujer.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)