Money Percentage
#1

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

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

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

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

Thanks all , + Rep'd.
Reply
#6

Or u can simply multiply by 1,1.
Reply
#7

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

What's the difference ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)