Advertisement
Guest User

kapu

a guest
Feb 8th, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.79 KB | None | 0 0
  1. local objGateg = createObject(17951,1287.9000000,-1006.1000000,31.1000000,0.0000000,0.0000000,90.0000000)
  2.  
  3. local objGateg2 = createObject(17951,1287.9000000,-966.4000200,34.8000000,0.0000000,0.0000000,90.0000000)
  4.  
  5. local open = false
  6. local open2 = false
  7.  
  8. -- Kapu
  9. function useGate(thePlayer)
  10.     local x, y, z = getElementPosition(thePlayer)
  11.     local distance = getDistanceBetweenPoints3D(1289.009765625, -1005.787109375, 30.876438140869, x, y, z) -- Pozíciót írd át
  12.     local distance2 = getDistanceBetweenPoints3D(1287.6708984375, -967.275390625, 34.430938720703, x, y, z) -- Pozíciót írd át
  13.     local factionid = getElementData(thePlayer, "faction")
  14.     if (factionid==123) then
  15.         if (distance<=10) and (open==false) then
  16.             open = true
  17.             outputChatBox("Garázs ajtó nyitva!", thePlayer, 0, 255, 0)
  18.             moveObject(objGateg, 1000, 1287.9000000,-1006.1000000,28.0000000, 0, 0, 0)  -- Pozíciót írd át
  19.             setTimer(close, 5000, 1, thePlayer)
  20.         elseif (distance2<=10) and (open2==false) then
  21.             open2 = true
  22.             outputChatBox("Garázs ajtó nyitva!", thePlayer, 0, 255, 0)
  23.             moveObject(objGateg2, 1000, 1287.9000000,-966.4000200,31.7000000, 0, 0, 0)  -- Pozíciót írd át
  24.             setTimer(close2, 5000, 1, thePlayer)
  25.         end
  26.     end
  27. end
  28. addCommandHandler("gate", useGate) -- Parancs amivel nyitod
  29.  
  30. function close(thePlayer)
  31.     setTimer(resetState, 1000, 1) -- Vissza csukási időzitő
  32.     moveObject(objGateg, 1000, 1287.9000000,-1006.1000000,31.1000000, 0, 0, 0) -- Pozíciót írd át
  33. end
  34.  
  35. function close2(thePlayer)
  36.     setTimer(resetState2, 1000, 1) -- Vissza csukási időzitő
  37.     moveObject(objGateg2, 1000, 1287.9000000,-966.4000200,34.8000000, 0, 0, 0) -- Pozíciót írd át
  38. end
  39.  
  40. function resetState()
  41.     open = true -- Vissza csukódjon
  42. end
  43.  
  44. function resetState2()
  45.     open2 = true -- Vissza csukódjon
  46. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement