Console command question...

Greetings! so I’ll be a little bit direct if you don’t mind. I’m learning about weapon animations and with the knowledge I actually have I believe I’ll be able to create ‘magazine check’ one easily. My plan is to bind a key with some in-game command which would execute specific animation, but my problem is that I don’t know what command is that. Any experienced coder that could tell to me a console command that can execute SWEP animations directly in-game, please?
Thanks for your attention and hoping for a soon answer. Cheers!

Weapon:SendWeaponAnim Perhaps?

Your help is extremely appreciated, but that isn’t working for me sadly. Tried with ‘Weapon:SendWeaponAnim(ACT_VM_RELOAD)’ plus other several stuff but nothing happens.

Um, what you are trying to do requires:
An animation on the model
The Lua code to be in the weapon code

SWEP is completely created and of course has all basic animations between other stuff, I’ve already been playing with it. What specific Lua code are you talking about by the way?

The one posted above, assuming you know how to use that function.

I can’t understand, I’m sorry. My concept of what I gotta do is extremely abstract still. Maybe you mean typing somewhere on my SWEP code ‘Weapon:SendWeaponAnim(ACT_VM_AMMOCHECK)’? (if new sequence would be called like that on model). And then what? it makes no sense at all to me.

Are you literally calling Weapon:SendWeaponAnim() or do you actually have a weapon object?
If you don’t have a weapon object, you can use self inside a swep function (that has a self argument!), or use something like
[lua]
for k,v in pairs(player.GetAll()) do
local wep = v:GetActiveWeapon()
– code
end
[/lua]

Now I’m even more confused. Look, nevermind, I definitely surrender with this project. Thanks for your attention.

Don’t give up :smile:

Animations can be tricky / annoying. Take a look at this ( handles 3rd person gestures in a hopefully easy to understand way [ custom networking, ignore it but it should be easy enough to see what it is doing ] ); it basically broadcasts to everyone on the server telling them which animation to play on which player, then starts it as a gesture ( which is an animation that can be played while other animations are going as gestures modify body language ): https://dl.dropboxusercontent.com/u/26074909/tutoring/forum_posts/animations.lua

Also, take a look at garrysmod/gamemodes/base/gamemode/animations.lua – That file controls the major aspects of animation for different aspects of movement, etc…

Unfortunately I don’t have any other examples, but hopefully this helps you get on the right track. Definitely look up on the wiki the functions…