Hey Facepunch,
I seem to be having an issue getting Lua scripts to autorun on my server. For some reason, the following script simply refuses to run when the server first starts.
[CODE]if CLIENT then
concommand.Add("Donate",function(pl,cmd,args)
local window = vgui.Create("DFrame")
window:SetTitle("Donate")
window:MakePopup()
window:SetMouseInputEnabled(true)
window:SetSize(ScrW() - 20, ScrH() - 20)
window:Center()
window:ShowCloseButton( false )
local button = vgui.Create("DButton", window )
button:SetText( "CLOSE" )
button.DoClick = function() window:Close() end
button:SetSize( 100, 40 )
button:SetPos( (window:GetWide() - button:GetWide()) / 2, window:GetTall() - button:GetTall() - 10 )
local html = vgui.Create("DHTML", window)
html:SetPos(5,25)
html:SetSize( window:GetWide() - 20, window:GetTall() - button:GetTall() - 50 )
html:OpenURL("http://www.google.com")
end)
end
if SERVER then
hook.Add("PlayerSay", "ChatHook", function(Player, Text, Public)
if Text[1] == "!" then
Text = Text:lower()
if Text == "!donate" then
Player:ConCommand("Donate")
return ""
end
end
end)
end
hook.Add("OpenDonate", function(ply)
ply:ConCommand("Donate")
end)[/CODE]
What's odd is that I have another, almost identical script running that seems to start up flawlessly. Furthermore, if I re-upload the script to the server after the server has started running, the script will suddenly start working properly. I have tested this script in single player, and it starts just fine there. I have also tried using different scripts to achieve the same effect, however those too seem to fail. Is there some manner of limit to the number of scripts that can be started when the server is first booted? What's going on here?
Can't you set the "run_lua script" or whatever command it is to run an LUA script through the console in the autorun.cfg?
That's what I did with a few scripts I had and never had a problem with it.
You can just specify the LUA's or CFG's to run like so:
"lua_run Settings = {} Settings.MaxCollisionsPerObjectPerTimestep = 60000 physenv.SetPerformanceSettings(Settings)
lua_run Settings = {} Settings.MaxCollisionChecksPerTimestep = 60000 physenv.SetPerformanceSettings(Settings)"
That's a script for making mass physics less buggy a man on FP wrote up for himself and let me use it.
I'd assume "lua_run script_name_here" set in autorun.cfg or make a separate CFG with the appropriate commands for running your script, name it then add it in the autorun.cfg as "exec scripts.cfg".
That's assuming, so please correct me if I'm wrong or you mean something completely different.
Sorry, you need to Log In to post a reply to this thread.