SA-MP Forums Archive
Weapon anti-cheat - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Weapon anti-cheat (/showthread.php?tid=481201)



Weapon anti-cheat - dusk - 14.12.2013

Hello, so I was writing an anti weapon cheat...


pawn Код:
new weaponid = GetPlayerWeapon(playerid);
        if(weaponid != 0)
        {
            new bool:found = false;
            for(new i; i < sizeof(RealPlayerWeapons[]); i++)
            {
                if(weaponid == RealPlayerWeapons[playerid][i][0])
                {
                    found = true;
                    RealPlayerWeapons[playerid][i][1] = GetPlayerAmmo(playerid);
                }
            }
            if(!found) RemovePlayerWeapon(playerid,weaponid);
        }
This is pretty much it.. I hooked the GivePlayerWeapon function for it to add the weapon to "RealPlayerWeapons" array.

It all seems to work fine with miniguns and stuff. But once I cheat myself a weapon like "Nightstick" or a dildo of some sort, it just doesn't remove it.
After I cheated it, I looked trought the array and it wasn't there. So why doesn't it remove it?