Hi 3com,
I tested this script but the script is working till the timer, I can open the door but the timer is not working, the DoorTimerSwitch is the action to let open and close the door. Thanks.
local timer = {}
function timerswitch_init(e
TimeSwitchActivated = 0
DoorTimerSwitch = 0
timer[e] = 0
end
function timerswitch_main(e)
PlayerDist = GetPlayerDistance(e)
if PlayerDist < 100 and g_PlayerHealth > 0 then
if TimeSwitchActivated == 0 then
Prompt("Press E key to activate switch")
if g_KeyPressE == 1 then
timer[e] = os.time()
DoorTimerSwitch = 1
PromptDuration("Doorswitch activated" ,3000)
TimeSwitchActivated = 1
end
end
(not working)
if DoorTimerSwitch == 1 then
if os.time() > timer[e] + 1000 then -- increase/decrease this value to fit yours needs
PromptDuration("os.time1: " ..os.time() .." - timer1[e]: " ..timer[e],3000)
DoorTimerSwitch = 0
end
end
end
end