• Entities and Self
    0 replies, posted
So I'm modifying a radio that was posted on the workshop to open a derma menu and the buttons in the menu are supposed to control the radios functions.. [code] -- Code from radio's init file net.Receive("radioon",function() local Mus = MUSIC[ math.random( 1, #MUSIC ) ] self.Sound = CreateSound(self.Entity, Mus.Snd ) self.Sound:Play() self.On = true; self.Play = true; self.Duration = CurTime() + PAUSE + Mus.Dur self.Musicon = CurTime() + Mus.Dur self.Debug = 0 end) net.Receive("radiooff",function() self.Sound:Stop() self.On = false; end) [/code] [code] -- Code from the cl_init file. Not as important but still a good help turnonbutt.DoClick = function() net.Start("radioon") net.SendToServer() end turnoffbutt.DoClick = function() net.Start("radiooff") net.SendToServer() end [/code] [code] -- the errors [ERROR] addons/uwrpradio/lua/entities/uwrpradio/init.lua:105: attempt to index global 'self' (a nil value) 1. func - addons/uwrpradio/lua/entities/uwrpradio/init.lua:105 2. unknown - lua/includes/extensions/net.lua:32 [ERROR] addons/uwrpradio/lua/entities/uwrpradio/init.lua:105: attempt to index global 'self' (a nil value) 1. func - addons/uwrpradio/lua/entities/uwrpradio/init.lua:105 2. unknown - lua/includes/extensions/net.lua:32 [/code] Is there another way for me to run the off and on functions? Maybe in the ENT.Use? It needs to be done with the buttons in the derma tho... EDIT: I'm just retarded.
Sorry, you need to Log In to post a reply to this thread.