Detect if player is reloading

How can I tell if a player is reloading? The only way I can think of is with ply:KeyDownLast(), but that doesn’t work with automatic reloads (when the clip runs out).

Also, why is there no hook for this? Same thing should go with attack1 and attack2 :S (Though there might be clientside hooks for those, didn’t check)

The hook is here http://wiki.garrysmod.com/?title=SWEP.Reload and more here http://wiki.garrysmod.com/?title=Weapon_Hooks

Well yes, that would be the case if I was making a SWEP, but I’m running a normal serverside script (not sure what they’re supposed to be called) so I need a Gamemode hook. Or is it possible to use SWEP hooks from outside the SWEP script?

I am not sure so I’ll give you my best guess; You could hook **[Gamemode.DoAnimationEvent

http://wiki.garrysmod.com/favicon.ico](wiki.garrysmod.com/?title=Gamemode.DoAnimationEvent)** and check the current event.

[lua]
local function MyFunc(pl, event, data)
if event == PLAYERANIMEVENT_RELOAD then
– do something
end
end
hook.Add(“DoAnimationEvent”, “CheckPlayerReload”, MyFunc)
[/lua]

Yes, that worked :smiley: And it’s only called once for each reload, so it’s perfect. Thanks!