This plugin is using the pre-alpha
DHooks extension to hook Weapon_ShootPosition. It is required for runtime and compilation.
Weapon_ShootPosition get's called everytime a player fires a shot (and has ammo for it etc).
Since TF2 is missing a proper way to detect firing with TF2_CalcIsCritical requiring
tf_weapon_criticals to be
1 and
+ATTACK hooks fire even if the player has no weapons and therefore require lots of validity checks, hooking ShootPosition is probably one of the easier ways.
This plugin simply provides a forward whenever a client shoots a weapon.
Example Code:
PHP Code:
#include <sourcemod>
#include <tweaponshootposition>
public OnClientWeaponShootPosition(client, Float:position[3]) {
PrintToServer("%N is firing his weapon at %.2f %.2f %.2f", client, position[0], position[1], position[2]);
}
Feel free to strip this plugin of it's forwarding stuff and use the code directly in your plugin if you're feeling more comfortable with it.