View Single Post
WATCH_D0GS UNITED
Senior Member
Join Date: Jan 2023
Old 04-04-2023 , 23:52   Re: [TUT] Properly Detect Weapon Shot (Every Shot)
Reply With Quote #9

Quote:
Originally Posted by SVC View Post
No problem, I like help when i can.
Also, can you tell me what is offset 220? I dont remember in this moment.
On the other hand:



Completely agree with you, always trying to keep the less CPU usage rather than RAM. But there are some things I can see using this way:

1) I can't test rigth now (maybe tomorrow, i hope), but reading a bit, can see that not only from weapons shots is called TraceLine but from other places/conditions.

2) In the above example (as you see, and other places), TraceLine will be called continually on each StatusBar update, and this is only for 1 player. Now imagine a 25+ players scenario ----> you will make an extra lot of checks unnecessary.

3) Honestly speaking of CPU usage, this din't use a 10~20% of all CPU using by engine-routine in just 1 frame. Of course, everyone programs like want.

4) I supposed the only thing that makes the "filter" to detect the shoot is the "220 offets" check (of course, with weaponid, but is not as many important than the first).

There is one bad thing, I forget to made in my code and it wast a pistol-check (since like how is coded, I'm almost sure if you keep +attack press with pistol it will do a fake shoot-detect).
Offset 220 = m_flLastFired

Just to make clear, FM_TraceLine is currently the forward used to refresh weapon shot id (m_flLastFired) in the shortest time period. It will be replaced if we find other way to refresh m_flLastFired id in an even short period of time.

Yeah, fake shots were a problem with any other methods we have used before this.

This shot detector does not get fake shots, as m_flLastFired id is only changed when the player really shoot when using weapons.

Last edited by WATCH_D0GS UNITED; 04-04-2023 at 23:56.
WATCH_D0GS UNITED is offline