Tutorial: Catching Weapons Fire in mod inspecific fashion
1 Attachment(s)
This tutorial brought to you by: Urahara
More tutorials, as well as additional assistance, can be found at: http://urahara.amxmodx.org/forums/ This doesn't seem like such a hard thing to figure out; after all, mods do it all the time. However, it becomes rather tricky once you realize four things: 1. Mods don't all follow the same standards. 2. Mini-mods can fuck with buttons. 3. Melee and explosive devices don't use trace line 4. There are tons of trace lines sent out each second However, by briefly looking in the HLSDK, we can see that these three Trace_*'s are used: trace_line - guns trace_hull - melee trace_sphere - explosives However, all three types of weapons use trace_line. So, we will start with trace_line. Hooking trace_line with FM is a simple task; unfortunately, trace_line doesn't say what entity fired the trace_line, for speed. To get a place to start, we'll consider this: 1. The starting point for firing a weapon is the player who fired. 2. The end point for firing a weapon is where it hits. So, in theory, if we loop through the clients, comparing their origins and points of convergence for sight to the trace_line, we should come up with who fired! Lets make some code! Code:
public check_trace( Float:start[3], Float:end[3], monsters, skip_ent, TraceResult:ptr) Unfortunately, we hit a problem: The z origin is always different. Why? Because the gun is the one shooting, not the player. In order to keep with mod independence, we simply ignore the z origin. In addition, we need this: Code:
#define XS_FLEQ_TOLERANCE 5.0 As you might see, this is a little ineffecient. We could be losing a lot of speed, but at least it works, and always works. However, we can make it better. The gun must not shoot the player aiming it. That would be bad; you'd kill yourself. :D So, lets assume that skip_ent will be the id of the shooter: Code:
public check_trace( Float:start[3], Float:end[3], monsters, skip_ent, TraceResult:ptr) Since sending out a forward to other plugins is MUCH more expensive, speed wise, then doing a few math checks, we cna increase the speed of this function by adding back in some origin checking: Code:
public check_trace( Float:start[3], Float:end[3], monsters, skip_ent, TraceResult:ptr) Putting in the appropriate formatting, and add a few more bells and whistles, we have our plugin, which is uploaded below. Feel free to use this as much as you like. |
Good tut Urahara! Signing up on your forums now!
|
Ohayo! Nice Urahara. :up:
|
Urahara:
Tutorials are good thing but in this case you obviously missed main point. Traceline is a traceline and even such entity and origin checks will not tell us whether shot was fired or not. Traceline is an "universal tool" which engine uses for doing many things and to filter out shot event you have to do more complicated work than that (at least with that method). Also last player on the server (if it's connected) shouldn't be ignored in that code: skip_ent <= get_maxplayers() |
Quote:
Arigato for the last bit; i forgot about the final player, very very cruel of me poor last player :cry: i dont mean to disagree, however, there is no other application of trace_line which starts at a players origin and ends at the players aiming points besides the firing of a weapon-type trace_line. this method which i have created was tested to a significant degree and only occurs on firing of some sort of weapon; i do agree that simply checking the skip entity can render false positives, but by checking the origin, these are eliminated. while trace_line is traceline, as you stated, and it is a universal engine function, there is no other use for it under this context besides firing a weapon. this can be proved through statistical analysis as well as by looking through the SDK, as well as testing on mods; it is not used in this manner for anything other than checking for the paths of bullets thank you for your helpful reply though :D |
Quote:
You probably overlooked that trace_line is used for many things, for example, when game mod trying to determine whether entity/point visible to a player/monster or not. I don't think you fully understand what is trace_line and how it works (at least i think so because of what you posted here). Quote:
|
Re: Tutorial: Catching Weapons Fire in mod inspecific fashion
Out of curiosity, I didn't see a hook for the melee or explosive attack "types"...
I didn't think FM_Traceline would hook these, how would you do this to catch knife + grenades? |
Re: Tutorial: Catching Weapons Fire in mod inspecific fashion
Quote:
|
Re: Tutorial: Catching Weapons Fire in mod inspecific fashion
Quote:
I wanted to try to catch knife/grenade ? |
Re: Tutorial: Catching Weapons Fire in mod inspecific fashion
The thread's name is "Tutorial: Catching Weapons Fire in mod inspecific fashion".
Author have created this tutorial while working on aimbot detection. An aimbot is usually used with handguns/shotguns/(sub-)machine guns/rifles. When he wrote "fire" i think it's obviously that he mean only the weapons listed above and not knife/grenade. EDIT: while he mentioned explosives/melee it doesnt seems like he tried to detect explosives/melee attacks. |
All times are GMT -4. The time now is 10:59. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.