• Gmod Steam addon
    5 replies, posted
hi there i have an error with a steam addon i downloaded and its over 4 years old Heres the error [ERROR] lua/weapons/swep_smokenade/shared.lua:31: bad argument #1 to 'SetAnimation' (number expected, got nil) 1. SetAnimation - [C]:-1 2. unknown - lua/weapons/swep_smokenade/shared.lua:31 its suppose to be a smoke gernade but has lost the abilty due to the error can someone repair it for me if you want i can give a small amount of money for it
go on gmodstore for a paid job.
If you post the code of that file here on this thread I will try my best to help with the issue but i'm not downloading that zip
SWEP.Author = "Team Half-Life" SWEP.Contact = "Don't" SWEP.Purpose = "Covers area in a thick layer of smoke." SWEP.Instructions = "Left-Click: Throw grenade" SWEP.Spawnable = true SWEP.AdminSpawnable = true SWEP.ViewModel = "models/weapons/v_grenade.mdl" SWEP.WorldModel = "models/weapons/w_grenade.mdl" SWEP.HoldType = "grenade" SWEP.Primary.Automatic = false SWEP.Primary.ClipSize = -1 SWEP.Primary.DefaultClip = -1 SWEP.Primary.Ammo = "none" SWEP.Secondary.ClipSize = -1 SWEP.Secondary.DefaultClip = -1 SWEP.Secondary.Automatic = false SWEP.Secondary.Ammo = "none" function SWEP:Precache() util.PrecacheModel("models/dav0r/hoverball.mdl") util.PrecacheSound("weapons/ar2/ar2_reload_rotate.wav") end //PRIMARY FIRE function SWEP:PrimaryAttack() self.Weapon:SetNextPrimaryFire( CurTime() + 1.21 ) self.Weapon:SendWeaponAnim( ACT_VM_SECONDARYATTACK ) self.Owner:SetAnimation( PLAYER_ATTACK2 ) if (SERVER) then timer.Simple(0.157, function() if self:IsValid() then self:ThrowHigh() end end) end end //SECONDARY FIRE function SWEP:SecondaryAttack() end //RELOAD - Switching Modes function SWEP:Reload() end //Play a nice sound on deploying function SWEP:Deploy() self.Weapon:SendWeaponAnim(ACT_VM_SECONDARYATTACK) return true end function SWEP:Think() end function SWEP:ThrowHigh() if (SERVER) then local ply = self.Owner local grenadeobj = ents.Create("sent_smokenade") grenadeobj:SetPos(ply:GetShootPos() + Vector(0,0,-9.2)) grenadeobj:SetAngles(ply:GetAimVector()) grenadeobj:SetPhysicsAttacker(self.Owner) grenadeobj:SetOwner(self.Owner) grenadeobj:Spawn() local Phys = grenadeobj:GetPhysicsObject() local Force = ply:GetAimVector() * math.random(4620,4820) + Vector(0, 0, math.random(100,120)) Phys:ApplyForceCenter(Force) self.Owner:EmitSound( "weapons/ar2/ar2_reload_rotate.wav", 40, 100 ) end end @BlueBear
I made a quick fix of the addon, it is quiet old, because at some function the enums are no longer existing: https://www.youtube.com/watch?v=P5PB8JaInhU&feature=youtu.be
Change self.Owner:SetAnimation( PLAYER_ATTACK2 ) to self.Owner:SetAnimation( PLAYER_ATTACK1 ) The PLAYER_ATTACK2 Enum has long been depreciated I believe and completely removed according to the wiki PLAYER Enumerations
Sorry, you need to Log In to post a reply to this thread.