SA-MP Forums Archive
the more money the more pay - 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: the more money the more pay (/showthread.php?tid=400900)



the more money the more pay - GoldZoroGrab - 20.12.2012

hey....

i wanna make the more the player have money in hand the more the money he pay when dies


any help


Re: the more money the more pay - Babul - 20.12.2012

Код:
new Money=GetPlayerMoney(playerid);
new Fees=Money*0.1;
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid,Money-Fees);
...replace 0.1 as 10% to 0.01 for 1% fees etc.


Re: the more money the more pay - Kaaajmak - 20.12.2012

PHP код:
OnPlayerDeath(playeridkilleridreason)
{
        new 
money GetPlayerMoney(playerid);
    
money *= 0.8// or what ever multiplyer
    
ResetPlayerMoney(playerid);
    
GivePlayerMoney(playeridmoney);




Re: the more money the more pay - GoldZoroGrab - 20.12.2012

thanks babul

and thanks kaaajmak

+ rep for both


Re: the more money the more pay - GoldZoroGrab - 20.12.2012

hmmmmmm,,.,,,,

i don't know why i gave rep and thanked you before i test.

its reducing all the player money and giving him - of millions and the player have $0


Help please


Re: the more money the more pay - GoldZoroGrab - 20.12.2012

i want to take now 20% of the dead player money how


when player die

he lose 20% from his his money (-)

ok help?


Re: the more money the more pay - Basssiiie - 20.12.2012

Код:
new curMoney = GetPlayerMoney(playerid);
GivePlayerMoney(playerid, -(curMoney / 5));
It's just a calculation. I think the problem with the previous ones was that the Money variable is an integer, while something like "0.2" and "0.8" a float variable is. Which don't like each other and probably don't want to work together.


Re: the more money the more pay - Randy More - 20.12.2012

pawn Код:
OnPlayerDeath(playerid, killerid, reason)
{
    new money = GetPlayerMoney(playerid);
    new amount = 20*money/100;
    GivePlayerMoney(playerid, -amount);
    return 1;
}



Re: the more money the more pay - Babul - 21.12.2012

Код:
new Percents=10;//added

new Money=GetPlayerMoney(playerid);
new Fees=Money/100*Percents;//changed
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid,Money-Fees);
...weird, sometimes the concept from my previous post works, sometimes it fails...
while experimenting with agent-based pathfinding algorithms, those rounding bugs always occured when recalculating node values. nevertheless, the method above will prove to be more "stable"...


Re: the more money the more pay - GoldZoroGrab - 21.12.2012

Quote:
Originally Posted by Randy More
Посмотреть сообщение
pawn Код:
OnPlayerDeath(playerid, killerid, reason)
{
    new money = GetPlayerMoney(playerid);
    new amount = 20*money/100;
    GivePlayerMoney(playerid, -amount);
    return 1;
}
thanks working gooood

+rep