Money Ac
#2

Well, im doing little bit different. Im using kinda same method that everyone else use.

pawn Code:
/* Money defines */
#define GivePlayerCash(%0,%1)                                       SetPVarInt(%0,"Money",GetPlayerCash(%0)+%1),GivePlayerMoney(%0,%1)
#define ResetPlayerCash(%0)                                         SetPVarInt(%0,"Money",0), ResetPlayerMoney(%0)
#define GetPlayerCash(%0)                                           GetPVarInt(%0,"Money")


public OnPlayerUpdate(playerid) {
    if(GetPlayerCash(playerid) < GetPlayerMoney(playerid)) {
        foreach(Player, i) {
            new const old_money = GetPlayerCash(playerid);
            ResetPlayerCash(playerid), GivePlayerCash(playerid, old_money);
        }
    }
    return 1;
}
If i want to add or remove or give player cash then i use only one thing.

pawn Code:
if player spawn:GivePlayerCash(playerid, playerVariables[playerid][pCash]);
If he buy something: GivePlayerCash(playerid,-500);
If he get money: GivePlayerCash(playerid, 500);
Reply


Messages In This Thread
Money Ac - by 025Tadija - 10.07.2015, 14:03
Re: Money Ac - by Aprezt - 10.07.2015, 14:51

Forum Jump:


Users browsing this thread: 2 Guest(s)