OnPlayerInvalidBulletShot - Emmet_ - 10.07.2015
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_ID | An invalid weapon ID was used to fire an invalid bullet. |
BULLET_INVALID_HIT_TYPE | An invalid hit type was detected. |
BULLET_INVALID_HIT_ID | An invalid hit ID was detected. |
BULLET_OUT_OF_RANGE | The bullet was out of range from the player. |
BULLET_RAPID_SHOT | The 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
Re: OnPlayerInvalidBulletShot -
alex10 - 10.07.2015
nice job
Re: OnPlayerInvalidBulletShot -
eXeDev - 10.07.2015
THE GODS HAVE OFFERED US A SACRIFICE!
Re: OnPlayerInvalidBulletShot -
Sime30 - 10.07.2015
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!
Re: OnPlayerInvalidBulletShot -
muzammilfreeman - 10.07.2015
Awesome job man!
Re: OnPlayerInvalidBulletShot - Emmet_ - 11.07.2015
Quote:
Originally Posted by Sime30
|
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!
Re: OnPlayerInvalidBulletShot -
XxBaDxBoYxX - 11.07.2015
I love includes made by you Emmet_, They are always trustworthy.
Thanks!
Re: OnPlayerInvalidBulletShot -
Lorenc_ - 11.07.2015
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.
Re: OnPlayerInvalidBulletShot -
Sime30 - 11.07.2015
@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
Re: OnPlayerInvalidBulletShot -
Lorenc_ - 11.07.2015
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!
Re: OnPlayerInvalidBulletShot - Emmet_ - 11.07.2015
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 ) )
Re: OnPlayerInvalidBulletShot -
Lorenc_ - 11.07.2015
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!
Re: OnPlayerInvalidBulletShot -
BlowUP - 12.07.2015
Test your Script Please ! its not working and giving false results ...
Re: OnPlayerInvalidBulletShot - Emmet_ - 12.07.2015
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);
}
Re: OnPlayerInvalidBulletShot -
codeshadow - 12.07.2015
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.
Re: OnPlayerInvalidBulletShot - Emmet_ - 12.07.2015
All bugs should be fixed now. Re-download the include and test.
Re: OnPlayerInvalidBulletShot -
n0minal - 12.07.2015
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?