Question with example :D
#1

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);
Код:
stock GiveHealth(playerid, health)
{
	pHealth[playerid] = health;
	return SetPlayerHealth(playerid, health);
}
2. Also i have GlobalTimer on 1 second
Код:
public OnGameModeInIt()
{
	SetTimer("GlobalTimer", 1000, true);
	return 1;
}

forward GlobalTimer();
public GlobalTimer()
{
	foreach (new i : Player)
	{
		if(pHealth != GetPlayerHealth(i);
		{
			Kick(i);
		}
	}
	return 1;
}
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.
Reply
#2

It could be that the player gets damaged. so make it so when a player recieves damage it subtracts pHealth[playerid]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)