[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
#2

If you're unsure about weapon ranges, refer to weapon.dat found on "data" folder. I know that SA-MP uses it's own files but the weapon ranges could possibly be default.
Reply
#3

Quote:
Originally Posted by Lordzy
Посмотреть сообщение
If you're unsure about weapon ranges, refer to weapon.dat found on "data" folder. I know that SA-MP uses it's own files but the weapon ranges could possibly be default.
Thanks!
And It looks like they're using their own settings, because it shows "100" for the Sniper Rifle, although I've got more than 200 for the Sniper Rifle in most servers.

( removed the shotgun part, misread it )
Reply
#4

Very old known bug fixed by someone else before but I'm not sure whether released or not.
Reply
#5

That will not cause some lag? :/
Reply
#6

Quote:
Originally Posted by Matz
Посмотреть сообщение
Very old known bug fixed by someone else before but I'm not sure whether released or not.
From what I ******d I didn't find any topics like this D:

Quote:
Originally Posted by Neos07
Посмотреть сообщение
That will not cause some lag? :/
Shouldn't cause lag.
Reply
#7

nice
Reply
#8

Does this also fix the bug that allows you to take a huge amount of damage if you're car surfing or around a vehicle, etc?
Reply
#9

Seems good. Well, this bug happens when someone dies(huge distance kill), so it also happens when you just shoot a player? Because i don't understand why you use the OnPlayerWeaponShot callback, and not the OnPlayerDeath callback..(I thought it is more logically to use the OnPlayerDeath callback, because it occurs when someone dies.)
Would be cool if you can explain it to me(or anyone), because i don't understand it. :c
Sorry for that bad question, and thanks in advance.
Reply
#10

Quote:
Originally Posted by Banana_Ghost
Посмотреть сообщение
Does this also fix the bug that allows you to take a huge amount of damage if you're car surfing or around a vehicle, etc?
Nope, this only desyncs the bullet if the "hitid"(aka player who he shot) is out of the weapons bullet distance limit... or w.e

Quote:
Originally Posted by Flori
Посмотреть сообщение
Seems good. Well, this bug happens when someone dies(huge distance kill), so it also happens when you just shoot a player? Because i don't understand why you use the OnPlayerWeaponShot callback, and not the OnPlayerDeath callback..(I thought it is more logically to use the OnPlayerDeath callback, because it occurs when someone dies.)
Would be cool if you can explain it to me(or anyone), because i don't understand it. :c
Sorry for that bad question, and thanks in advance.
My friend and I discovered the bug, when we were trolling around in a server, and he noticed that he can hit players in a HUGE distance, when they exit a vehicle.

So, the bug is there ( for the player who left the vehicle ) until he is spawned.

And I used OnPlayerWeaponShot because It happens for every shot, not just till someone dies
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)