[
Note: i recommend to use this method only for tests/research purpose because this method may produce some false positives when there are a big amount of lags.]
Most of a "shot/bullet/shell/fire/trace/particle/projectile/etc" plugin authors instead of fired particle trace vector is use player's aim vector. FYI: the angle difference between such vectors may reach even more than 30 degrees [!] because of the fired particle spreading/gun recoil. The correct method would be to perform a TraceLine hook, filter out fired particle trace and retrieve it's vector.
You have to note that some guns:
- are powerful and it's bullet may sequentialy create 2nd and even 3nd trace for 1st and 2nd collision with the world/brush/entity/player obstacle
- support burst-fire mode, so every attack action is performed a multiple shots with a little shots delay, every shot is spread a single bullet
- support shotgun spread fire, so every attack action is performed a single shot that is spread a multiple particles
Let's review the script that will show how to:
- filter out fired particle trace
- distinguish a fired particle type: bullet or shotgun shot particle
- calculate the current shotgun shot particle number for the current shot
- detect whether the fired particle is hit a world/brush or entity/player
- get the current actual vector of the fired particle