Simple anti infinite ammo
#1

Hey.

What I'm trying to do is simple detection for infinite ammo, when I tested it with another person it worked fine.
When it's on server, it detect the infinite ammo but often detects a player without hacks also, so the code I tried is the following:

pawn Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
    OldAmmo[playerid] = GetPlayerAmmo(playerid);
    SetTimerEx("CheckUnlimitedAmmo", 500, false, "i", playerid);
    return 1;
}

public CheckUnlimitedAmmo(playerid)
{
    new msg[128];
    NewAmmo[playerid] = GetPlayerAmmo(playerid);
    if (OldAmmo[playerid] == NewAmmo[playerid]){
        format(msg,sizeof(msg),"[AC] Possible infinite ammo hack on %s",GetPlayerNameEx(playerid, ENameType_CharName));
        ABroadcast(X11_YELLOW, msg, EAdminFlags_All);
    }
    return true;
Where is the problem that script detects a player without hacks also ? :/
Reply
#2

the true boolean is returning after if statement put it inside and false boolean outside
Reply
#3

GetPlayerAmmo under OnPlayerWeaponShot returns the player's current ammo.
So NewAmmo[playerid] and OldAmmo[playerid] would be the same.

Try something like this:
Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
    new ammo = GetPlayerAmmo(playerid);
    if (ammo != OldAmmo[playerid] - 1)
    {
        // Possible hacks
    }
    OldAmmo[playerid] = ammo;
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)