20.08.2015, 07:22
hello everyone so tittle says all i have problem in my server sided money hack it adds money when somone respawn or kill himself
like ihve $60 and after respawn it will be $120
60 + 60 = 120 ( after respawn) and again respawn it will be ( 120 + 120 = 240) what is the problem
like ihve $60 and after respawn it will be $120
60 + 60 = 120 ( after respawn) and again respawn it will be ( 120 + 120 = 240) what is the problem
PHP код:
#define ResetMoneyBar ResetPlayerMoney
#define UpdateMoneyBar GivePlayerMoney
GivePlayerCash(playerid, money)
{
pInfo[playerid][Money] += money;
ResetMoneyBar(playerid);//Resets the money in the M4 moneybar, Do not remove!
UpdateMoneyBar(playerid,pInfo[playerid][Money]);//Sets the money in the moneybar to the serverside cash, Do not remove!
return pInfo[playerid][Money];
}
SetPlayerCash(playerid, money)
{
pInfo[playerid][Money] = money;
ResetMoneyBar(playerid);//Resets the money in the M4 moneybar, Do not remove!
UpdateMoneyBar(playerid,pInfo[playerid][Money]);//Sets the money in the moneybar to the serverside cash, Do not remove!
return pInfo[playerid][Money];
}
ResetPlayerCash(playerid)
{
pInfo[playerid][Money] = 0;
ResetMoneyBar(playerid);//Resets the money in the M4 moneybar, Do not remove!
UpdateMoneyBar(playerid,pInfo[playerid][Money]);//Sets the money in the moneybar to the serverside cash, Do not remove!
return pInfo[playerid][Money];
}
GetPlayerCash(playerid)
{
return pInfo[playerid][Money];
}
function MoneyTimer()
{
new str[64];
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(GetPlayerCash(i) < GetPlayerMoney(i))
{
ResetMoneyBar(i);//Resets the money in the M4 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);
format(str, sizeof(str),"AC ALERT: %s (ID:%d) has cheated $%d",GetName(i),i,hack);
printf("%s has picked up/attempted to spawn $%d.", GetName(i),hack);
}
}
}
return 1;
}
// under onplayerspawn
ResetMoneyBar(playerid);//Resets the money in the M4 moneybar, Do not remove!
GivePlayerCash(playerid,pInfo[playerid][Money]);
// under onplayerconnect
ResetPlayerCash(playerid); //Resetting the players cash variable to zero.