-- LUA Script - precede every function and global member with lowercase name of script + '_main' -- Switch to open door function doorswitch_init(e) Door_Switch = 0 SwitchActivated = 0 end function doorswitch_main(e) PlayerDist = GetPlayerDistance(e) if PlayerDist < 100 and g_PlayerHealth > 0 then if SwitchActivated == 0 then Prompt("Press E key to activate switch") if g_KeyPressE == 1 then Door_Switch = 1 PromptDuration("Doorswitch activated" ,3000) SwitchActivated = 1 end end end end