Advertisement
Slopeh

cy21

Dec 12th, 2023
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | Gaming | 0 0
  1. function toggleDoor() local P = Game.GetPlayer(); local msg = function(text) PreventionSystem.ShowMessage(text, 4.0) end local TSLO = Game.GetTargetingSystem():GetLookAtObject(P, false, false); if TSLO == nil then msg('LOOK AT THE DOOR FIRST\nDOOR NOT RECOGNIZED.') return else local Door = TSLO:ToString(); if Door == 'Door' then local DoorPS = TSLO:GetDevicePS(); local DoorProps = DoorPS.doorProperties; local DoorState = TSLO.isVisuallyOpened; if tostring(DoorProps.doorType.value) == 'AUTOMATIC' then DoorPS:SetCloseItself(true) end if DoorState then msg('OPEN DOOR DETECTED, CLOSING!"') TSLO:CloseDoor() else msg('CLOSED DOOR DETECTED, OPENING! \nIF IT IS STILL CLOSED USE THE COMMAND : \n"FORCE OPEN THE DOOR / FAKE DOOR"') TSLO:OpenDoor() DoorPS:ExecuteForceOpen(P) end elseif Door == 'FakeDoor' then msg('FAKE DOOR DETECTED, USE THE COMMAND\n"FORCE OPEN THE DOOR / FAKE DOOR"') elseif Door ~= 'Door' and Door ~= 'FakeDoor' then msg('LOOK AT THE DOOR FIRST\nDOOR NOT RECOGNIZED.') end end TSLO = nil; end toggleDoor()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement