Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ESX = nil
- local blipsRef = {}
- local PlayerData = {}
- local displayed = false
- refblip = nil
- Citizen.CreateThread(function()
- while ESX == nil do
- TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
- Citizen.Wait(0)
- end
- while ESX.GetPlayerData().job == nil do
- Citizen.Wait(10)
- end
- PlayerData = ESX.GetPlayerData()
- end)
- -- Command --
- Citizen.CreateThread(function()
- while true do
- Citizen.Wait(0)
- if ( IsControlJustPressed(0,244) and IsPedInAnyPoliceVehicle(PlayerPedId())) then
- if displayed == false then
- local player = PlayerPedId()
- local x, y, z = table.unpack(GetEntityCoords(ped, true))
- local street = GetStreetNameAtCoord(x, y, z)
- local location = GetStreetNameFromHashKey(street)
- local vehicle = GetVehiclePedIsIn(player, true)
- NetworkRegisterEntityAsNetworked(vehicle)
- local netId = NetworkGetNetworkIdFromEntity(vehicle)
- SetEntityAsMissionEntity(vehicle)
- SetNetworkIdCanMigrate(netid,true)
- SetNetworkIdExistsOnAllMachines(netid,true)
- NetworkRequestControlOfEntity(vehicle)
- vehiculoactual = vehicle
- print(vehicle)
- ESX.ShowNotification('~r~Activado GPS~w~ de Apoyo~b~ Policial~w~')
- displayed = true
- print(displayed)
- TriggerServerEvent('esx_ref:referencia', location, vehicle, player)
- Citizen.Wait(5000)
- else
- ESX.ShowNotification('~r~Desactivado GPS~w~ de Apoyo~b~ Policial~w~')
- displayed = false
- TriggerServerEvent('esx_ref:killreferencia', vehiculoactual)
- Citizen.Wait(5000)
- end
- end
- end
- end)
- RegisterNetEvent('esx_ref:killblip')
- AddEventHandler('esx_ref:killblip', function(coche)
- for k, v in pairs(blipsRef) do
- if v.veh == coche then
- RemoveBlip(v.blip)
- table.remove(blipsRef, k)
- end
- end
- end)
- RegisterNetEvent('esx_ref:setBlip')
- AddEventHandler('esx_ref:setBlip', function(jugador, coche)
- print('Esta es la id del coche : '..coche)
- print('Este es el player source : '..jugador)
- local refblip = AddBlipForEntity(coche)
- SetBlipSprite(refblip, 42)
- SetBlipRoute(refblip, true)
- SetBlipScale(refblip, 0.85)
- BeginTextCommandSetBlipName("STRING")
- AddTextComponentString('Llamada de apoyo')
- EndTextCommandSetBlipName(refblip)
- table.insert(blipsRef, {blip = refblip, veh = coche})
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement