GivePlayerCash - On Mod garages.
#3

Ok, i getting the idea indeed but i am a bit confused cause i already have timers set for the money update let me post the code bellow:
Код:
#define ResetMoneyBar ResetPlayerMoney
#define UpdateMoneyBar GivePlayerMoney

new Cash[MAX_PLAYERS];

forward MoneyTimer(playerid); // For Server Side money protection

//ongamemodeinit...
SetTimer("MoneyTimer", 1000, 1);


public MoneyTimer()
{
    new username[MAX_PLAYER_NAME];
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(GetPlayerCash(i) != GetPlayerMoney(i))
            {
                ResetMoneyBar(i);//Resets the money in the original moneybar, Do not remove!
                UpdateMoneyBar(i,GetPlayerCash(i));//Sets the money in the moneybar to the serverside cash, Do not remove!
                new hack = GetPlayerMoney(i) - GetPlayerCash(i);
                GetPlayerName(i,username,sizeof(username));
                printf("%s has picked up/attempted to spawn $%d.", username,hack);
            }
        }
    }
}



//------ Server Side money Protection Stock -----//
//---------------------------------------------------------------------------------------------------------//
stock GivePlayerCash(playerid, money)
{
    Cash[playerid] += money;
    ResetMoneyBar(playerid);//Resets the money in the original moneybar, Do not remove!
    UpdateMoneyBar(playerid,Cash[playerid]);//Sets the money in the moneybar to the serverside cash, Do not remove!
    return Cash[playerid];
}
stock SetPlayerCash(playerid, money)
{
    Cash[playerid] = money;
    ResetMoneyBar(playerid);//Resets the money in the original moneybar, Do not remove!
    UpdateMoneyBar(playerid,Cash[playerid]);//Sets the money in the moneybar to the serverside cash, Do not remove!
    return Cash[playerid];
}
stock ResetPlayerCash(playerid)
{
    Cash[playerid] = 0;
    ResetMoneyBar(playerid);//Resets the money in the original moneybar, Do not remove!
    UpdateMoneyBar(playerid,Cash[playerid]);//Sets the money in the moneybar to the serverside cash, Do not remove!
    return Cash[playerid];
}
stock GetPlayerCash(playerid)
{
    return Cash[playerid];
}
However i just read your EDIT: and going to try your code bud im happy with that color money thing lets hope the rest works hehe and thanks ill post the result..
Reply


Messages In This Thread
GivePlayerCash - On Mod garages. - by CharlieSanchez - 22.04.2014, 13:12
Re: GivePlayerCash - On Mod garages. - by Konstantinos - 22.04.2014, 13:45
Re: GivePlayerCash - On Mod garages. - by CharlieSanchez - 22.04.2014, 13:56
Re: GivePlayerCash - On Mod garages. - by Konstantinos - 22.04.2014, 14:05
Re: GivePlayerCash - On Mod garages. - by CharlieSanchez - 22.04.2014, 14:12
Re: GivePlayerCash - On Mod garages. - by CharlieSanchez - 22.04.2014, 14:35
Re: GivePlayerCash - On Mod garages. - by Konstantinos - 22.04.2014, 14:52
Re: GivePlayerCash - On Mod garages. - by CharlieSanchez - 22.04.2014, 15:51

Forum Jump:


Users browsing this thread: 1 Guest(s)