• Problem with Weapon:GetActivity()
    2 replies, posted
Here is the part of code of my SWEP: [CODE] ... function SWEP:Reload() local act = self.Weapon:GetActivity() if act = ACT_VM_IDLE_LOWERED then return end self.Weapon:SendWeaponAnim(ACT_VM_IDLE_LOWERED) self.Idle = CurTime() + self.Owner:GetViewModel():SequenceDuration() end ...[/CODE] The idea of what I want to do is to make the Viewmodel play animation when weapon's owner press Reload button and not to play if this is already playing. However, when I press R, the "Something is creating script error" pop-ups and the animation isn't even playing. Here what I get in console: [CODE][ERROR] addons/csgo_knives_swep/lua/weapons/csgo_baseknife.lua:324: attempt to call method 'GetActivity' (a nil value) 1. unknown - addons/csgo_knives_swep/lua/weapons/csgo_baseknife.lua:324[/CODE] Hot to fix this?
[code]local getseq = self:GetSequence() local act = self:GetSequenceActivity(getseq) if act == ACT_VM_IDLE_LOWERED then return end self:SendWeaponAnim(ACT_VM_IDLE_LOWERED) self.Idle = CurTime() + self:SequenceDuration()[/code] Try this
[QUOTE=TheMostUpset;48551630][code]local getseq = self:GetSequence() local act = self:GetSequenceActivity(getseq) if act == ACT_VM_IDLE_LOWERED then return end self:SendWeaponAnim(ACT_VM_IDLE_LOWERED) self.Idle = CurTime() + self:SequenceDuration()[/code] Try this[/QUOTE] Thank you! It works now! :)
Sorry, you need to Log In to post a reply to this thread.