[FilterScript] Fix for 'Huge Shootable Range' Bug
#1

Thanks to one of my friends, I've found a bug which lets others kill you from a HUGE( could be infinite ) distance, which happens if you've been in a vehicle.
So, I got the max. distance for each weapon, and made a simple&short fix.

pawn Код:
#define BULLET_HIT_TYPE_PLAYER          1

public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
    if(hittype == BULLET_HIT_TYPE_PLAYER)
    {
        new
            Float:tX, Float:tY, Float:tZ,
            Float:distance
        ;
        GetPlayerPos(hitid, tX, tY, tZ);
        distance = GetPlayerDistanceFromPoint(playerid, tX, tY, tZ);
        switch(weaponid)
        {
            case WEAPON_SILENCED, WEAPON_COLT45, WEAPON_DEAGLE, WEAPON_UZI, WEAPON_TEC9, WEAPON_SAWEDOFF:
            {
                if(distance > 35) return 0;
            }
            case WEAPON_SHOTGSPA, WEAPON_SHOTGUN:
            {
                if(distance > 40) return 0;
            }
            case WEAPON_MP5:
            {
                if(distance > 45) return 0;
            }
            case WEAPON_AK47:
            {
                if(distance > 70) return 0;
            }
            case WEAPON_M4:
            {
                if(distance > 90) return 0;
            }
            case WEAPON_RIFLE:
            {
                if(distance > 100) return 0;
            }
            case WEAPON_SNIPER:
            {
                if(distance > 300) return 0;
            }
        }
    }
    return 1;
}
Updated, the ranges are more accurate ( Thanks to Lordzy & Vince )
Reply


Messages In This Thread
Fix for 'Huge Shootable Range' Bug - by Kyance - 03.01.2015, 18:24
Re: Fix for 'Huge Shootable Range' Bug - by Lordzy - 03.01.2015, 18:41
Re: Fix for 'Huge Shootable Range' Bug - by Kyance - 03.01.2015, 18:46
Re: Fix for 'Huge Shootable Range' Bug - by Matz - 03.01.2015, 20:03
Re: Fix for 'Huge Shootable Range' Bug - by Neos07 - 03.01.2015, 21:29
Re: Fix for 'Huge Shootable Range' Bug - by Kyance - 04.01.2015, 06:46
Re: Fix for 'Huge Shootable Range' Bug - by JeaSon - 04.01.2015, 06:53
Re: Fix for 'Huge Shootable Range' Bug - by Banana_Ghost - 05.01.2015, 07:41
AW: Fix for 'Huge Shootable Range' Bug - by Flori - 05.01.2015, 10:58
Re: AW: Fix for 'Huge Shootable Range' Bug - by Kyance - 05.01.2015, 13:00

Forum Jump:


Users browsing this thread: 1 Guest(s)