• Timer.simple Error
    2 replies, posted
[CODE] function SWEP:Reload() if ( self.Weapon:Clip1() <= 29 ) then self.Weapon:DefaultReload( ACT_VM_RELOAD ) timer.Simple(0.0, function() self.Weapon:EmitSound( "weapons/kage_groza/cloth.wav" ) end) timer.Simple(0.6, function() self.Weapon:EmitSound( "weapons/kage_groza/magout.wav" ) end) timer.Simple(1.6, function() self.Weapon:EmitSound( "weapons/kage_groza/magin.wav" ) end) timer.Simple(2.2, function() self.Weapon:EmitSound( "weapons/kage_groza/boltback.wav" ) end) timer.Simple(2.3, function() self.Weapon:EmitSound( "weapons/kage_groza/boltforward.wav" ) end) end end [/CODE] [ERROR] addons/ghost_groza/lua/weapons/groza/shared.lua:25: attempt to index field 'Weapon' (a nil value) 1. unknown - addons/ghost_groza/lua/weapons/groza/shared.lua:25 Timer Failed! [Simple][@addons/ghost_groza/lua/weapons/groza/shared.lua (line 25)] [ERROR] addons/ghost_groza/lua/weapons/groza/shared.lua:26: attempt to index field 'Weapon' (a nil value) 1. unknown - addons/ghost_groza/lua/weapons/groza/shared.lua:26 Timer Failed! [Simple][@addons/ghost_groza/lua/weapons/groza/shared.lua (line 26)] [ERROR] addons/ghost_groza/lua/weapons/groza/shared.lua:27: attempt to index field 'Weapon' (a nil value) 1. unknown - addons/ghost_groza/lua/weapons/groza/shared.lua:27 Timer Failed! [Simple][@addons/ghost_groza/lua/weapons/groza/shared.lua (line 27)] --This error occurs when you die reloading, any suggestion on how I can get rid of this?
Do a IsValid check on self.Weapon in every timer. It's cuz someone reloads and then drops the weapon/gets killed before all timers are run
[QUOTE=Klaes4Zaugen;51004354]Do a IsValid check on self.Weapon in every timer. It's cuz someone reloads and then drops the weapon/gets killed before all timers are run[/QUOTE] thx bb
Sorry, you need to Log In to post a reply to this thread.