I get this error when I type "sv_gravity 100" in my text box
Code:
[lua]local RconCmdPnl = vgui.Create( "DFrame" ) -- Creates the frame itself
RconCmdPnl:SetPos( 50,50 ) -- Position on the players screen
RconCmdPnl:SetSize( 300, 300) -- Size of the frame
RconCmdPnl:SetTitle( "Testing Derma Stuff" ) -- Title of the frame
RconCmdPnl:SetVisible( true )
RconCmdPnl:SetDraggable( true ) -- Draggable by mouse?
RconCmdPnl:ShowCloseButton( true ) -- Show the close button?
RconCmdPnl:MakePopup() -- Show the frame
RconCmd = vgui.Create("DTextEntry", RconCmdPnl)
RconCmd:SetPos( 5 , 50 )
RconCmd:SetSize( 250, 25 )
RconCmd:SetText("Enter rcon command here")
RconCmd.OnEnter = function()
RunConsoleCommand(tostring(RconCmd:GetValue()))
end [/lua]
[code]RunConsoleCommand: Command has invalid characters! (sv_gravity 100 (' '))
The first parameter of this function should contain only the command, the second parameter should contain arguments.[/code]
Thanks,
Justin
Its just what the function description says
You are trying to run
RunConsoleCommand("sv_gravity 100")
but what you have to instead run is
RunConsoleCommand("sv_gravity", "100")
Yeah, RunConsoleCommand requires you to separate the arguments to the concommand as separate arguments for the function. Instead, if you just want to run the string as a whole, you can do this:
[code]LocalPlayer():ConCommand( RconCmd:GetValue() )[/code]
Thank you dude
[editline]11:47PM[/editline]
Wait, if I had this in my Super Admin menu on my server it will on run on the player himself, I want it to run as the server, any help with that? Such as if you were to do - rcon say "Hello" in it remotely, I want it so you can enter for example, "say Hello" and it prints in the chat "Console: Hello" since it's run from the server. I want the command to be run from it, help, thx.
p.s. Use RunConsoleCommand on the client instead of concommand.
[lua]// On the client
local RconCmdPnl = vgui.Create( "DFrame" ) -- Creates the frame itself
RconCmdPnl:SetPos( 50,50 ) -- Position on the players screen
RconCmdPnl:SetSize( 300, 300) -- Size of the frame
RconCmdPnl:SetTitle( "Testing Derma Stuff" ) -- Title of the frame
RconCmdPnl:SetVisible( true )
RconCmdPnl:SetDraggable( true ) -- Draggable by mouse?
RconCmdPnl:ShowCloseButton( true ) -- Show the close button?
RconCmdPnl:MakePopup() -- Show the frame
RconCmd = vgui.Create("DTextEntry", RconCmdPnl)
RconCmd:SetPos( 5 , 50 )
RconCmd:SetSize( 250, 25 )
RconCmd:SetText("Enter rcon command here")
RconCmd.OnEnter = function()
RunConsoleCommand("myrcon" , table.concat(string.Explode(" " , tostring(RconCmd:GetValue())) , ","))
end
// Then on the server
concommand.Add("myrcon" , function(ply , cmd, args)
if !ply:IsSuperAdmin() then return end
game.ConsoleCommand(args[1].."\n")
end )[/lua]
Should work.
Well, this is the error I get
[code]
autorun/TextBox.lua:3: attempt to index global 'vgui' (a nil value)
[/code]
[QUOTE=Justin37111;18125672]Well, this is the error I get
[code]
autorun/TextBox.lua:3: attempt to index global 'vgui' (a nil value)
[/code][/QUOTE]
Because vgui doesn't exist server-side. You're running the client part on the server.
Then if I put this on the server then wtf? autorun/server? when it should be autorun/clientside for the derma but the concommand has to be within the that file located clientside, so wtf?
The part I commented as server code needs to be run on the server and client code on the client.
Yes, I know, but errr....how? It's all in the same file, or can I take the concommand and put it in autorun/server?
You can put it in autorun/ and put [lua]if ( SERVER ) then include("file.lua") end put code here[/lua]
And it will work for client, for security put [lua]if !ply:IsAdmin() then return end[/lua]
at the top of the code!
This is the code now
[lua]/*-------------------------------------------------------------------------------------------
Made by --D.A.R.K-- [url]http://www.187ciclan.com[/url] Super Administration Menu
Command Information:
1) Can use Rcon Commands through a Text Box
2) Telepor yourself to a player
3) Turn your Tag on and Off to show go undercover
More updates to come
--Rcon Commands Blocked--
"con_enable"
"sv_cheats",
"_restart",
"exec",
"condump",
"bind",
"BindToggle",
"alias",
"ent_fire",
"ent_setname",
"sensitivity",
"name",
"r_aspect",
"quit",
"exit",
"lua_run",
"lua_run_cl",
"lua_open",
"lua_cookieclear",
"lua_showerrors_cl",
"lua_showerrors_sv",
"lua_openscript",
"lua_openscript_cl",
"lua_redownload",
"sent_reload",
"sent_reload_cl",
"swep_reload",
"swep_reload_cl",
"gamemode_reload",
"gamemode_reload_cl",
"con_logfile",
"clear",
"rcon_password",
"test_RandomChance"
*/-------------------------------------------------------------------------------------------
if ( SERVER ) then
AddCSLuaFile("autorun/client/SuperAdminMenu.lua")
else
include("autorun/client/SuperAdminMenu.lua")
function OpenDerma(ply)
local RconCmdPnl = vgui.Create( "DFrame" )
RconCmdPnl:SetPos( 50,50 )
RconCmdPnl:SetSize( 300, 300)
RconCmdPnl:SetTitle( "RconBox" )
RconCmdPnl:SetVisible( true )
RconCmdPnl:SetDraggable( true )
RconCmdPnl:ShowCloseButton( true )
RconCmdPnl:MakePopup()
RconCmd = vgui.Create("DTextEntry", RconCmdPnl)
RconCmd:SetPos( 5 , 50 )
RconCmd:SetSize( 250, 25 )
RconCmd:SetText("<Command Here>")
RconCmd.OnEnter = function()
RunConsoleCommand("myrcon" , table.concat(string.Explode(" " , tostring(RconCmd:GetValue())) , ","))
end
end
concommand.Add("openrcontxt", OpenDerma)
end[/lua]
[lua] if ( SERVER ) then
AddCSLuaFile("autorun/server/myrcon.lua")
else
include("autorun/server/myrcon.lua")
concommand.Add("myrcon" , function(ply , cmd, args)
if !ply:IsSuperAdmin() then return end
game.ConsoleCommand(args[1].."\n")
end )
end [/lua]
[lua]if ( SERVER ) then
AddCSLuaFile("autorun/server/myrcon.lua")
concommand.Add("myrcon" , function(ply , cmd, args)
if !ply:IsSuperAdmin() then return end
game.ConsoleCommand(args[1].."\n")
end )
[/lua]
Just for later reference, doesnt sv_gravity only take decimals between 0 and 1?
[QUOTE=Jamie932;18172223]Just for later reference, doesnt sv_gravity only take decimals between 0 and 1?[/QUOTE]
No. Default value is 600. Negative values make you float, the higher it is, the stronger the force of gravity.
It must be some other command I am thinking of then. Sorry. ;(
Why must we revive old threads?
"old" is not one day ago. Learn more about Facepunch before telling us what we can and can't do >_<
Well, why don't you let me keep my opinion on old, this thread is done, dead. Simple as that. You think you always have a say in something. 1 day can be considered old, it's an opinion not a fact.
Now I don't mean to be rude, nor do I have anything against you, but don't be egoist Justin. This thread doesn't belong to you but to the community, it will stay here so people who have a similar problem can search it and find it. That someone could use it instead of having to create a new thread supports that purpose.
Unless things get extremely out of hand and the only solution is for a mod to delete it :wink:
Mods don't delete threads here :0
Yes, I like looking at threads and just seeing what they have inside, I looked through all 60 pages or how many there are now one day and just read all the threads to see what was inside just in case I ever ran into that problem. But Crazy Quebec is right.
Sorry, you need to Log In to post a reply to this thread.