• No errors but does not want to work/open derma panel
    3 replies, posted
So I am creating an addon, and I have to files in /lua/autorun/server. One is init and the other is cl_init only reason I have cl_init in there is because AddCSLuaFile cant find the file if not in same dir. So when I put it in there it gives no errors, but when I try to run the code it does nothing. Any help is appreciated. [code] -- init.lua AddCSLuaFile( "cl_init.lua" ) hook.Add( "InitPostEntity", "create_jbox", function() local box = ents.Create( "prop_dynamic" ) box:SetSolid( SOLID_BBOX ) box:SetModel( "models/bonkaddict/apb/jokerammo/ammovendingmachine.mdl" ) box:Spawn() box:SetPos( Vector(4066.561523, -3812.723877, 242.788712) ) end ) --------------------------------------------------------------------------------------------------------- 2 different files mark -- cl_init.lua hook.Add( "PlayerUse", "create_derma_menu", function( ply, ent ) if ent:GetModel() == "models/bonkaddict/apb/jokerammo/ammovendingmachine.mdl" then local DFrame1 = vgui.Create("DFrame") DFrame1:SetSize(300, 150) DFrame1:SetPos(5, 5) DFrame1:Center() DFrame1:SetTitle("Test") DFrame1:ShowCloseButton(true) DFrame1:SetSizable(false) DFrame1:SetDeleteOnClose(true) DFrame1:MakePopup() end end ) [/code] If anyone could help me out that would be great.
Don't put clientside files in lua/autorun/server, put them in lua/autorun/client. Give them more unique names, too. PlayerUse is a serverside hook, not shared, and you never included your script, so that's why your script isn't working.
[QUOTE=sannys;51158394]Don't put clientside files in lua/autorun/server, put them in lua/autorun/client. Give them more unique names, too. PlayerUse is a serverside hook, not shared, and you never included your script, so that's why your script isn't working.[/QUOTE] So include() not addcslua?
yes; and network the button press.
Sorry, you need to Log In to post a reply to this thread.