Ledger Nano X - The secure hardware wallet
SHARE
TWEET

es_extended

a guest Mar 4th, 2019 361 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local Keys = {
  2.   ["ESC"] = 322, ["F1"] = 288, ["F2"] = 289, ["F3"] = 170, ["F5"] = 166, ["F6"] = 167, ["F7"] = 168, ["F8"] = 169, ["F9"] = 56, ["F10"] = 57,
  3.   ["~"] = 243, ["1"] = 157, ["2"] = 158, ["3"] = 160, ["4"] = 164, ["5"] = 165, ["6"] = 159, ["7"] = 161, ["8"] = 162, ["9"] = 163, ["-"] = 84, ["="] = 83, ["BACKSPACE"] = 177,
  4.   ["TAB"] = 37, ["Q"] = 44, ["W"] = 32, ["E"] = 38, ["R"] = 45, ["T"] = 245, ["Y"] = 246, ["U"] = 303, ["P"] = 199, ["["] = 39, ["]"] = 40, ["ENTER"] = 18,
  5.   ["CAPS"] = 137, ["A"] = 34, ["S"] = 8, ["D"] = 9, ["F"] = 23, ["G"] = 47, ["H"] = 74, ["K"] = 311, ["L"] = 182,
  6.   ["LEFTSHIFT"] = 21, ["Z"] = 20, ["X"] = 73, ["C"] = 26, ["V"] = 0, ["B"] = 29, ["N"] = 249, ["M"] = 244, [","] = 82, ["."] = 81,
  7.   ["LEFTCTRL"] = 36, ["LEFTALT"] = 19, ["SPACE"] = 22, ["RIGHTCTRL"] = 70,
  8.   ["HOME"] = 213, ["PAGEUP"] = 10, ["PAGEDOWN"] = 11, ["DELETE"] = 178,
  9.   ["LEFT"] = 174, ["RIGHT"] = 175, ["TOP"] = 27, ["DOWN"] = 173,
  10.   ["NENTER"] = 201, ["N4"] = 108, ["N5"] = 60, ["N6"] = 107, ["N+"] = 96, ["N-"] = 97, ["N7"] = 117, ["N8"] = 61, ["N9"] = 118
  11. }
  12.  
  13. local LoadoutLoaded = false
  14. local IsPaused      = false
  15. local PlayerSpawned = false
  16. local LastLoadout   = {}
  17. local Pickups       = {}
  18. local isDead        = false
  19.  
  20. RegisterNetEvent('esx:playerLoaded')
  21. AddEventHandler('esx:playerLoaded', function(xPlayer)
  22.     ESX.PlayerLoaded  = true
  23.     ESX.PlayerData    = xPlayer
  24.    
  25.     local moneyTpl = '<div><img src="http://image.noelshack.com/fichiers/2018/42/7/1540144899-cash.png"/> {{money}}</div>'
  26.  
  27.     ESX.UI.HUD.RegisterElement('money', 0, 0, moneyTpl, {
  28.       money = 0
  29.     })
  30.  
  31.     Citizen.CreateThread(function()
  32.  
  33.           while true do
  34.  
  35.               Citizen.Wait(2000)
  36.               ESX.UI.HUD.UpdateElement('money', {
  37.                    money = xPlayer.money
  38.               })
  39.           end
  40.  
  41.     end)
  42.     for i=1, #xPlayer.accounts, 1 do
  43.         local accountTpl = '<div><img src="img/accounts/' .. xPlayer.accounts[i].name .. '.png"/>{{money}}</div>'
  44.  
  45.         ESX.UI.HUD.RegisterElement('account_' .. xPlayer.accounts[i].name, i-1, 0, accountTpl, {
  46.             money = 0
  47.         })
  48.  
  49.         ESX.UI.HUD.UpdateElement('account_' .. xPlayer.accounts[i].name, {
  50.             money = xPlayer.accounts[i].money
  51.         })
  52.     end
  53.  
  54.     local jobTpl = '<div>{{job_label}} - {{grade_label}}</div>'
  55.  
  56.     if xPlayer.job.grade_label == '' then
  57.         jobTpl = '<div>{{grade_label}}</div>'
  58.     end
  59.  
  60.     ESX.UI.HUD.RegisterElement('job', #xPlayer.accounts, 0, jobTpl, {
  61.         job_label   = '',
  62.         grade_label = ''
  63.     })
  64.  
  65.     ESX.UI.HUD.UpdateElement('job', {
  66.         job_label   = xPlayer.job.label,
  67.         grade_label = xPlayer.job.grade_label
  68.     })
  69.  
  70.     local orgTpl = '<div>{{org_label}}</div>'
  71.  
  72.     if xPlayer.org.gradeorg_label == '' then
  73.         orgTpl = '<div>{{org_label}}</div>'
  74.     end
  75.  
  76.     if xPlayer.org_label == 'Organisation' then
  77.       orgTpl = '<div>{{gradeorg_label}}</div>'
  78.     end
  79.  
  80.     ESX.UI.HUD.RegisterElement('org', #xPlayer.accounts, 0, orgTpl, {
  81.         org_label   = '',
  82.         gradeorg = ''
  83.     })
  84.  
  85.     ESX.UI.HUD.UpdateElement('org', {
  86.         org_label   = xPlayer.org.label,
  87.         gradeorg_label = xPlayer.org.gradeorg_label
  88.     })
  89.  
  90. end)
  91.  
  92. AddEventHandler('playerSpawned', function()
  93.     while not ESX.PlayerLoaded do
  94.         Citizen.Wait(1)
  95.     end
  96.  
  97.     local playerPed = PlayerPedId()
  98.  
  99.     -- Restore position
  100.     if ESX.PlayerData.lastPosition ~= nil then
  101.         SetEntityCoords(playerPed, ESX.PlayerData.lastPosition.x, ESX.PlayerData.lastPosition.y, ESX.PlayerData.lastPosition.z)
  102.     end
  103.  
  104.     TriggerEvent('esx:restoreLoadout') -- restore loadout
  105.  
  106.     LoadoutLoaded = true
  107.     PlayerSpawned = true
  108.     isDead = false
  109. end)
  110.  
  111. AddEventHandler('esx:onPlayerDeath', function()
  112.     isDead = true
  113. end)
  114.  
  115. AddEventHandler('skinchanger:loadDefaultModel', function()
  116.     LoadoutLoaded = false
  117. end)
  118.  
  119. AddEventHandler('skinchanger:modelLoaded', function()
  120.     while not ESX.PlayerLoaded do
  121.         Citizen.Wait(1)
  122.     end
  123.  
  124.     TriggerEvent('esx:restoreLoadout')
  125. end)
  126.  
  127. AddEventHandler('esx:restoreLoadout', function()
  128.     local playerPed = PlayerPedId()
  129.     local ammoTypes = {}
  130.  
  131.     RemoveAllPedWeapons(playerPed, true)
  132.  
  133.     for i=1, #ESX.PlayerData.loadout, 1 do
  134.         local weaponName = ESX.PlayerData.loadout[i].name
  135.         local weaponHash = GetHashKey(weaponName)
  136.  
  137.         GiveWeaponToPed(playerPed, weaponHash, 0, false, false)
  138.         local ammoType = GetPedAmmoTypeFromWeapon(playerPed, weaponHash)
  139.  
  140.         for j=1, #ESX.PlayerData.loadout[i].components, 1 do
  141.             local weaponComponent = ESX.PlayerData.loadout[i].components[j]
  142.             local componentHash = ESX.GetWeaponComponent(weaponName, weaponComponent).hash
  143.  
  144.             GiveWeaponComponentToPed(playerPed, weaponHash, componentHash)
  145.         end
  146.  
  147.         if not ammoTypes[ammoType] then
  148.             AddAmmoToPed(playerPed, weaponHash, ESX.PlayerData.loadout[i].ammo)
  149.             ammoTypes[ammoType] = true
  150.         end
  151.     end
  152.  
  153.     LoadoutLoaded = true
  154. end)
  155.  
  156. RegisterNetEvent('esx:setAccountMoney')
  157. AddEventHandler('esx:setAccountMoney', function(account)
  158.     for i=1, #ESX.PlayerData.accounts, 1 do
  159.         if ESX.PlayerData.accounts[i].name == account.name then
  160.             ESX.PlayerData.accounts[i] = account
  161.             break
  162.         end
  163.     end
  164.  
  165.     if Config.EnableHud then
  166.         ESX.UI.HUD.UpdateElement('account_' .. account.name, {
  167.             money = ESX.Math.GroupDigits(account.money)
  168.         })
  169.     end
  170. end)
  171.  
  172. RegisterNetEvent('es:activateMoney')
  173. AddEventHandler('es:activateMoney', function(money)
  174.     ESX.PlayerData.money = money
  175. end)
  176.  
  177. RegisterNetEvent('esx:addInventoryItem')
  178. AddEventHandler('esx:addInventoryItem', function(item, count)
  179.     for i=1, #ESX.PlayerData.inventory, 1 do
  180.         if ESX.PlayerData.inventory[i].name == item.name then
  181.             ESX.PlayerData.inventory[i] = item
  182.             break
  183.         end
  184.     end
  185.  
  186.     ESX.UI.ShowInventoryItemNotification(true, item, count)
  187.  
  188.     if ESX.UI.Menu.IsOpen('default', 'es_extended', 'inventory') then
  189.         ESX.ShowInventory()
  190.     end
  191. end)
  192.  
  193. RegisterNetEvent('esx:removeInventoryItem')
  194. AddEventHandler('esx:removeInventoryItem', function(item, count)
  195.     for i=1, #ESX.PlayerData.inventory, 1 do
  196.         if ESX.PlayerData.inventory[i].name == item.name then
  197.             ESX.PlayerData.inventory[i] = item
  198.             break
  199.         end
  200.     end
  201.  
  202.     ESX.UI.ShowInventoryItemNotification(false, item, count)
  203.  
  204.     if ESX.UI.Menu.IsOpen('default', 'es_extended', 'inventory') then
  205.         ESX.ShowInventory()
  206.     end
  207. end)
  208.  
  209. RegisterNetEvent('esx:setJob')
  210. AddEventHandler('esx:setJob', function(job)
  211.     ESX.PlayerData.job = job
  212. end)
  213.  
  214. RegisterNetEvent('esx:addWeapon')
  215. AddEventHandler('esx:addWeapon', function(weaponName, ammo)
  216.     local playerPed  = PlayerPedId()
  217.     local weaponHash = GetHashKey(weaponName)
  218.  
  219.     GiveWeaponToPed(playerPed, weaponHash, ammo, false, false)
  220.     --AddAmmoToPed(playerPed, weaponHash, ammo) possibly not needed
  221. end)
  222.  
  223. RegisterNetEvent('esx:addWeaponComponent')
  224. AddEventHandler('esx:addWeaponComponent', function(weaponName, weaponComponent)
  225.     local playerPed  = PlayerPedId()
  226.     local weaponHash = GetHashKey(weaponName)
  227.     local componentHash = ESX.GetWeaponComponent(weaponName, weaponComponent).hash
  228.  
  229.     GiveWeaponComponentToPed(playerPed, weaponHash, componentHash)
  230. end)
  231.  
  232. RegisterNetEvent('esx:removeWeapon')
  233. AddEventHandler('esx:removeWeapon', function(weaponName, ammo)
  234.     local playerPed  = PlayerPedId()
  235.     local weaponHash = GetHashKey(weaponName)
  236.  
  237.     RemoveWeaponFromPed(playerPed, weaponHash)
  238.  
  239.     if ammo then
  240.         local pedAmmo = GetAmmoInPedWeapon(playerPed, weaponHash)
  241.         local finalAmmo = math.floor(pedAmmo - ammo)
  242.         SetPedAmmo(playerPed, weaponHash, finalAmmo)
  243.     else
  244.         SetPedAmmo(playerPed, weaponHash, 0) -- remove leftover ammo
  245.     end
  246. end)
  247.  
  248.  
  249. RegisterNetEvent('esx:removeWeaponComponent')
  250. AddEventHandler('esx:removeWeaponComponent', function(weaponName, weaponComponent)
  251.     local playerPed  = PlayerPedId()
  252.     local weaponHash = GetHashKey(weaponName)
  253.     local componentHash = ESX.GetWeaponComponent(weaponName, weaponComponent).hash
  254.  
  255.     RemoveWeaponComponentFromPed(playerPed, weaponHash, componentHash)
  256. end)
  257.  
  258. -- Commands
  259. RegisterNetEvent('esx:teleport')
  260. AddEventHandler('esx:teleport', function(pos)
  261.     pos.x = pos.x + 0.0
  262.     pos.y = pos.y + 0.0
  263.     pos.z = pos.z + 0.0
  264.  
  265.     RequestCollisionAtCoord(pos.x, pos.y, pos.z)
  266.  
  267.     while not HasCollisionLoadedAroundEntity(PlayerPedId()) do
  268.         RequestCollisionAtCoord(pos.x, pos.y, pos.z)
  269.         Citizen.Wait(1)
  270.     end
  271.  
  272.     SetEntityCoords(PlayerPedId(), pos.x, pos.y, pos.z)
  273. end)
  274.  
  275. RegisterNetEvent('esx:setJob')
  276. AddEventHandler('esx:setJob', function(job)
  277.     if Config.EnableHud then
  278.         ESX.UI.HUD.UpdateElement('job', {
  279.             job_label   = job.label,
  280.             grade_label = job.grade_label
  281.         })
  282.     end
  283. end)
  284.  
  285. RegisterNetEvent('esx:loadIPL')
  286. AddEventHandler('esx:loadIPL', function(name)
  287.     Citizen.CreateThread(function()
  288.         LoadMpDlcMaps()
  289.         RequestIpl(name)
  290.     end)
  291. end)
  292.  
  293. RegisterNetEvent('esx:unloadIPL')
  294. AddEventHandler('esx:unloadIPL', function(name)
  295.     Citizen.CreateThread(function()
  296.         RemoveIpl(name)
  297.     end)
  298. end)
  299.  
  300. RegisterNetEvent('esx:playAnim')
  301. AddEventHandler('esx:playAnim', function(dict, anim)
  302.     Citizen.CreateThread(function()
  303.         local playerPed = PlayerPedId()
  304.         RequestAnimDict(dict)
  305.  
  306.         while not HasAnimDictLoaded(dict) do
  307.             Citizen.Wait(1)
  308.         end
  309.  
  310.         TaskPlayAnim(playerPed, dict, anim, 1.0, -1.0, 20000, 0, 1, true, true, true)
  311.     end)
  312. end)
  313.  
  314. RegisterNetEvent('esx:playEmote')
  315. AddEventHandler('esx:playEmote', function(emote)
  316.     Citizen.CreateThread(function()
  317.  
  318.         local playerPed = PlayerPedId()
  319.  
  320.         TaskStartScenarioInPlace(playerPed, emote, 0, false);
  321.         Citizen.Wait(20000)
  322.         ClearPedTasks(playerPed)
  323.  
  324.     end)
  325. end)
  326.  
  327. RegisterNetEvent('esx:spawnVehicle')
  328. AddEventHandler('esx:spawnVehicle', function(model)
  329.     local playerPed = PlayerPedId()
  330.     local coords    = GetEntityCoords(playerPed)
  331.  
  332.     ESX.Game.SpawnVehicle(model, coords, 90.0, function(vehicle)
  333.         TaskWarpPedIntoVehicle(playerPed,  vehicle, -1)
  334.     end)
  335. end)
  336.  
  337. RegisterNetEvent('esx:spawnObject')
  338. AddEventHandler('esx:spawnObject', function(model)
  339.     local playerPed = PlayerPedId()
  340.     local coords    = GetEntityCoords(playerPed)
  341.     local forward   = GetEntityForwardVector(playerPed)
  342.     local x, y, z   = table.unpack(coords + forward * 1.0)
  343.  
  344.     ESX.Game.SpawnObject(model, {
  345.         x = x,
  346.         y = y,
  347.         z = z
  348.     }, function(obj)
  349.         SetEntityHeading(obj, GetEntityHeading(playerPed))
  350.         PlaceObjectOnGroundProperly(obj)
  351.     end)
  352. end)
  353.  
  354. RegisterNetEvent('esx:pickup')
  355. AddEventHandler('esx:pickup', function(id, label, player)
  356.     local ped     = GetPlayerPed(GetPlayerFromServerId(player))
  357.     local coords  = GetEntityCoords(ped)
  358.     local forward = GetEntityForwardVector(ped)
  359.     local x, y, z = table.unpack(coords + forward * -2.0)
  360.  
  361.     ESX.Game.SpawnLocalObject('prop_money_bag_01', {
  362.         x = x,
  363.         y = y,
  364.         z = z - 2.0,
  365.     }, function(obj)
  366.         SetEntityAsMissionEntity(obj, true, false)
  367.         PlaceObjectOnGroundProperly(obj)
  368.  
  369.         Pickups[id] = {
  370.             id = id,
  371.             obj = obj,
  372.             label = label,
  373.             inRange = false,
  374.             coords = {
  375.                 x = x,
  376.                 y = y,
  377.                 z = z
  378.             }
  379.         }
  380.     end)
  381. end)
  382.  
  383. RegisterNetEvent('esx:removePickup')
  384. AddEventHandler('esx:removePickup', function(id)
  385.     ESX.Game.DeleteObject(Pickups[id].obj)
  386.     Pickups[id] = nil
  387. end)
  388.  
  389. RegisterNetEvent('esx:pickupWeapon')
  390. AddEventHandler('esx:pickupWeapon', function(weaponPickup, weaponName, ammo)
  391.     local playerPed = PlayerPedId()
  392.     local pickupCoords = GetOffsetFromEntityInWorldCoords(playerPed, 2.0, 0.0, 0.5)
  393.     local weaponHash = GetHashKey(weaponPickup)
  394.  
  395.     CreateAmbientPickup(weaponHash, pickupCoords, 0, ammo, 1, false, true)
  396. end)
  397.  
  398. RegisterNetEvent('esx:spawnPed')
  399. AddEventHandler('esx:spawnPed', function(model)
  400.     model           = (tonumber(model) ~= nil and tonumber(model) or GetHashKey(model))
  401.     local playerPed = PlayerPedId()
  402.     local coords    = GetEntityCoords(playerPed)
  403.     local forward   = GetEntityForwardVector(playerPed)
  404.     local x, y, z   = table.unpack(coords + forward * 1.0)
  405.  
  406.     Citizen.CreateThread(function()
  407.         RequestModel(model)
  408.  
  409.         while not HasModelLoaded(model) do
  410.             Citizen.Wait(1)
  411.         end
  412.  
  413.         CreatePed(5, model, x, y, z, 0.0, true, false)
  414.     end)
  415. end)
  416.  
  417. RegisterNetEvent('esx:deleteVehicle')
  418. AddEventHandler('esx:deleteVehicle', function()
  419.     local playerPed = PlayerPedId()
  420.     local vehicle   = ESX.Game.GetVehicleInDirection()
  421.  
  422.     if IsPedInAnyVehicle(playerPed, true) then
  423.         vehicle = GetVehiclePedIsIn(playerPed, false)
  424.     end
  425.  
  426.     if DoesEntityExist(vehicle) then
  427.         ESX.Game.DeleteVehicle(vehicle)
  428.     end
  429. end)
  430.  
  431. -- Pause menu disable HUD display
  432. if Config.EnableHud then
  433.     Citizen.CreateThread(function()
  434.         while true do
  435.             Citizen.Wait(300)
  436.  
  437.             if IsPauseMenuActive() and not IsPaused then
  438.                 IsPaused = true
  439.                 TriggerEvent('es:setMoneyDisplay', 0.0)
  440.                 ESX.UI.HUD.SetDisplay(0.0)
  441.             elseif not IsPauseMenuActive() and IsPaused then
  442.                 IsPaused = false
  443.                 TriggerEvent('es:setMoneyDisplay', 1.0)
  444.                 ESX.UI.HUD.SetDisplay(1.0)
  445.             end
  446.         end
  447.     end)
  448. end
  449.  
  450. -- Save loadout
  451. Citizen.CreateThread(function()
  452.     while true do
  453.  
  454.         Citizen.Wait(5000)
  455.  
  456.         local playerPed      = PlayerPedId()
  457.         local loadout        = {}
  458.         local loadoutChanged = false
  459.  
  460.         if IsPedDeadOrDying(playerPed) then
  461.             LoadoutLoaded = false
  462.         end
  463.  
  464.         for i=1, #Config.Weapons, 1 do
  465.  
  466.             local weaponName = Config.Weapons[i].name
  467.             local weaponHash = GetHashKey(weaponName)
  468.             local weaponComponents = {}
  469.  
  470.             if HasPedGotWeapon(playerPed, weaponHash, false) and weaponName ~= 'WEAPON_UNARMED' then
  471.                 local ammo = GetAmmoInPedWeapon(playerPed, weaponHash)
  472.                 local components = Config.Weapons[i].components
  473.  
  474.                 for j=1, #components, 1 do
  475.                     if HasPedGotWeaponComponent(playerPed, weaponHash, components[j].hash) then
  476.                         table.insert(weaponComponents, components[j].name)
  477.                     end
  478.                 end
  479.  
  480.                 if LastLoadout[weaponName] == nil or LastLoadout[weaponName] ~= ammo then
  481.                     loadoutChanged = true
  482.                 end
  483.  
  484.                 LastLoadout[weaponName] = ammo
  485.  
  486.                 table.insert(loadout, {
  487.                     name = weaponName,
  488.                     ammo = ammo,
  489.                     label = Config.Weapons[i].label,
  490.                     components = weaponComponents
  491.                 })
  492.             else
  493.                 if LastLoadout[weaponName] ~= nil then
  494.                     loadoutChanged = true
  495.                 end
  496.  
  497.                 LastLoadout[weaponName] = nil
  498.             end
  499.  
  500.         end
  501.  
  502.         if loadoutChanged and LoadoutLoaded then
  503.             ESX.PlayerData.loadout = loadout
  504.             TriggerServerEvent('esx:updateLoadout', loadout)
  505.         end
  506.  
  507.     end
  508. end)
  509.  
  510. -- Menu interactions
  511. Citizen.CreateThread(function()
  512.     while true do
  513.  
  514.         Citizen.Wait(0)
  515.  
  516.         if IsControlJustReleased(0, Keys['']) and GetLastInputMethod(2) and not isDead and not ESX.UI.Menu.IsOpen('default', 'es_extended', 'inventory') then
  517.             ESX.ShowInventory()
  518.         end
  519.  
  520.     end
  521. end)
  522.  
  523. -- Dot above head
  524. if Config.ShowDotAbovePlayer then
  525.  
  526.     Citizen.CreateThread(function()
  527.         while true do
  528.  
  529.             Citizen.Wait(1)
  530.  
  531.             local players = ESX.Game.GetPlayers()
  532.             for i = 1, #players, 1 do
  533.                 if players[i] ~= PlayerId() then
  534.                     local ped    = GetPlayerPed(players[i])
  535.                     local headId = CreateMpGamerTag(ped, ('ยท'), false, false, '', false)
  536.                 end
  537.             end
  538.  
  539.         end
  540.     end)
  541.  
  542. end
  543.  
  544. -- Disable wanted level
  545. if Config.DisableWantedLevel then
  546.  
  547.     Citizen.CreateThread(function()
  548.         while true do
  549.             Citizen.Wait(0)
  550.  
  551.             local playerId = PlayerId()
  552.             if GetPlayerWantedLevel(playerId) ~= 0 then
  553.                 SetPlayerWantedLevel(playerId, 0, false)
  554.                 SetPlayerWantedLevelNow(playerId, false)
  555.             end
  556.         end
  557.     end)
  558.  
  559. end
  560.  
  561. -- Pickups
  562. Citizen.CreateThread(function()
  563.     while true do
  564.  
  565.         Citizen.Wait(0)
  566.  
  567.         local playerPed = PlayerPedId()
  568.         local coords    = GetEntityCoords(playerPed)
  569.        
  570.         -- if there's no nearby pickups we can wait a bit to save performance
  571.         if next(Pickups) == nil then
  572.             Citizen.Wait(500)
  573.         end
  574.  
  575.         for k,v in pairs(Pickups) do
  576.  
  577.             local distance = GetDistanceBetweenCoords(coords, v.coords.x, v.coords.y, v.coords.z, true)
  578.             local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer()
  579.  
  580.             if distance <= 5.0 then
  581.                 ESX.Game.Utils.DrawText3D({
  582.                     x = v.coords.x,
  583.                     y = v.coords.y,
  584.                     z = v.coords.z + 0.25
  585.                 }, v.label)
  586.             end
  587.  
  588.             if (closestDistance == -1 or closestDistance > 3) and distance <= 1.0 and not v.inRange and not IsPedSittingInAnyVehicle(playerPed) then
  589.                 TriggerServerEvent('esx:onPickup', v.id)
  590.                 PlaySoundFrontend(-1, 'PICK_UP', 'HUD_FRONTEND_DEFAULT_SOUNDSET', false)
  591.                 v.inRange = true
  592.             end
  593.  
  594.         end
  595.  
  596.     end
  597. end)
  598.  
  599. -- Last position
  600. Citizen.CreateThread(function()
  601.     while true do
  602.         Citizen.Wait(1000)
  603.  
  604.         if ESX.PlayerLoaded and PlayerSpawned then
  605.             local playerPed = PlayerPedId()
  606.             local coords    = GetEntityCoords(playerPed)
  607.  
  608.             if not IsEntityDead(playerPed) then
  609.                 ESX.PlayerData.lastPosition = {x = coords.x, y = coords.y, z = coords.z}
  610.             end
  611.         end
  612.     end
  613. end)
  614.  
  615. Citizen.CreateThread(function()
  616.     while true do
  617.         Citizen.Wait(1000)
  618.  
  619.         local playerPed = PlayerPedId()
  620.         if IsEntityDead(playerPed) and PlayerSpawned then
  621.             PlayerSpawned = false
  622.         end
  623.     end
  624. end)
  625.  
  626.  
  627.  
  628.  
  629. RegisterNetEvent('NB:openMenuInventaire')
  630. AddEventHandler('NB:openMenuInventaire', function()
  631.     ESX.ShowInventory()
  632. 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