local blip = GetBlipFromEntity(ped)
if not DoesBlipExist(blip) then
blip = AddBlipForEntity(ped)
SetBlipSprite(blip, 1)
SetBlipColour(blip, 1)
ShowHeadingIndicatorOnBlip(blip, true)
SetBlipRotation(blip, math.ceil(GetEntityHeading(ped)))
SetBlipScale(blip, 0.85)
SetBlipAsShortRange(blip, true)
BeginTextCommandSetBlipName('STRING')
AddTextComponentString('[~r~LSMS~s~] '..isim)
EndTextCommandSetBlipName(blip)
table.insert(blipsCops, blip)
end
end
RegisterNetEvent('exelds:refreshGPS')
AddEventHandler('exelds:refreshGPS', function()
if gpsInfo == true then
if PlayerData.job.name == 'police' or PlayerData.job.name == 'offpolice' then
getGPSListforPolice()
elseif PlayerData.job.name == 'ambulance' or PlayerData.job.name == 'offambulance' then
getGPSListforAmbulance()
end
end
end)
Sonrasında policejob server kısmında eski AddEventHandler('playerDropped' kısmını silin ve yine istediğiniz bir yere aşağıdaki kodları ekleyin
Kod:
local GPSList = {}
RegisterServerEvent('exelds:addGPSList')
AddEventHandler('exelds:addGPSList', function(rozetNum)
local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
MySQL.Async.fetchAll("SELECT firstname, lastname FROM users WHERE identifier = @identifier", { ["@identifier"] = xPlayer.identifier }, function(result)
local name = string.format("%s %s", result[1].firstname, result[1].lastname)
table.insert(GPSList, {_source, name, xPlayer.job.name, rozetNum})
TriggerClientEvent('exelds:refreshGPS', -1)
end)
end)
RegisterServerEvent('exelds:removeGPSList')
AddEventHandler('exelds:removeGPSList', function()
local _source = source
for i = 1, #GPSList do
if GPSList[i] and GPSList[i][1] == _source then
table.remove(GPSList, i)
end
end
TriggerClientEvent('exelds:refreshGPS', -1)
end)
ESX.RegisterServerCallback('exelds:getGPSList', function(source, cb)
cb(GPSList)
end)
AddEventHandler('playerDropped', function()
local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
if _source ~= nil then
if xPlayer ~= nil and xPlayer.job ~= nil and (xPlayer.job.name == 'police' or xPlayer.job.name == 'offpolice' or xPlayer.job.name == 'ambulance' or xPlayer.job.name == 'offambulance') then
for i = 1, #GPSList do
if GPSList[i] and GPSList[i][1] == _source then
table.remove(GPSList, i)
end
end
end
end
end)
ESX.RegisterServerCallback('esx_policejob:getItem', function(source, cb, item)
local xPlayer = ESX.GetPlayerFromId(source)
local items = xPlayer.getInventoryItem(item)
if items == nil then
cb(0)
else
cb(items.count)
end
end)
AddEventHandler('esx:onRemoveInventoryItem', function(source, item, count)
local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
if xPlayer ~= nil and xPlayer.job ~= nil and (xPlayer.job.name == 'police' or xPlayer.job.name == 'offpolice' or xPlayer.job.name == 'ambulance' or xPlayer.job.name == 'offambulance') then
if item.name == 'gps' and item.count < 1 then
TriggerClientEvent('exelds:GPSStop', source)
end
end
end)