SA-MP Forums Archive
all money robbed, i want only 15% from the total money in hand - 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: all money robbed, i want only 15% from the total money in hand (/showthread.php?tid=463439)



all money robbed, i want only 15% from the total money in hand - Semo - 11.09.2013

why this happens?
when i rob someone it rob alllll of his money, i want only to rob Devide 15 of his money not all.

if i have 10000 cash and someone rob from me 10000 it will be robbed all, i want them to rob only 10000, Devide 15 of 10000

Devide 15 of the money in hand
not all money
see code

10000 devide 15 = 666 or 667 idk lol

pawn Code:
pawn Код:
GetPlayerMoney(id)* ( 1 - 15 / 100 );
plz give me a new code not explain


Re: all money robbed, i want only 15% from the total money in hand - Semo - 12.09.2013

someone help plz


Re: all money robbed, i want only 15% from the total money in hand - iJumbo - 12.09.2013

mmh

Код:
(15 * playermoney) / 100
percent you want * current money all / 100..


Re: all money robbed, i want only 15% from the total money in hand - Semo - 12.09.2013

(15 *GetPlayerMoney(playerid)) / 100

Like this brother?


Re: all money robbed, i want only 15% from the total money in hand - Dubya - 12.09.2013

...

pawn Код:
new Float:money = GetPlayerMoney(playerid);
money = (money * 0.15);
money = Floatround(money);



Re: all money robbed, i want only 15% from the total money in hand - iJumbo - 12.09.2013

pawn Код:
new Rob = (15 * GetPlayerMoney(idtorob)) / 100;
Edit:
If you don't know now Rob is now the variable with the rob amount (your 15%)

you can now sub Rob from player that is robbed
and add Rob to player that robbed