• Derma won't pop up
    6 replies, posted
When I press F4 Like I set it the derma won't pop up Path I put the lua files into C:\Program Files (x86)\Steam\SteamApps\common\GarrysMod\garrysmod\addons\Derma Test\lua\autorun\client Error when I get on Garrys mod [ERROR] addons/derma test/lua/autorun/client/init.lua:1: attempt to index global 'GM' (a nil value) 1. unknown - addons/derma test/lua/autorun/client/init.lua:1 The two luas I made cl_init.lua [CODE]function DermaTest() local base = vgui.Create( "DFrame" ) local butt = vgui.Create( "DButton" ) base:SetPos( ScrW()/2 - 225, ScrH()/2 - 100 ) base:SetSize( 450, 200 ) base:SetVisible( true ) base:SetTitle( "Stab Chaze" ) base:SetDraggable( false ) base:ShowCloseButton( true ) base:MakePopup() butt:SetParent( base ) butt:SetText( "Kill" ) butt:Center() butt:SetSize( 150, 50 ) butt.DoClick = function() RunConsoleCommand( "kill" ) end end usermessage.Hook( "Openpls", DermaTest )[/CODE] init.lua [CODE]function GM:ShowSpare2( ply ) umsg.Start( "Openpls", ply ) umsg.End() end [/CODE]
GM is for when you're making a gamemode. If you want to make it an addon, use hook.add.
It still doesn't work, I get a new error in my console - [ERROR] addons/derma test/lua/autorun/client/init.lua:1: attempt to index field 'add' (a nil value) 1. unknown - addons/derma test/lua/autorun/client/init.lua:1 New code for init.lua [CODE]function hook.add:ShowSpare2( ply ) umsg.Start( "Openpls", ply ) umsg.End() end[/CODE]
That's not how you use hook.Add
[QUOTE=Chessnut;42332119]That's not how you use hook.Add[/QUOTE] Could you help me use it properly?
This is how hook.Add should be used. [url]http://wiki.garrysmod.com/page/hook/Add[/url]
I told you you were doing your hooks wrong Dalapeno. :c
Sorry, you need to Log In to post a reply to this thread.