SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts > Includes

Reply
 
Thread Tools Display Modes
Old 05/02/2018, 03:26 AM   #1
RogueDrifter
High-roller
 
RogueDrifter's Avatar
 
Join Date: Dec 2017
Location: SA-MP Drifting world.
Posts: 1,090
Reputation: 182
Default OnPlayerWeaponShot Bug Fix + Extended HitType

OnPlayerWeaponShot Wiki bug fix + Extended HitType
Last updated 2018/2/5
Description:
This include addresses the issue of the sa-mp callback OnPlayerWeaponShot, the fact that when you hit a driver in a vehicle its called as hittype vehicle and not the player at all,
Quote:
Originally Posted by SA-MP Wiki
Known Bug(s):
It is called as BULLET_HIT_TYPE_VEHICLE with the correct hitid (the hit player's vehicleid) if you are shooting a player which is in a vehicle. It won't be called as BULLET_HIT_TYPE_PLAYER at all.
And after several painful tests, the fact that the hit reg system of sa-mp is just so so buggy, i came to these conclusions:
1- Passengers dying will be recorded as paused for a second or two (OPU NOT CALLED)
2- Paused players not getting damage inflicted nullify the possibility of detecting the correct hittype.
3- Trying to detect paused passengers OPWS will return shooter id 5949841 and weapon 0 and fX,fY,fZ as emojis
BUT the original OnPlayerWeaponShot doesn't even bother fixing it for not-paused players, this include will:
1- Call the OPWS callback only once for hittype BULLET_HIT_TYPE_PLAYER if it does damage the player.
2- Call it BULLET_HIT_TYPE_VEHICLE if it doesn't damage the player.
3- Due to paused players not getting damaged, this adds a new hittype #5 which is called if a player shoots a vehicle that has a player who is paused, you can either do this one on your own or exclude it from your anti cheat for false positives.
4- Extracts the OPWS info for the shooter instead of returning invalid values all the way.
-=-=-=-=-=-=-
Why you need this:
Basing an anti-cheat or any system at OnPlayerWeaponShot hittype 1 (player) will fuck everything up, it will return false positives for example anti fake death, i myself saw it live people getting banned falsely for not catching the variable of damage in cars due to samp calling OPWS hittype vehicle hitid vehicleid, this include completely fixes that problem for BOTH drivers AND passengers regardless of the fact that passenger's sync is fucked up. If you don't know what i mean by passenger's sync, put an anti pause differing between OPU with 500-800 MS and kill a passenger, he will be detected as a PAUSED player on the kill shot, one false shot is enough to get a player banned for fake death. Again this include also fixes that.
-=-=-=-=-=-=-
Usage:
It's simple somehow, first of all you need to include this in all of your scripts, it's a plug-n-play type of include BUT afterwards you will have to use hittype #5 (new) at your own OnPlayerWeaponShot. Which is called (#5) if a player shoots at another player while he's afk in a vehicle whether its a passenger or a driver.
-=-=-=-=-=-=-
Mechanism:
Delaying most of the callbacks to some extent to evade one being called before/after the other in a messed up order, took me a lot of time to get accurate readings, loads of restarts and edits, checks for damage, pause, loops through players in case of paused and does lots of checks to get an accurate true reading.
-=-=-=-=-=-=-
Comments:
Always watch out for desynced and high lagging players, they might desync the bullets if their ping fucks up the timers. Other than that, all of the timers are BELOW half a second, any delay would be impossible to spot unless if your ping is like 800 or something which will delay even if you aren't using a timer. The purpose of timers is essential without them all of the callbacks will be called in the wrong order causing desynced bullets, false returned values and false positives in the system.
-=-=-=-=-=-=-
Downloads:
Pastebin: LINK
Github: LINK
Attached: LINK
-=-=-=-=-=-=-
Change.Log:
Code:
None so far.
-=-=-=-=-=-=-
My includes:
[Includes]:Anti-Slide-Bug||Anti-Car-Troll||Custom-Class-Selection||Anti-Car-Spam
-=-=-=-=-=-=-
I'd like to also give credits to Eatmysmoke, this guy helped a TON testing this with me til it worked.
Enjoy it, if you got any inquires drop them down below, all feedbacks appreciated.
Attached Files
File Type: zip OnPlayerWeaponShotBugFix.zip (2.2 KB, 22 views)
__________________
Quote:
Originally Posted by RogueDrifter
-For fuck's sake people stop deleting your help threads you're just losing chances of ever getting help again...
[Tutorial]:Anti-cheat guide ||Mini-game 101||VC/LC maps install
[Github]:Link [Pastebin]:Link [Forum]:Link [Server]:Link [Discord]:Link



Quote:
Originally Posted by RogueDrifter
-I'm now available to script small scripts for payments done through paypal.

Last edited by RogueDrifter; 05/02/2018 at 06:52 PM.
RogueDrifter is offline   Reply With Quote
Old 07/02/2018, 12:27 AM   #2
Swarn
Big Clucker
 
Join Date: Sep 2015
Posts: 111
Reputation: 13
Default Re: OnPlayerWeaponShot Bug Fix + Extended HitType

Intresting, thank you for this.
Swarn is offline   Reply With Quote
Old 07/02/2018, 12:33 AM   #3
RogueDrifter
High-roller
 
RogueDrifter's Avatar
 
Join Date: Dec 2017
Location: SA-MP Drifting world.
Posts: 1,090
Reputation: 182
Default Re: OnPlayerWeaponShot Bug Fix + Extended HitType

Quote:
Originally Posted by Swarn View Post
Intresting, thank you for this.
You're welcome! i was surprised that this didn't get many people's attention as this is a serious problem for people basing systems at OnPlayerWeaponShot and i didn't see anyone releasing a fix for it. But oh well lol i'm pretty sure if sa-mp lasts longer it'll help many more on the long-run if it isn't fixed on the next game patches.
__________________
Quote:
Originally Posted by RogueDrifter
-For fuck's sake people stop deleting your help threads you're just losing chances of ever getting help again...
[Tutorial]:Anti-cheat guide ||Mini-game 101||VC/LC maps install
[Github]:Link [Pastebin]:Link [Forum]:Link [Server]:Link [Discord]:Link



Quote:
Originally Posted by RogueDrifter
-I'm now available to script small scripts for payments done through paypal.
RogueDrifter is offline   Reply With Quote
Old 07/02/2018, 01:29 AM   #4
Pottus
Godfather
 
Pottus's Avatar
 
Join Date: Jun 2012
Posts: 5,323
Reputation: 1186
Default Re: OnPlayerWeaponShot Bug Fix + Extended HitType

Just going to say we have much more well thought out includes and this doesn't really do justice for true necessity. Instead you are detracting from the bigger picture by releasing something with limited use that doesn't address the true depth of necessity.

http://forum.sa-mp.com/showthread.php?t=563387

If you can't cover what is covered here then what is the point of releasing an inferior include? Instead you should have looked at updating what is already out there and applied your work there.

I have to give this 1-star it is a distraction from what people should be using and isn't healthy for servers to use this.
Pottus is offline   Reply With Quote
Old 07/02/2018, 01:38 AM   #5
RogueDrifter
High-roller
 
RogueDrifter's Avatar
 
Join Date: Dec 2017
Location: SA-MP Drifting world.
Posts: 1,090
Reputation: 182
Default Re: OnPlayerWeaponShot Bug Fix + Extended HitType

Quote:
Originally Posted by Pottus View Post
Just going to say we have much more well thought out includes and this doesn't really do justice for true necessity. Instead you are detracting from the bigger picture by releasing something with limited use that doesn't address the true depth of necessity.

http://forum.sa-mp.com/showthread.php?t=563387

If you can't cover what is covered here then what is the point of releasing an inferior include? Instead you should have looked at updating what is already out there and applied your work there.

I have to give this 1-star it is a distraction from what people should be using and isn't healthy for servers to use this.
Sorry wait let me get this straight, you're giving my include one star because it doesn't do something i never said it would?
And please, if i may ask, how is it ''inferior''? Or ''unhealthy''?
The include does what i said it does with no bugs found on my end. Although, if you found any do feel free to report them to me. The include you mentioned i just looked at its features and it doesn't fix the hittype bug.
RogueDrifter is offline   Reply With Quote
Old 07/02/2018, 09:25 AM   #6
2Col
Little Clucker
 
Join Date: Nov 2017
Posts: 10
Reputation: 0
Default Re: OnPlayerWeaponShot Bug Fix + Extended HitType

Quote:
Originally Posted by Pottus View Post
Just going to say we have much more well thought out includes and this doesn't really do justice for true necessity. Instead you are detracting from the bigger picture by releasing something with limited use that doesn't address the true depth of necessity.

http://forum.sa-mp.com/showthread.php?t=563387

If you can't cover what is covered here then what is the point of releasing an inferior include? Instead you should have looked at updating what is already out there and applied your work there.

I have to give this 1-star it is a distraction from what people should be using and isn't healthy for servers to use this.
But the author of weapon-config is inactive. There are already a lot of issues and pull requests.
2Col is offline   Reply With Quote
Old 07/02/2018, 10:53 AM   #7
RogueDrifter
High-roller
 
RogueDrifter's Avatar
 
Join Date: Dec 2017
Location: SA-MP Drifting world.
Posts: 1,090
Reputation: 182
Default Re: OnPlayerWeaponShot Bug Fix + Extended HitType

Quote:
Originally Posted by 2Col View Post
But the author of weapon-config is inactive. There are already a lot of issues and pull requests.
And even then, this is nothing like weapon config and i never said it was. This is only a fix for the hittype issue and that is whats written on the post. Nothing more, nothing less. I also have to mention that it does what its supposed to do effictevly and efficiently which was tested online with a fair ping rate. No clue what pottus meant by saying its bad somehow. Users have full choice to pick what they want if they want this theyll use it otherwise wep config is always there, difference is im still here mantaining this and the wep config feature list doesnt include fixing the hittype issue. I didnt leave anything not mentiond, the post explains every bit of the include.
__________________
Quote:
Originally Posted by RogueDrifter
-For fuck's sake people stop deleting your help threads you're just losing chances of ever getting help again...
[Tutorial]:Anti-cheat guide ||Mini-game 101||VC/LC maps install
[Github]:Link [Pastebin]:Link [Forum]:Link [Server]:Link [Discord]:Link



Quote:
Originally Posted by RogueDrifter
-I'm now available to script small scripts for payments done through paypal.

Last edited by RogueDrifter; 07/02/2018 at 12:38 PM.
RogueDrifter is offline   Reply With Quote
Old 07/02/2018, 06:47 PM   #8
Pottus
Godfather
 
Pottus's Avatar
 
Join Date: Jun 2012
Posts: 5,323
Reputation: 1186
Default Re: OnPlayerWeaponShot Bug Fix + Extended HitType

Quote:
Originally Posted by RogueDrifter View Post
Sorry wait let me get this straight, you're giving my include one star because it doesn't do something i never said it would?
And please, if i may ask, how is it ''inferior''? Or ''unhealthy''?
The include does what i said it does with no bugs found on my end. Although, if you found any do feel free to report them to me. The include you mentioned i just looked at its features and it doesn't fix the hittype bug.
Then you update the include instead of fragmenting these types of features with your own include doesn't make sense to me. It is a distraction from the bigger picture it really is.
Pottus is offline   Reply With Quote
Old 07/02/2018, 07:15 PM   #9
RogueDrifter
High-roller
 
RogueDrifter's Avatar
 
Join Date: Dec 2017
Location: SA-MP Drifting world.
Posts: 1,090
Reputation: 182
Default Re: OnPlayerWeaponShot Bug Fix + Extended HitType

Quote:
Originally Posted by Pottus View Post
Then you update the include instead of fragmenting these types of features with your own include doesn't make sense to me. It is a distraction from the bigger picture it really is.
It is in no way meant to be a distraction, i tried my best to explain to people what this really does, which is channel hittype 2 from OPWS to a series of checks with the most minimum possible time for the timers i set to avoid the bullet being hit at second 5 and land on 8, this only does literally one single thing, which is fix the hittype bug, Both includes do different things, his include does many features i'm very aware of that but someone just said people reported many issues and made pull requests and got no response, moreover it isn't mine i can not simply take over it and start updating it, i also don't see why people can not use both if weapon config doesn't have any issues. But hey if slice is active and still has the will to update weapon config include i don't mind providing the code over to him to add onto weapon config and update it. Or if he at least gives me the permission to do so. I will leave him a PM and fork & submit a pull request although his last on date was on 22nd of July.
__________________
Quote:
Originally Posted by RogueDrifter
-For fuck's sake people stop deleting your help threads you're just losing chances of ever getting help again...
[Tutorial]:Anti-cheat guide ||Mini-game 101||VC/LC maps install
[Github]:Link [Pastebin]:Link [Forum]:Link [Server]:Link [Discord]:Link



Quote:
Originally Posted by RogueDrifter
-I'm now available to script small scripts for payments done through paypal.
RogueDrifter is offline   Reply With Quote
Old 07/02/2018, 09:24 PM   #10
Paglia
Little Clucker
 
Join Date: Jul 2013
Posts: 18
Reputation: 0
Default Re: OnPlayerWeaponShot Bug Fix + Extended HitType

Quote:
Originally Posted by Pottus View Post
Then you update the include instead of fragmenting these types of features with your own include doesn't make sense to me. It is a distraction from the bigger picture it really is.
This happens to all sorts of community projects: its much better to have only your name on an include/post itself vs. a commit to an already existing attempt at fixing a "bigger picture" of the issue itself. Then if the author is not active like at the start then it's used as an excuse for people trying to reinvent the wheel on their own instead of improving what's already out there.

No hate to you personally, but I share that idea too: it may not be as shiny as having your own name on it (since you're working on someone else's work) but it will lead to better results for the community.
Paglia is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Include] Extended Chat kaZax Includes 1 14/06/2016 09:00 PM
Teammates can pistol whip despite hittype. Sebz Scripting Help 4 24/12/2015 08:58 PM
OnPlayerWeaponShot & Hittype with Fire Extinguisher Metharon Scripting Help 3 05/07/2015 04:47 AM
[Bug/SRV 0.3.7] Actor hittype 0 Logofero Bug Reports 2 10/05/2015 09:06 AM
Fast 7 Extended UpSMaX Everything and Nothing 15 06/02/2015 09:39 PM


All times are GMT. The time now is 05:28 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.