19.04.2018, 19:43
Everything that contains timer on my server is not working properly. It works well for the first player. Then everything gets doubled for the second and triple for the third.
A health timer from my server:
This should decrease 1 HP after every 30 seconds. But when the second player joins, his health decreases at double speed and triple for the third. I have fuel system and payday system which are written the same way and giving same problem.
A health timer from my server:
PHP код:
new healthtimer[MAX_PLAYERS];
PHP код:
public OnPlayerConnect(playerid)
{
healthtimer[playerid] = SetTimerEx("DecreaseHealth", 30000, 1, "i", playerid);
return 1;
}
PHP код:
public DecreaseHealth(playerid) // Decreases player health by 1
{
new Float:health;
GetPlayerHealth(playerid, health);
SetPlayerHealth(playerid, health - 1.0);
return 1;
}
PHP код:
public OnPlayerDisconnect(playerid, reason)
{
KillTimer(healthtimer[playerid]);
SaveAccount(playerid);
return 1;
}