Advertisement
Guest User

Untitled

a guest
May 23rd, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.53 KB | None | 0 0
  1. local cJ = false
  2. local eJE = false
  3. ESX                           = nil
  4. local HasAlreadyEnteredMarker = false
  5. local LastZone                = nil
  6. local CurrentAction           = nil
  7. local CurrentActionMsg        = ''
  8. local CurrentActionData       = {}
  9.  
  10. Citizen.CreateThread(function()
  11.     while ESX == nil do
  12.         TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
  13.         Citizen.Wait(0)
  14.     end
  15. end)
  16.  
  17. AddEventHandler('quest:hasEnteredMarker', function(zone)
  18.  
  19.   CurrentAction     = 'quest_menu'
  20.   CurrentActionMsg  = _U('Tryck E för att snacka med Biggie')
  21.   CurrentActionData = {zone = zone}
  22.  
  23. end)
  24.  
  25. AddEventHandler('quest:hasExitedMarker', function(zone)
  26.  
  27.   CurrentAction = nil
  28.   ESX.UI.Menu.CloseAll()
  29.  
  30. end)
  31.  
  32.       if IsControlJustPressed(0, 38) and CurrentAction == 'quest_menu' then
  33.       TriggerEvent("quest")
  34.     end
  35.  
  36.  
  37. RegisterNetEvent("quest")
  38. AddEventHandler('quest', function()
  39.   if cJ == true then
  40.     return
  41.   end
  42.   local pP = GetPlayerPed(-1)
  43.   if DoesEntityExist(pP) then
  44.  
  45.       local playerOldLoc = GetEntityCoords(pP, true)
  46.  
  47.       DoScreenFadeOut(1000)
  48.       TriggerServerEvent("InteractSound_SV:PlayOnSource", "cuffs", 1.0)
  49.       Citizen.Wait(1000)
  50.  
  51.       SetEntityCoords(pP, -20, -1447.03, 30.7)
  52.       SetEntityHeading(pP, 270.0)
  53.  
  54.       wanted_model="S_M_Y_COP_01"
  55.         modelHash = GetHashKey(wanted_model)
  56.         RequestModel(modelHash)
  57.  
  58.         while not HasModelLoaded(modelHash) do
  59.             Wait(1)
  60.         end
  61.  
  62.         local cop = CreatePed(5, modelHash , -14.27, -1442.81, 31.1, 178.05, false, false)
  63.         TaskStartScenarioInPlace(cop, "WORLD_HUMAN_PAPARAZZI", 0, true)
  64.  
  65.       local cam = CreateCam("DEFAULT_SCRIPTED_FLY_CAMERA", true)
  66.       AttachCamToEntity(cam, pP, 0.0,7.0,0.0, true)
  67.       SetCamRot(cam, 0.0,0.0,90.0)
  68.       RenderScriptCams(true, false, 0, 1, 0)
  69.  
  70.       Citizen.Wait(1000)
  71.       FreezeEntityPosition(pP, true)
  72.       DoScreenFadeIn(1000)
  73.  
  74.       Citizen.Wait(10000)
  75.       DoScreenFadeOut(1000)
  76.       Citizen.Wait(1000)
  77.  
  78.       DeletePed(cop)
  79.       RenderScriptCams(false, false, 0, 1, 0)
  80.       FreezeEntityPosition(pP, false)
  81.       SetEntityCoords(pP, -14.16, -1448.4, 30.65)
  82.  
  83.       Citizen.Wait(2500)
  84.       DoScreenFadeIn(1000)
  85.       end
  86.       end)
  87.  
  88.  
  89. -- Display markers
  90. Citizen.CreateThread(function()
  91.   while true do
  92.     Wait(0)
  93.     local coords = GetEntityCoords(GetPlayerPed(-1))
  94.     for k,v in pairs(Config.Zones) do
  95.       for i = 1, #v.Pos, 1 do
  96.         if(Config.Type ~= -1 and GetDistanceBetweenCoords(coords, v.Pos[i].x, v.Pos[i].y, v.Pos[i].z, true) < Config.DrawDistance) then
  97.           DrawMarker(Config.Type, v.Pos[i].x, v.Pos[i].y, v.Pos[i].z, 0.0, 0.0, 0.0, 0, 0.0, 0.0, Config.Size.x, Config.Size.y, Config.Size.z, Config.Color.r, Config.Color.g, Config.Color.b, 100, false, true, 2, false, false, false, false)
  98.         end
  99.       end
  100.     end
  101.   end
  102. end)
  103.  
  104. -- Enter / Exit marker events
  105. Citizen.CreateThread(function()
  106.   while true do
  107.     Wait(0)
  108.     local coords      = GetEntityCoords(GetPlayerPed(-1))
  109.     local isInMarker  = false
  110.     local currentZone = nil
  111.  
  112.     for k,v in pairs(Config.Zones) do
  113.     for k,v in pairs(Config.Zones) do
  114.     if(GetDistanceBetweenCoords(coords, v[i].x, v[i].y, v[i].z, true) < Config.Size.x) then
  115.       isInMarker  = true
  116.       currentZone = k
  117.       LastZone    = k
  118.     end
  119. end
  120.       end
  121.     end
  122.     if isInMarker and not HasAlreadyEnteredMarker then
  123.       HasAlreadyEnteredMarker = true
  124.       TriggerEvent('quest_menu:hasEnteredMarker', currentZone)
  125.    end
  126.   end
  127.  
  128.   end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement