Advertisement
Guest User

Untitled

a guest
Dec 12th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.19 KB | None | 0 0
  1. ------------------------
  2. -- Prison Teleporter
  3. ------------------------
  4.  
  5. local TeleportFromTo = {
  6.     ["Sandy Station"] = {
  7.         positionFrom = { ['x'] = 1851.12, ['y'] = 3683.30, ['z'] = 34.32, nom = "enter the holding cells"},
  8.         positionTo = { ['x'] = 1849.465, ['y'] = 3682.871, ['z'] = -118.76, nom = "exit the holding cells"},
  9.     },
  10.    
  11.     ["Paleto Station"] = {
  12.         positionFrom = { ['x'] = -442.352, ['y'] = 6012.365, ['z'] = 31.76, nom = "enter the holding cells"},
  13.         positionTo = { ['x'] = -441.880, ['y'] = 6010.498, ['z'] = -118.761 , nom = "exit the holding cells"},
  14.     },
  15. }
  16.  
  17. Drawing = setmetatable({}, Drawing)
  18. Drawing.__index = Drawing
  19.  
  20.  
  21. function Drawing.draw3DText(x,y,z,textInput,fontId,scaleX,scaleY,r, g, b, a)
  22.     local px,py,pz=table.unpack(GetGameplayCamCoords())
  23.     local dist = GetDistanceBetweenCoords(px,py,pz, x,y,z, 1)
  24.  
  25.     local scale = (1/dist)*20
  26.     local fov = (1/GetGameplayCamFov())*100
  27.     local scale = scale*fov
  28.  
  29.     SetTextScale(scaleX*scale, scaleY*scale)
  30.     SetTextFont(fontId)
  31.     SetTextProportional(1)
  32.     SetTextColour(r, g, b, a)
  33.     SetTextDropshadow(0, 0, 0, 0, 255)
  34.     SetTextEdge(2, 0, 0, 0, 150)
  35.     SetTextDropShadow()
  36.     SetTextOutline()
  37.     SetTextEntry("STRING")
  38.     SetTextCentre(1)
  39.     AddTextComponentString(textInput)
  40.     SetDrawOrigin(x,y,z+2, 0)
  41.     DrawText(0.0, 0.0)
  42.     ClearDrawOrigin()
  43. end
  44.  
  45. function Drawing.drawMissionText(m_text, showtime)
  46.     ClearPrints()
  47.     SetTextEntry_2("STRING")
  48.     AddTextComponentString(m_text)
  49.     DrawSubtitleTimed(showtime, 1)
  50. end
  51.  
  52. function msginf(msg, duree)
  53.     duree = duree or 500
  54.     ClearPrints()
  55.     SetTextEntry_2("STRING")
  56.     AddTextComponentString(msg)
  57.     DrawSubtitleTimed(duree, 1)
  58. end
  59.  
  60. Citizen.CreateThread(function()
  61.     while true do
  62.         Citizen.Wait(2)
  63.         local pos = GetEntityCoords(GetPlayerPed(-1), true)
  64.  
  65.         for k, j in pairs(TeleportFromTo) do
  66.  
  67.             --msginf(k .. " " .. tostring(j.positionFrom.x), 15000)
  68.             if(Vdist(pos.x, pos.y, pos.z, j.positionFrom.x, j.positionFrom.y, j.positionFrom.z) < 150.0)then
  69.                 DrawMarker(1, j.positionFrom.x, j.positionFrom.y, j.positionFrom.z - 1, 0, 0, 0, 0, 0, 0, 1.0001, 1.0001, .801, 255, 187, 51,255, 0, 0, 0,0)
  70.                 if(Vdist(pos.x, pos.y, pos.z, j.positionFrom.x, j.positionFrom.y, j.positionFrom.z) < 5.0)then
  71.                     --Drawing.draw3DText(j.positionFrom.x, j.positionFrom.y, j.positionFrom.z - 1.100, j.positionFrom.nom, 1, 0.2, 0.1, 255, 255, 255, 215)
  72.                     if(Vdist(pos.x, pos.y, pos.z, j.positionFrom.x, j.positionFrom.y, j.positionFrom.z) < 2.0)then
  73.                         ClearPrints()
  74.                         --AddTextComponentString("Press ~r~E~w~ to ".. j.positionFrom.nom)
  75.                         DisplayNotification("Press ~INPUT_PICKUP~ to " .. j.positionFrom.nom)
  76.                         DrawSubtitleTimed(2000, 1)
  77.                         if IsControlJustPressed(1, 38) then
  78.                             for i=1,#leoSkins do
  79.                                 if GetEntityModel(PlayerPedId()) == GetHashKey(leoSkins[i]) then
  80.                                     DoScreenFadeOut(1000)
  81.                                     Citizen.Wait(2000)
  82.                                     SetEntityCoords(GetPlayerPed(-1), j.positionTo.x, j.positionTo.y, j.positionTo.z - 1)
  83.                                     DoScreenFadeIn(1000)
  84.                                 else
  85.                                     drawNotification("~r~Authorised personnel only!")
  86.                                 end
  87.                             end
  88.                         end
  89.                     end
  90.                 end
  91.             end
  92.  
  93.             if(Vdist(pos.x, pos.y, pos.z, j.positionTo.x, j.positionTo.y, j.positionTo.z) < 150.0)then
  94.                 DrawMarker(1, j.positionTo.x, j.positionTo.y, j.positionTo.z - 1, 0, 0, 0, 0, 0, 0, 1.0001, 1.0001, .801, 255, 187, 51,255, 0, 0, 0,0)
  95.                 if(Vdist(pos.x, pos.y, pos.z, j.positionTo.x, j.positionTo.y, j.positionTo.z) < 5.0)then
  96.                     --Drawing.draw3DText(j.positionTo.x, j.positionTo.y, j.positionTo.z - 1.100, j.positionTo.nom, 1, 0.2, 0.1, 255, 255, 255, 215)
  97.                     if(Vdist(pos.x, pos.y, pos.z, j.positionTo.x, j.positionTo.y, j.positionTo.z) < 2.0)then
  98.                         ClearPrints()
  99.                         DisplayNotification("Press ~INPUT_PICKUP~ to " .. j.positionTo.nom)
  100.                         DrawSubtitleTimed(2000, 1)
  101.                         if IsControlJustPressed(1, 38) then
  102.                             DoScreenFadeOut(1000)
  103.                             Citizen.Wait(2000)
  104.                             SetEntityCoords(GetPlayerPed(-1), j.positionFrom.x, j.positionFrom.y, j.positionFrom.z - 1)
  105.                             DoScreenFadeIn(1000)
  106.                         end
  107.                     end
  108.                 end
  109.             end
  110.         end
  111.     end
  112. end)
  113.  
  114. ------------------------
  115. -- Prison Teleporter
  116. ------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement