• Having trouble with timers
    2 replies, posted
So I have been messing around with timers to try and run a mapvote in sandbox (cause I want the map to change every now and then) I am using [URL="https://facepunch.com/showthread.php?t=1268353"]willox's mapvote addon[/URL] Here is where things get messy. The code is ran from /lua/autorun/server/blah.lua when I run: [CODE]timer.Simple( 3600, MapVote.Start(30, true, gm_) )[/CODE] The server executes the vote on map load.. Wich causes a lot of rejoins and all that. I also tried running: [CODE]timer.Create( "mapvotestart1hour", 3600, 0, MapVote.Start(30, true, 9, "gm_") )[/CODE] Only to get the same results.. Can anybody help me with this ?
you need to create a function for the mapvote [LUA] timer.Simple( 3600, function() MapVote.Start(30, true, gm_) end ) --or timer.Create( "mapvotestart1hour", 3600, 0, function() MapVote.Start(30, true, 9, "gm_") end ) [/LUA]
[QUOTE=pssLuke;50911248]you need to create a function for the mapvote [LUA] timer.Simple( 3600, function() MapVote.Start(30, true, gm_) end ) --or timer.Create( "mapvotestart1hour", 3600, 0, function() MapVote.Start(30, true, 9, "gm_") end ) [/LUA][/QUOTE] Going to try it in a bit :) [editline]18th August 2016[/editline] This actually worked! thanks Luke :)
Sorry, you need to Log In to post a reply to this thread.