17.01.2012, 13:59
Hi,
So I have this problem..I'm using OnPlayerKeyStateChange to detect if a player is weapon or ammo cheating.I'm doing it by saving all the weapons in variables and then comparing them with the actual player stats.The problem is(I think) that OPKSC is too slow, or there's something wrong I'm doing.
When a player starts shooting, ammo hack is detected because variables are not updated as fast as the player shoots.
Here's an example:
OnPlayerKeyStateChange
So I have this problem..I'm using OnPlayerKeyStateChange to detect if a player is weapon or ammo cheating.I'm doing it by saving all the weapons in variables and then comparing them with the actual player stats.The problem is(I think) that OPKSC is too slow, or there's something wrong I'm doing.
When a player starts shooting, ammo hack is detected because variables are not updated as fast as the player shoots.
Here's an example:
OnPlayerKeyStateChange
pawn Код:
AntiWeaponCheat(playerid);
new weapon = GetPlayerWeapon(playerid);
new slot = GetWeaponSlot(weapon);
PlayerInfo[playerid][WP][0][slot] = weapon;//[WP][0] = Weapon | [WP][1] = Ammo
PlayerInfo[playerid][WP][1][slot] = GetPlayerAmmo(playerid);
pawn Код:
public AntiWeaponCheat(playerid)
{
new weapon = GetPlayerWeapon(playerid);
new slot = GetWeaponSlot(weapon);
if(weapon != PlayerInfo[playerid][WP][0][slot] || GetPlayerAmmo(playerid) != PlayerInfo[playerid][WP][1][slot])
{
Ban(playerid);
}
}