Тебе сюда:
[pwn]public SyncMoney(playerid)
{
//Debug("player.inc > SyncMoney(playerid) - Start");
if (!IsPlayerConnected(playerid))
{
if (PlayerCasinoMoney[playerid] != 0) PlayerCasinoMoney[playerid] = 0;
MoneyKick[playerid] = 0;
//Debug("player.inc > SyncMoney(playerid) - Stop(257)");
return;
} if (MoneyKick[playerid] >= (MAX_DESYNC/PLAYER_SYNC_DELAY)) KickPlayer(playerid,"Money desync. (Lagg or Cheat)");
if (MoneyUpdateDelay[playerid] > 0)
{
MoneyUpdateDelay[playerid] = 0;
//Debug("player.inc > SyncMoney(playerid) - Stop(266)");
return;
}
new clientmoney;
clientmoney = GetPlayerMoney(playerid);
if (clientmoney == Player[playerid][Money]) //
{
MoneyKick[playerid] = 0;
//Debug("player.inc > SyncMoney(playerid) - Stop(276)");
return;
}
if (IsPlayerInCasino(playerid))
{
if (clientmoney > Player[playerid][Money]+(MAX_WIN*2)) // if players money is lots more
{
new string[MAX_STRING];
format(string,sizeof(string), lang_texts[9][1] ,MAX_WIN);
SendClientMessage(playerid,COLOUR_RED, string);
SetPlayerMoney(playerid,Player[playerid][Money]+MAX_WIN); // set money
MoneyKick[playerid]++; //
PlayerCasinoMoney[playerid] = PlayerCasinoMoney[playerid]+MAX_WIN;
if (clientmoney == Player[playerid][Money])
{
MoneyKick[playerid]=0;
}
}
else if (clientmoney > Player[playerid][Money])
{
new win = clientmoney - Player[playerid][Money];
new string[MAX_STRING];
format(string,sizeof(string), lang_texts[9][2] ,win);
SendClientMessage(playerid,COLOUR_MONEY_GOOD, string);
PlayerCasinoMoney[playerid] = PlayerCasinoMoney[playerid]+win;
oSetPlayerMoney(playerid,clientmoney);
MoneyKick[playerid]=0;
}
else // clientmoney must be <= severmoney
{
new loss;
loss = clientmoney + Player[playerid][Money];
oSetPlayerMoney(playerid,clientmoney);
MoneyKick[playerid]=0;
PlayerCasinoMoney[playerid] = PlayerCasinoMoney[playerid]-loss;
}
if (PlayerCasinoMoney[playerid] > MAX_WIN*1.5)
{
new string[MAX_STRING];
format(string,sizeof(string), lang_texts[9][3] ,MAX_WIN);
SendClientMessage(playerid,COLOUR_RED, string);
if (clientmoney > PlayerCasinoMoney[playerid] + MAX_WIN*2)
{
KickPlayer(playerid,"Won too much in casino.");
}
}
}
else
{
PlayerCasinoMoney[playerid] = 0;
}
if (clientmoney < 0) // if negative value
{
MoneyKick[playerid]++;
oSetPlayerMoney(playerid,0);
//Debug("player.inc > SyncMoney(playerid) - Stop(335)");
return;
}
if (clientmoney < Player[playerid][Money]) // if players money is less (they bought something)
{
#if defined _bank_included
if (!IsPlayerAtBank(playerid))
{
Player[playerid][Money] = clientmoney; // set our money to player money
MoneyKick[playerid] = 0;
}
#else
Player[playerid][Money] = clientmoney; // set our money to player money
MoneyKick[playerid] = 0;
#endif
}
if (clientmoney > Player[playerid][Money]) // if players money is more
{
if (clientmoney > Player[playerid][Money]+MAX_WIN*2) // if players money is lots more
{
KickPlayer(playerid,"Money desync. Possible cheat.");
//Debug("player.inc > SyncMoney(playerid) - Stop(359)");
return;
}
if (!IsPlayerInCasino(playerid))
{
SetPlayerMoney(playerid,Player[playerid][Money]); // set money
MoneyKick[playerid]++; //
if (clientmoney == Player[playerid][Money])
{
MoneyKick[playerid]=0;
}
}
}
if (clientmoney != Player[playerid][Money]) // if still not equal
{
MoneyKick[playerid]++; //
oSetPlayerMoney(playerid,Player[playerid][Money]);
//Debug("player.inc > SyncMoney(playerid) - Stop(380)");
return;
}
//Debug("player.inc > SyncMoney(playerid) - Stop");
return;
}[/pwn]