Pivity

I cant even make a simple script

Last read Never
#1

Ok so I have been working on a simple derma menu for 3 days! And I havnt got it working at all. I want to know if anyone is able to help someone that likes hands on stuff and needs examples. Like a mentor or something. Thank you.

Here is the code

local window
window = vgui.Create( "DFrame" )
window:SetTitle( "Choose A Faction!" )
window:SetSize( 300, 300 )
window:Center()
window:SetVisible( true )
window:ShowCloseButton( true )
window:SetDraggable( true )
window:MakePopup()
window.Paint = function( self, w, h )
draw.RoundedBox( 0, 0, 0, w, h, Color( 0, 0, 0, 255 ) )
end

DermaImageButton = vgui.Create( "DImageButton", window )
DermaImageButton:SetPos( 50, 52 )
DermaImageButton:SetSize( 200, 50 )
DermaImageButton:SetImage( "materials/us_icon.png" )
DermaImageButton:GetStretchToFit()
DermaImageButton.DoClick = function()
RunConsoleCommand ( "say", "/usrecruit" )
end

DermaImageButton = vgui.Create( "DImageButton", window )
DermaImageButton:SetPos( 50, 113 )
DermaImageButton:SetSize( 200, 50 )
DermaImageButton:SetImage( "materials/ru_icon.png" )
DermaImageButton:GetStretchToFit()
DermaImageButton.DoClick = function()
RunConsoleCommand ( "say", "/rurecruit" )
end

DermaImageButton = vgui.Create( "DImageButton", window )
DermaImageButton:SetPos( 50, 173 )
DermaImageButton:SetSize( 200, 50 )
DermaImageButton:SetImage( "materials/uk_icon.png" )
DermaImageButton:GetStretchToFit()
DermaImageButton.DoClick = function()
RunConsoleCommand ( "say", "/ukrecruit" )
end

local Button

hook.Add( "PlayerSay", "PlayerSayExample", function( ply, text, team )
if ( string.sub( text, 1, 4 ) == "/darkrp" ) then
Button = vgui.Create( "DButton" )
Button:Center
button:MakePopup()
Button:SetSize( 200, 50 )
Button:SetText( "Join Our DarkRP" )
button:SetConsoleCommand( "connect", "IP" )
end
end

But it dosnt work

#2

You know, you must run the code clientside? (Lua/Autorun/client) Are there any console errors?

#3
ByMomoxat 12th of December 2016 13:14:00
You know, you must run the code clientside?(Lua/Autorun/client)Are there any console errors?I think? Something about vgui not being a global something. I will check after school
#4

What exactly do you want to achieve?

#5
BySnowa™at 12th of December 2016 15:38:24
I think? Something about vgui not being a global something. I will check after school

Then send us the exact error and I'll tell you what's the cause of it.

#6
ByMunchat 12th of December 2016 17:27:00
What exactly do you want to achieve?

I really like derma stuff. Mostly because I am a graphic designer. So I would like to know what to do, and what not to do in derma. By the time I know about that I will be able to do more stuff(well I hope).

Edited

ByMomoxat 12th of December 2016 18:22:32
Then send us the exact error and I'll tell you what's the cause of it.

Also where would I put shared.lua at?

Edited

ByMomoxat 12th of December 2016 18:22:32
Then send us the exact error and I'll tell you what's the cause of it.

Here is the error.

[ERROR] addons/job picker/lua/autorun/client/cl_jobpicker.lua:4: attempt to index local 'window' (a nil value)

1. unknown - addons/job picker/lua/autorun/client/cl_jobpicker.lua:4

#7

There's like 5-6 errors within that small piece of code. I didn't fix it, I commented stuff out for you to fix: http://hastebin.com/omajatoyav.php - Also scriptfodder isn't really the place to ask for help, you'll get much faster response at facepunch or something

Users viewing this thread
Nobody