18.01.2011, 19:19
Quote:
Maan, 30 seconds is damn long. Cheater could spawn some money and buy ie house before it takes his money. If i'll change it to 1sec, it will lag my server?
|
Creating a new timer for every player just to update his money is a bit pointless
This speedometer timer runs every 500ms.
When you hack money, you only see it for maximum 500ms, then the money on client side is resetted to the money at server side again, making the hack pointless.
Just create a timer that runs every 500ms:
pawn Код:
new Money[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
SetTimerEx("MoneyTimer", 500, true, "i", playerid);
return 1;
}
forward MoneyTimer(playerid);
public MoneyTimer(playerid)
{
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid, Money[playerid]);
}
pawn Код:
Money[playerid] = Money[playerid] + payment;
It's only 2 instructions after all (ResetPlayerMoney and GivePlayerMoney) that are executed every 500ms.