Hi ich bins mal wieder.
Ich habe versucht ein eigenes kleines Vgui zu machen,dennoch leider ohne Erfolg.
Hier mein LuaScript:
Code:
function TestVGUI( )
local Frame = vgui.Create( "Frame" ); //Create a frame
Frame:SetSize( 200, 200 ); //Set the size to 200x200
Frame:SetPos( 100, 100 ); //Move the frame to 100,100
Frame:SetVisible( true ); //Visible
Frame:MakePopup( ); //Make the frame
Frame:PostMessage( "SetTitle", "text", "This is the title" ); //Set the title to "This is the title"
local Button = vgui.Create( "Button", Frame ); //Create a button that is attached to Frame
Button:SetText( "Click me!" ); //Set the button's text to "Click me!"
Button:SetPos( 30, 5 ); //Set the button's position relative to it's parent(Frame)
Button:SetWide( 100 ); //Sets the width of the button you're making
function Button:DoClick( ) //This is called when the button is clicked
self:SetText( "Clicked" ); //Set the text to "Clicked"
end
end
concommand.Add( "testvgui", TestVGUI );
Folgender Error erscheint:
autorun/TestVGUI.lua:2: attempt to index global 'vgui' (a nil value)
Ich habe die testgui.lua Datei unter C:\Programme\Steam\steamapps\joker44777\garrysmod\ garrysmod\lua\autorun gespeichert.
Meine Fragen:
Ich weis nicht ob sie unter Autorun gestartet werden kann.Es währe Nett wenn mir jemand sagen könnte wo ich die datei einfügen muss.