SHARE
TWEET

Untitled

a guest Mar 19th, 2019 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ESX = nil
  2. Citizen.CreateThread(function()
  3.     while ESX == nil do
  4.         Citizen.Wait(200)
  5.         TriggerEvent('esx:getSharedObject', function (obj) ESX = obj end)
  6.     end
  7. end)
  8.  
  9. Citizen.CreateThread(function()
  10.     while true do
  11.         Citizen.Wait(0)
  12.         if NetworkIsSessionStarted() then
  13.             Citizen.Wait(100)
  14.             ShutdownLoadingScreen() ---- Bye Loading Screen no longer needed
  15.             TriggerServerEvent("kashactersS:SetupCharacters")
  16.             TriggerEvent("kashactersC:SetupCharacters")
  17.             return -- break the loop
  18.         end
  19.     end
  20. end)
  21.  
  22. local IsChoosing = true
  23. Citizen.CreateThread(function ()
  24.     while true do
  25.         Citizen.Wait(0)
  26.         if IsChoosing then
  27.             DisplayHud(false)
  28.             DisplayRadar(false)
  29.         end
  30.     end
  31. end)
  32. local cam = nil
  33. local cam2 = nil
  34. RegisterNetEvent('kashactersC:SetupCharacters')
  35. AddEventHandler('kashactersC:SetupCharacters', function()
  36.     DoScreenFadeOut(10)
  37.     local ped = GetPlayerPed(-1)
  38.     FreezeEntityPosition(ped, true)
  39.     while not IsScreenFadedOut() do
  40.         Citizen.Wait(10)
  41.     end
  42.     SetTimecycleModifier('hud_def_blur')
  43.     FreezeEntityPosition(GetPlayerPed(-1), true)
  44.     cam = CreateCamWithParams("DEFAULT_SCRIPTED_CAMERA", -1355.93,-1487.78,520.75, 300.00,0.00,0.00, 100.00, false, 0)
  45.     SetCamActive(cam, true)
  46.     RenderScriptCams(true, false, 1, true, true)
  47. end)
  48.  
  49. RegisterNetEvent('kashactersC:SetupUI')
  50. AddEventHandler('kashactersC:SetupUI', function(Characters)
  51.     DoScreenFadeIn(500)
  52.     Citizen.Wait(500)
  53.     SetNuiFocus(true, true)
  54.     SendNUIMessage({
  55.         action = "openui",
  56.         characters = Characters,
  57.     })
  58. end)
  59.  
  60. RegisterNetEvent('kashactersC:SpawnCharacter')
  61. AddEventHandler('kashactersC:SpawnCharacter', function(spawn, isnew)
  62.     local ped = GetPlayerPed(-1)
  63.     TriggerServerEvent('es:firstJoinProper')
  64.     TriggerEvent('es:allowedToSpawn')
  65.     TriggerEvent('esx_ambulancejob:multicharacter')
  66.  
  67.     SetTimecycleModifier('default')
  68.     local pos = spawn
  69.     SetEntityCoords(GetPlayerPed(-1), pos.x, pos.y, pos.z)
  70.     DoScreenFadeIn(500)
  71.     Citizen.Wait(500)
  72.     cam2 = CreateCamWithParams("DEFAULT_SCRIPTED_CAMERA", -1355.93,-1487.78,520.75, 300.00,0.00,0.00, 100.00, false, 0)
  73.     PointCamAtCoord(cam2, pos.x,pos.y,pos.z+200)
  74.     SetCamActiveWithInterp(cam2, cam, 900, true, true)
  75.     Citizen.Wait(900)
  76.             ESX.UI.HUD.SetDisplay(1.0)
  77.     TriggerEvent('es:setMoneyDisplay', 1.0)
  78.    
  79.  if isnew then
  80.     local ped = GetPlayerPed(-1)
  81.     TriggerEvent('esx_identity:showRegisterIdentity')
  82.     FreezeEntityPosition(ped, false)
  83.  end
  84.  
  85.     cam = CreateCamWithParams("DEFAULT_SCRIPTED_CAMERA", pos.x,pos.y,pos.z+200, 300.00,0.00,0.00, 100.00, false, 0)
  86.     PointCamAtCoord(cam, pos.x,pos.y,pos.z+2)
  87.     SetCamActiveWithInterp(cam, cam2, 3700, true, true)
  88.     Citizen.Wait(3700)
  89.     PlaySoundFrontend(-1, "Zoom_Out", "DLC_HEIST_PLANNING_BOARD_SOUNDS", 1)
  90.     RenderScriptCams(false, true, 500, true, true)
  91.     PlaySoundFrontend(-1, "CAR_BIKE_WHOOSH", "MP_LOBBY_SOUNDS", 1)
  92.     FreezeEntityPosition(GetPlayerPed(-1), false)
  93.     Citizen.Wait(500)
  94.     SetCamActive(cam, false)
  95.     DestroyCam(cam, true)
  96.     IsChoosing = false
  97.     DisplayHud(true)
  98.     DisplayRadar(true)
  99.     ESX.UI.HUD.SetDisplay(0.0) -- Set Hud to not display
  100.     TriggerEvent('es:setMoneyDisplay', 0.0) -- Set Cash to not display
  101.     FreezeEntityPosition(ped, false)
  102. end)
  103.  
  104. RegisterNetEvent('kashactersC:ReloadCharacters')
  105. AddEventHandler('kashactersC:ReloadCharacters', function()
  106.     TriggerServerEvent("kashactersS:SetupCharacters")
  107.     TriggerEvent("kashactersC:SetupCharacters")
  108. end)
  109.  
  110. RegisterNUICallback("CharacterChosen", function(data, cb)
  111.     SetNuiFocus(false,false)
  112.     DoScreenFadeOut(500)
  113.     TriggerServerEvent('kashactersS:CharacterChosen', data.charid, data.ischar)
  114.     while not IsScreenFadedOut() do
  115.         Citizen.Wait(10)
  116.     end
  117.     cb("ok")
  118. end)
  119. RegisterNUICallback("DeleteCharacter", function(data, cb)
  120.     SetNuiFocus(false,false)
  121.     DoScreenFadeOut(500)
  122.     TriggerServerEvent('kashactersS:DeleteCharacter', data.charid)
  123.     while not IsScreenFadedOut() do
  124.         Citizen.Wait(10)
  125.     end
  126.     cb("ok")
  127. end)
  128.  
  129. RegisterNetEvent("kashactersC:Skinchanger")
  130. AddEventHandler("kashactersC:Skinchanger", function(source)
  131. local source_ = source
  132. ESX.TriggerServerCallback("esx_skin:getPlayerSkin", function(skin, jobSkin)
  133. TriggerEvent("skinchanger:loadSkin", skin)
  134. end)
  135. end)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top