• Help me with "CalcMainActivity" please
    6 replies, posted
I have looked in the Gmod-Wiki but I didn't found anything useful about this hook. I just know that I can create animations with it but I don't know how to use it. Can someone show me an example for using it? I want to learn to use the hook to modify my lightsaber animations.
[url]https://facepunch.com/showthread.php?t=1415451[/url]
[QUOTE=code_gs;52131398][url]https://facepunch.com/showthread.php?t=1415451[/url][/QUOTE] I've already seen it and it didn't help me, because I want to have an special animation when I left click with a special weapon.
You might want to look into [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/DoAnimationEvent]GM:DoAnimationEvent[/url] and [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Player/DoAnimationEvent]Player:DoAnimationEvent[/url] for custom animations.
I've tried it but it seems to not work if it is a weapon animation :/
Can you post specific code?
[CODE] function SWEP:PrimaryAttack() if ( !IsValid( self.Owner ) ) then return end if ( !self.Owner:IsNPC() && self:GetEnabled() ) then self.Owner:DoAnimationEvent( 669 ) end self:SetNextAttack( 0.6 ) end hook.Add( "DoAnimationEvent" , "LightsaberAnimation" , function( ply , event , data ) if data == 669 then ply:AnimRestartGesture( GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_MELEE_ATTACK_SWING_GESTURE, true ) return ACT_INVALID end end ) [/CODE]
Sorry, you need to Log In to post a reply to this thread.