[Urgent] Anti-Cheat bug
#1

I have this code set for the anti-cheat:
Код:
public HackCheck(){
	foreach (new i : Player){
		// Don't allow minigun
		if(GetPlayerWeapon(i) >= 35 && GetPlayerWeapon(i) <= 39) {
			if (GetPVarInt(i, "Admin") < 3 && pPun[i][specialpriv] != true){
				new formatted[128], pname[MAX_PLAYER_NAME], playerIP[16];
				GetPlayerName(i, pname, MAX_PLAYER_NAME);
				format(formatted, sizeof(formatted), "%s has been banned for weapon hacks!", pname);
				SendClientMessageToAll(Col_Red, formatted);
				GetPlayerIp(i, playerIP, 16);
				format(formatted, sizeof(formatted), "banip %s", playerIP);
				SendRconCommand(formatted);
				return 0;
			}
		}
	}
	return 1;
}
With this timer.
Код:
SetTimer("HackCheck", 4132, true);
Today it started banning people randomly upon them entering the game. I've relogged to check, and as soon as I entered, it also banned me.
Currently in my game mode, there is NO possible way to acquire any of the weapons listed between 35 and 39.
It worked perfectly before.
Is there any known hack that can give a player (who isn't the hacker) those weapons?
Had to delete my ban list as it banned players. And disabled the anti-hack until further investigation.

Thanks in advance for your support,
Bharel
Reply
#2

maybe u give the weapons in the script by mistake CTRL + F check all giveplayerweapon for any mistake
Reply
#3

None. I do have
Код:
public OnPlayerConnect(playerid){
ResetPlayerWeapons(playerid);
/*more stuffs*/
return 1;
}
on player connection, but I do not think it should cause it.
Reply
#4

Where are you doing this check? There are instances where GetPlayerWeapon doesn't return the right ID (I once got reports of someone getting a minigun after entering a bike as passenger...). I would make sure the player is spawned before you do any kind of anticheat checks. Set a variable to 0 when the player first connects, and after he spawns, set it to 1. If it's set to 1, then do HackCheck() wherever it is you're using it.
Reply
#5

To be honest anticheats must be structured very carefully and as Alternative said,you must assign a variable when the player spawns.

Also I noticed something..

GetPlayerWeapon(i) >= 35 && GetPlayerWeapon(i) <= 39

Umm,why big or equal to 35? This can be the reason... If I were you,I would use it like,

GetPlayerWeapon(i) == 35 || GetPlayerWeapon(i) == 39 etc. etc., this means,if the weapon is 35 OR 39also add the other weapons you forbidden one by one,instead of checking a range of weapons.
Reply
#6

Took your spawned idea. About the weapon range, I forbid all weapons at that range (rocket launchers, flamethrower, minigun, satchel) I doubt a range will make it though. As for getting minigun weapon ID while entering vehicle, how can one fix it?

The check is run every 4132 MS on the timer i've posted earlier.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)