Weapon hack check
#12

FIXED

To anyone having trouble with this:

Under OnPlayerUpdate:

PHP код:
new currweapon GetPlayerWeapon(playerid);
new 
lastweapon GetPVarInt(playerid"LastWeap");
if(
currweapon != lastweapon)
{
    
OnPlayerWeaponChange(playeridlastweaponcurrweapon);
    
SetPVarInt(playerid"LastWeap"currweapon);

The OnPlayerWeaponChange function:

PHP код:
stock OnPlayerWeaponChange(playeridlastweapnewweap)
{
    if(
PlayerInfo[playerid][pGuns][11] != 46 && newweap == 46
    
// Assigning the parachute to pGuns (because i.e., if you jump out of a hydra, you get a parachute)
    
{
        
PlayerInfo[playerid][pGuns][11] = 46;
        return 
1;
    }
    
    if(
newweap != 0)
    {
        if(
PlayerInfo[playerid][pGuns][GetGunSlot(newweap)] != newweap)
        {
            
// ... your ban code
            
return 1;
        }
    }
    return 
1;

GetGunSlot for getting the weapon slot (obviously):

PHP код:
stock GetGunSlot(weaponid)
{
    switch(
weaponid)
    {
        case 
01: return 0;
        case 
.. 9: return 1;
        case 
10 .. 15: return 10;
        case 
16 .. 1839: return 8;
        case 
22 .. 24: return 2;
        case 
25 .. 27: return 3;
        case 
282932: return 4;
        case 
3031: return 5;
        case 
3334: return 6;
        case 
35 .. 38: return 7;
        case 
40: return 12;
        case 
41 .. 43: return 9;
        case 
44 .. 46: return 11;
    }
    return -
1;

No use of GetPlayerWeaponData leads to no bugs what so ever.
Reply


Messages In This Thread
Weapon hack check - by iamjems - 29.12.2016, 14:23
Re: Weapon hack check - by HydraHumza - 29.12.2016, 14:43
Re: Weapon hack check - by iamjems - 29.12.2016, 15:38
Re: Weapon hack check - by denNorske - 29.12.2016, 23:01
Re: Weapon hack check - by iamjems - 30.12.2016, 01:20
Re: Weapon hack check - by denNorske - 30.12.2016, 01:55
Re: Weapon hack check - by iamjems - 30.12.2016, 10:08
Re: Weapon hack check - by iamjems - 30.12.2016, 10:53
Re: Weapon hack check - by BlackBank - 30.12.2016, 14:30
Re: Weapon hack check - by cessil - 30.12.2016, 14:45
Re: Weapon hack check - by iamjems - 30.12.2016, 18:17
Re: Weapon hack check - by iamjems - 19.02.2017, 16:27

Forum Jump:


Users browsing this thread: 5 Guest(s)