I've been having some problems on my server recently; we use a ranking system based on the number of hours a person has logged on the server. Ever since the last patch, if someone joins the server immediately after a restart and is spawned on the server when it becomes VAC enabled, they loose all of their recorded time.
In order to try to prevent this from happening, I wanted to write a script that would, after a delay, remove a password from the server (that would be used on startup) in order to prevent people from joining until it is safe.
Below is what I have written so far, but it is not working. Could you please help?
Thanks.
[code]
local function tempPass()
game.ConsoleCommand ('sv_password ""\n')
end
local function tempPassCreate()
timer.Create("password_temp", 30, 1, tempPass())
end
hook.Add("Initialize", "passhook", tempPassCreate())
[/code]
Remove () from tempPassCreate on the last line
[QUOTE=Disseminate;18648577]Remove () from tempPassCreate on the last line[/QUOTE]
And inside the timer too. :smile:
It should look like this :
[code]
local function tempPass()
game.ConsoleCommand ('sv_password ""\n')
end
local function tempPassCreate()
timer.Create("password_temp", 30, 1, tempPass)
end
hook.Add("Initialize", "passhook", tempPassCreate)
[/code]
That's because for the code tempPass is the function itself and tempPass() is what tempPass returns, in this case nil.
[lua]
local function tempPass()
timer.Create( "password_temp", 30, 1, function()
game.ConsoleCommand ('sv_password ""\n')
end )
end
hook.Add( "Initialize", "passhook", tempPass )
[/lua]
Optimized ftw.
Thanks for the suggestions, but nothing has worked yet; the password that I have set in the server.cfg file stays on the server.
[lua]
local function tempPass()
timer.Create( "password_temp", 30, 1, function()
game.ConsoleCommand ('sv_password', "")
end )
end
hook.Add( "Initialize", "passhook", tempPass )
[/lua]
Try that.
It's much easier if you use gmsv_gatekeeper. With that, you can just specify a variable time to let people in :v:
Sorry, you need to Log In to post a reply to this thread.