SA-MP Forums Archive
Money Percentage - 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: Money Percentage (/showthread.php?tid=508666)



Money Percentage - Affan - 23.04.2014

So I'm trying to do like this . Get players cash and multiply it by 10%
Example: If Player1 has $1000 , the payday system will get the $1000 and multiply it by 10% and gives the cash.
Here is my script atm. It's giving like max cash

pawn Код:
forward payday(playerid);
public payday(playerid)
{
    for(new i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i))
    {
        new money, perc;
        money = GetPlayerMoney(playerid);
        perc = money*2;
        GivePlayerMoney( playerid, perc );
        SendClientMessage(playerid, COLOR_WHITE,"Testing payday!");
        SendClientMessage(playerid, COLOR_WHITE,"You have recieve a check of $%i", perc);
    }
    return 1;
}



Re: Money Percentage - Kyle - 23.04.2014

So, do you want it to take his 1000 and let him keep 10% of it?

Or do you want it to give him 110% of his money? So if he has 1000 he gets 1100?


Re: Money Percentage - PrivatioBoni - 23.04.2014

Can you not use 0.1 or is my maths failing me today?


Re: Money Percentage - Konstantinos - 23.04.2014

pawn Код:
GivePlayerMoney(playerid, (GetPlayerMoney(playerid) * 10) / 100);



Re: Money Percentage - Affan - 23.04.2014

Thanks all , + Rep'd.


Re: Money Percentage - anou1 - 23.04.2014

Or u can simply multiply by 1,1.


Re: Money Percentage - anou1 - 23.04.2014

When you divide by 100 a number like 17 you will have to use float too...

What's the difference ?