OnPlayerKeyStateChange
#1

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
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);
    }
}
Reply
#2

And another thing, when someone presses KEY_FIRE very fast, many times, it just doesn't update the variables that fast..so it bans the player
Reply
#3

4-dimensional arrays are not supported as far as I know, the maximum is 3.
Reply
#4

Yeah, ignore that, it's the first version, I changed that a while ago.Now its Players[playerid][Weapons][slot] and Players[playerid][Ammo][slot]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)