Joined: 09 May 2003 Posts: 25785 Location: The netherlands
Posted: Sun Mar 31, 2019 3:58 am Post subject:
either use threads or a timer
timer:
Code:
...
if isKeyPressed(VK_PAD_B) then
--do stuff before pause
local t=createTimer()
t.Interval=4000
t.OnTimer=function(t)
--do stuff after pause
t.destroy()
end
end
thread:
Code:
keycheckthread=createThread(function(thr)
while thr.Terminated==false do
if isKeyPressed(VK_PAD_B) then
--do stuff before pause
sleep(4000)
--do stuff after pause
end
sleep(100) --don't eat up all cpu time
end
end)
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping
...
if isKeyPressed(VK_PAD_B) then
--do stuff before pause
local t=createTimer()
t.Interval=4000
t.OnTimer=function(t)
--do stuff after pause
t.destroy()
end
end
thread:
Code:
keycheckthread=createThread(function(thr)
while thr.Terminated==false do
if isKeyPressed(VK_PAD_B) then
--do stuff before pause
sleep(4000)
--do stuff after pause
end
sleep(100) --don't eat up all cpu time
end
end)
Eric I can't thank you enough for this ! This changes a lot of things and surely I will remember that timers can be created inside timers.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum