22.04.2014, 13:56
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:
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..
Код:
#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]; }