28.07.2014, 15:12
Hi guys,
I have problem with making anti-cheats and other stuff when i have to set a variable and after some time to check it because the server in the same time when its changing the variable he is already checking the variable and this can lead to not accurate anti cheat.
For example:
1.I have variable pHealth and my function GiveHealth(playerid, health);
2. Also i have GlobalTimer on 1 second
So sometimes (not every time) when i use GiveHealth(playerid, health-1) the player would get kicked because he has health hack (not accurate)... I found that sometimes the variable lates and sometimes pHealth is for example 100 and GetPlayerHealth is 99...
How can i fix this... The timer is faster than the GiveHealth function and it can lead to kicking innocent players.
I have problem with making anti-cheats and other stuff when i have to set a variable and after some time to check it because the server in the same time when its changing the variable he is already checking the variable and this can lead to not accurate anti cheat.
For example:
1.I have variable pHealth and my function GiveHealth(playerid, health);
Код:
stock GiveHealth(playerid, health) { pHealth[playerid] = health; return SetPlayerHealth(playerid, health); }
Код:
public OnGameModeInIt() { SetTimer("GlobalTimer", 1000, true); return 1; } forward GlobalTimer(); public GlobalTimer() { foreach (new i : Player) { if(pHealth != GetPlayerHealth(i); { Kick(i); } } return 1; }
How can i fix this... The timer is faster than the GiveHealth function and it can lead to kicking innocent players.