[Include] OnPlayerInvalidBulletShot
#1

OnPlayerInvalidBulletShot

All this does is detects invalid bullets and passes them to a callback. This should prevent bullet crashers from crashing players. This was apparently fixed in 0.3.7 but it has been patched I believe.

pawn Код:
public OnPlayerInvalidBulletShot(playerid, reason);
The "reason" parameter contains a value relative to these error IDs:

BULLET_INVALID_WEAPON_IDAn invalid weapon ID was used to fire an invalid bullet.
BULLET_INVALID_HIT_TYPEAn invalid hit type was detected.
BULLET_INVALID_HIT_IDAn invalid hit ID was detected.
BULLET_OUT_OF_RANGEThe bullet was out of range from the player.
BULLET_RAPID_SHOTThe bullet was fired too quickly after the previous one.
All invalid bullets are automatically discarded to prevent further damage.

Download: https://www.dropbox.com/s/6c7kxjy0bi...OPIBS.inc?dl=1
Reply
#2

nice job
Reply
#3

THE GODS HAVE OFFERED US A SACRIFICE!
Reply
#4

Yo Emmet, nice work there. Could you tell me does your inc fixes these things I found today in tutorial section?

https://sampforum.blast.hk/showthread.php?tid=581140

https://sampforum.blast.hk/showthread.php?tid=581037

https://sampforum.blast.hk/showthread.php?tid=581129

Thanks!
Reply
#5

Awesome job man!
Reply
#6

Quote:
Originally Posted by Sime30
Посмотреть сообщение
Yo Emmet, nice work there. Could you tell me does your inc fixes these things I found today in tutorial section?

https://sampforum.blast.hk/showthread.php?tid=581140

https://sampforum.blast.hk/showthread.php?tid=581037

https://sampforum.blast.hk/showthread.php?tid=581129

Thanks!
It should detect all invalid bullets fired, hopefully this makes the bullet crasher fully obsolete. I did some extensive testing on a 20+ player server without issues. Also, it should even detect rapid fire!
Reply
#7

I love includes made by you Emmet_, They are always trustworthy.
Thanks!
Reply
#8

Quote:
Originally Posted by Emmet_
Посмотреть сообщение
It should detect all invalid bullets fired, hopefully this makes the bullet crasher fully obsolete. I did some extensive testing on a 20+ player server without issues. Also, it should even detect rapid fire!
It will. The most recent hack release uses invalid weapon IDs to send bullets, primarily crashing players.

As for rapid fire, people should be careful when it comes to using scripts that literally stall the server (probably inefficient object editors). Server hangs are usually create fundamental false-alarms.

I would have instead just desynced every bullet instead of making a callback anyway.
Reply
#9

@Emmet_ & @Lorenc_ - Thanks guys. I was looking for a mastercode that would get rid of those hacks and finally found it. Thanks Emmet_ for the code. Love <3
Reply
#10

Emmet_, I can see a bug already:

pawn Код:
} else if (!((22 <= weaponid <= 34) || weaponid == 38)) {
If the player has a minigun, it looks like it won't work. Mine should work (barely any different):

pawn Код:
if( !( 22 <= weaponid <= 34 ) && weaponid != 38 )
Edit: Both ways work, whoops!
Reply
#11

I tested it with the minigun and it appeared to be fine for me.

It works like this:

pawn Код:
if ((22 <= weaponid <= 34) || weaponid == 38)
This condition checks if the weapon ID is between 22 and 34, or 38.

However, we're doing an inverse check by wrapping the condition with brackets, preceded with NOT (!):

Код:
if ( ! ( (22 <= weaponid <= 34) || weaponid == 38 ) )
Reply
#12

Quote:
Originally Posted by Emmet_
Посмотреть сообщение
I tested it with the minigun and it appeared to be fine for me.

It works like this:

pawn Код:
if ((22 <= weaponid <= 34) || weaponid == 38)
This condition checks if the weapon ID is between 22 and 34, or 38.

However, we're doing an inverse check by wrapping the condition with brackets, preceded with NOT (!):

Код:
if ( ! ( (22 <= weaponid <= 34) || weaponid == 38 ) )
Aha, didn't see that. Whoops!
Reply
#13

Test your Script Please ! its not working and giving false results ...
Reply
#14

Quote:
Originally Posted by BlowUP
Посмотреть сообщение
Test your Script Please ! its not working and giving false results ...
Could you debug it and give me the results:

pawn Код:
public OnPlayerInvalidBulletShot(playerid, reason)
{
    printf("%i", reason);
}
Reply
#15

After using this include some players cannot give damage to other players with certain weapons. There was a player who couldn't give damage with Desert Eagle, Combat Shotgun but was able to give damage by punching and using grande, minigun( did not test all the weapons). Same thing happened with me and some other players with same weapons.
Reply
#16

All bugs should be fixed now. Re-download the include and test.
Reply
#17

Quote:
Originally Posted by Emmet_
Посмотреть сообщение
All bugs should be fixed now. Re-download the include and test.
Hey Emmet, doesn't 0.3.7 R2 prevent us from all bulletcrash hacks?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)