Need Help with Anti Cheats
#1

I make some anti cheats which i make but i got some problem in them.
-> Anti Interior Hack

its working fine and detect hacker fast but the problem happen SetPlayerPos set by server auto like when you enter in the car modification shop to mod your car then SetPlayerPos and SetPlayerInterior auto set ,and Anti interior hack detect it as player hacking how i can avoid that .


Код:
new bool:TeleportInt[MAX_PLAYERS][19] ;

I make this stock to detect interior id

stock SetPlayerIntEx(playerid, interior)
{
    TeleportInt[playerid][interior] = true;
    SetPlayerInterior(playerid,interior);
}

I am resetting all all interior when player join and on player disconnect

and using Timer 1sec to detect but how i can avoid car modification interiors 
 				 new interior = GetPlayerInterior(i);
				if(TeleportInt[i][interior] == false )
				{
					BanMessages(i, "Interior Hack");
				}
I also try Anti Health hack with this same idea

Код:
stock SetPlayerHealthEx(playerid, Float:Health)
{
	 HealthAllowed[playerid] = true;
     SetPlayerHealth(playerid, Health);
}


save under 1 sec Timer 
 				new Float:health;
        	    GetPlayerHealth(i, health);
            	if (health >= 100  && HealthAllowed[i] == false)
            	{
					BanMessages(i, "Health Hack");
				}

I want to ask is it give problem when he die and auto get Health too fast from OnPLayerSPawn fast rather than getting it from SetPlayerHealthEx ?..
Thanks
Reply
#2

Quote:

This callback is called when a player enters or exits a mod shop.

OnEnterExitModShop
Reply
#3

You mean this?

Код:
public OnEnterExitModShop(playerid, enterexit, interiorid)
{
    if(enterexit == 0) // If enterexit is 0, this means they are exiting
    {
      SetPlayerIntEx(playerid,GetPlayerInterior(playerid));
   
    }
    return 1;
}
Reply
#4

pawn Код:
new CurrentInterior[MAX_PLAYERS] ;

stock SetPlayerIntEx(playerid, interior)
{
    CurrentInterior[playerid] = interior;
    SetPlayerInterior(playerid, interior);
    return 1;
}

if(CurrentInterior[i] !=  GetPlayerInterior(i))
{
    BanMessages(i, "Interior Hack");
}

public OnEnterExitModShop(playerid, enterexit, interiorid)
{
    CurrentInterior[playerid] = interiorid;//This sets the current interior to the new interior the player has entered
    return 1;
}
Reply
#5

Yeah Thank But what about the Anti Health hack?
Код:
stock SetPlayerHealthEx(playerid, Float:Health)
{
	 HealthAllowed[playerid] = true;
     SetPlayerHealth(playerid, Health);
}


save under 1 sec Timer 
 				new Float:health;
        	    GetPlayerHealth(i, health);
            	if (health >= 100  && HealthAllowed[i] == false)
            	{
					BanMessages(i, "Health Hack");
				}
I want to ask is it give problem when he die and auto get Health too fast from OnPLayerSPawn fast rather than getting it from SetPlayerHealthEx ?.
Reply
#6

Anti health hack:
simply, make server-sided health
how ?
just define a new variable and store player health into it.
set a 1 second repeating timer and check if player health is higher than variable value, he is using health hack
if not, set variable value to new player health


a quick example for my explains

Код:
new Float:PlayerHealth[MAX_PLAYERS];

SetPlayerHealthEx(playerid, Float:hp)
{
	PlayerHealth[playerid] = hp;
	return SetPlayerHealth(playerid, hp);
}

public AntiCheat()
{
	for(new i; i < MAX_PLAYERS; i++)
	{
		new Float:health;
		GetPlayerHealth(i, health);
		if(health > PlayerHealth[i])
		{
			//Player Using Health Hack
		}
		else
		{
			//>Player Health decreased, lets set variable value to new health
			PlayerHealth[i] = health;
		}
	}
	return 1;
}
a repeating timer Call "AntiCheat" callback every 1 or 2 second
it's better to use "foreach" instead of "for" loop
Reply
#7

PlayerHealth[playerid] = hp;

Tag Mismatched..

You are storing Float in array ..
Reply
#8

i'm sorry...
it was my fault
Edit:
Код:
new Float:PlayerHealth[MAX_PLAYERS];
Reply
#9

pawn Код:
new Float:CurrentHealth[MAX_PLAYERS];

stock SetPlayerHealthEx(playerid, Float:Health)
{
     CurrentHealth[playerid] = health;
     SetPlayerHealth(playerid, Health);
}


//Timer
    new Float:health;
    GetPlayerHealth(i, health);
    if (health > CurrentHealth[playerid])
    {
        BanMessages(i, "Health Hack");
    }
This just sets the variable to the current health, if his health is higher that when you gave to him it'll give the message
Reply
#10

the Problem is when player die and spawn and he got banned i tested both codes..
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)