I've been trying to figure out why my SWEP has been creating errors whenever I holster it. It says its a nil value but it still does what it's supposed to do? Please help, am stumped.
Error:
[ERROR] lua/weapons/laser smg - copy/shared.lua:83: attempt to index global 'barrel' (a nil value)
1. unknown - lua/weapons/laser smg - copy/shared.lua:83
Pastebin link: [url]http://pastebin.com/xe4XDCMK[/url]
Try using self.barrel instead. Also you should put
[lua]
if !IsValid(self.barrel) then return end
[/lua]
In order to avoid further errors.
[QUOTE=buu342;46856972]Try using self.barrel instead. Also you should put
[lua]
if !IsValid(self.barrel) then return end
[/lua]
In order to avoid further errors.[/QUOTE]
Should I put that in the timer function or the holster function? Putting it in the holster function makes it unable to be holstered
barrel is created inside the primary fire function if and only if the server is running it, of course the client is going to have problems when trying to index that table in the holster function.
Sorry, you need to Log In to post a reply to this thread.