here's how I approach the timer limitation.... I simply made my own
tbl_timer = {}
function GlobalTimerStart(Timer)
tbl_timer[Timer]=g_Time
end
function GlobalTimerGet(Timer)
return math.abs(tbl_timer[Timer]-g_Time)
end
tbl_etimer={}
function EntityTimerStart(e, Timer)
tbl_etimer[Timer]={}
tbl_etimer[Timer][e]=g_Time
end
function EntityTimerGet(e, Timer)
return math.abs(tbl_etimer[Timer][e]-g_Time)
end
so with the above functions you can have multiple global timers and multiple entity timers, usage example below
-- example usage
function timer_test_init(e)
-- start timers
GlobalTimerStart(1)
GlobalTimerStart(2)
GlobalTimerStart(3)
EntityTimerStart(e,1)
EntityTimerStart(e,2)
EntityTimerStart(e,3)
end
function timer_test_main(e)
-- Global Timers
-- reset every 5 seconds
if GlobalTimerGet(1)>=5000 then
GlobalTimerStart(1)
end
-- reset every 10 seconds
if GlobalTimerGet(2)>=10000 then
GlobalTimerStart(2)
end
-- reset every 15 seconds
if GlobalTimerGet(3)>=15000 then
GlobalTimerStart(3)
end
Text(1, 1, 1, "Global Timer 1: " .. tostring(GlobalTimerGet(1)))
Text(1, 5, 1, "Global Timer 2: " .. tostring(GlobalTimerGet(2)))
Text(1, 9, 1, "Global Timer 3: " .. tostring(GlobalTimerGet(3)))
-- Entity Timers
-- reset every 5 seconds
if EntityTimerGet(e, 1)>=5000 then
EntityTimerStart(e, 1)
end
-- reset every 10 seconds
if EntityTimerGet(e, 2)>=10000 then
EntityTimerStart(e, 2)
end
-- reset every 15 seconds
if EntityTimerGet(e, 3)>=15000 then
EntityTimerStart(e, 3)
end
Text(1, 13, 1, "Entity Timer 1: " .. tostring(EntityTimerGet(e,1)))
Text(1, 16, 1, "Entity Timer 2: " .. tostring(EntityTimerGet(e,2)))
Text(1, 20, 1, "Entity Timer 3: " .. tostring(EntityTimerGet(e,3)))
end