My error is:
[ERROR] lua/tttmenu_new.lua:3: attempt to call global 'LocalPlayer' (a nil value)
1. unknown - lua/tttmenu_new.lua:3
2. unknown - lua/includes/modules/concommand.lua:69
My code is [CODE]function TTTMenu()
local ply = LocalPlayer()
local DPanel = vgui.Create( "DFrame" )
DPanel:SetPos( 10, 30 )
DPanel:SetSize( 200, 200 )
DPanel:SetTitle( "TTT Admin Menu Alpha!" )
DPanel:SetVisible( true )
DPanel:SetDraggable( true )
DPanel:ShowCloseButton( true )
DPanel:MakePopup()
local DComboBox = vgui.Create( "DComboBox", DPanel )
local selected
DComboBox:SetPos( 5, 5 )
DComboBox:SetSize( 100, 20 )
DComboBox:SetValue( "options" )
DComboBox:AddChoice( "Say" )
DComboBox:AddChoice( "Kill" )
DComboBox:AddChoice( "option C" )
DComboBox.OnSelect = function( panel, index, value )
selected = value
print( value .." was selected!" )
local commands = {
"say hi",
"kill",
"kill"
}
local DButton = vgui.Create( "DButton", DPanel )
DButton:SetSize( 160, 40 )
DButton:SetText( "test" )
DButton:SetPos( 20, 30 )
DButton.DoClick = function()
RunConsoleCommand(commands[selected])
end
end
end
concommand.Add( "tttadmin", TTTMenu)
[/CODE]
You are probably calling this serverside instead of clientside, which doesnt work.
You aren't even using ply? And remember that this has to go clientside, and not serverside!
I'd refrain from making admin-related stuff if you're inexperienced. It would be easy to make a mistake that would cost you your server's security's integrity.
[QUOTE=Blackfire76;46449096]You are probably calling this serverside instead of clientside, which doesnt work.[/QUOTE]
How would I call it clientside, I don't have the luascript on the server
[QUOTE=Author.;46449112]You aren't even using ply? And remember that this has to go clientside, and not serverside![/QUOTE]
The code is unfinished, put I'm probably going to remove that line
[QUOTE=>>oubliette<<;46449189]I'd refrain from making admin-related stuff if you're inexperienced. It would be easy to make a mistake that would cost you your server's security's integrity.[/QUOTE]
I'm not going to be doing this on a public server
This is a client script ran from your own client? Then run it as lua_openscript_cl and not lua_openscript
I was always wondering the difference with lua_openscript_cl and lua_openscript, thanks!
No problem, the _cl stands for client. Basically anything you run from your client gets executed with that. lua_openscript is more for servers to be executed from the live console
[B]Nobody told him about sv_allowcslua.[/B] Might want to turn that off if you're on a dedi.
Sorry, you need to Log In to post a reply to this thread.