• LUA script that triggers on mp_timelimit
    5 replies, posted
Hello everyone, I'm trying to code a script that would check the convar "mp_timelimit" and if <= 0 would run a console command. Problem is, I can't find a hook for that. Does anyone know how would I do that ? Cheers
You could just set up a 10 or 5 second timer or whatever and do it in there.
Hi, thanks for the answer. Yes that would work, but since I'd like the script to get "mp_timelimit" so that I don't have to hardcode a different timer if I want to change...
What? If you want to get the mp_timelimit's value, just do so? GetConVarNumber
That didn't work. I tried doing your way :   for k,v in pairs( player.GetAll() ) do       timer.Simple(15, function()      v:Lock() end ) timer.Simple(16, function() v:ConCommand("+showscores")  end)     timer.Simple(18, function() v:ConCommand("-showscores")  end) The only issue I have now is that even though it's in the autorun folder, it doesn't run until I manually do so. Any idea?
Go watch some tutorials before you start messing with Lua. It will be much easier once you understand what you are doing. You can even just start reading your code line by line referencing the wiki to understand why it "didn't work". The code you wrote doesn't do what you wanted to do.
Sorry, you need to Log In to post a reply to this thread.