I tried:
code code:
local targetTime = 0
local wtime = 0
num = 0
local function idontcare()
if (num == 0) then
num=1
run_cmd("set reactiontime " .. 100)
run_cmd("pause")
run_cmd("minbet 100")
run_cmd("cp bet bet bet!")
targetTime = tonumber(os.date("%I%M%S")) + 30 --time in seconds
add_hook("draw2d", "sleep", sleep)
end
end
local function sleep()
if tonumber(os.date("%I%M%S")) >= targetTime then
remove_hook("draw2d", "sleep")
closebetting()
end
end
local function closeBetting()
run_cmd("minbet 1000000")
run_cmd("cp betting closed!")
run_cmd("pause")
run_cmd("set reactiontime" .. 15)
end
local function set_num()
num=0
end
add_hook("end_game", "set to 0", set_num)
add_hook("new_game", "set to 1", idontcare)
add_hook("leave_game", "set to 0", set_num)
but with hooks my timer can't really work. Well it works but I can't use it as a function and it becomes useless
EDIT: no wait..draw2d hook is not triggering. When is it triggered?
Hmm...it seems that draw2d is triggered only once at the start of the script. Why?
Last edited by dainiusb; Mar 21, 2014 at 08:26 PM.