forked from Simnation/Main
Update client.lua
This commit is contained in:
parent
7fd4b36bb4
commit
646953bcc4
1 changed files with 17 additions and 10 deletions
|
@ -1,3 +1,5 @@
|
|||
local QBCore = exports['qb-core']:GetCoreObject()
|
||||
local config = require 'config'
|
||||
local trackedVehicles = {}
|
||||
|
||||
lib.locale()
|
||||
|
@ -53,6 +55,20 @@ local function promptTrackerName(serialNumber, currentName)
|
|||
return true
|
||||
end
|
||||
|
||||
-- Function to check if player is police
|
||||
local function isPlayerPolice()
|
||||
local PlayerData = QBCore.Functions.GetPlayerData()
|
||||
if not PlayerData or not PlayerData.job then return false end
|
||||
|
||||
for _, jobName in pairs(config.policeJobs) do
|
||||
if PlayerData.job.name == jobName then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
-- Events
|
||||
RegisterNetEvent('qb_vehicle_tracker:client:showTrackerMenu', function(citizenid)
|
||||
lib.callback('qb_vehicle_tracker:getPlayerTrackers', false, function(trackers)
|
||||
|
@ -165,16 +181,7 @@ RegisterNetEvent('qb_vehicle_tracker:client:scanTracker', function(slot)
|
|||
}
|
||||
|
||||
-- Add police-only option to get phone number
|
||||
local Player = QBCore.Functions.GetPlayerData()
|
||||
local isPolice = false
|
||||
for _, jobName in pairs(config.policeJobs) do
|
||||
if Player.job.name == jobName then
|
||||
isPolice = true
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if isPolice then
|
||||
if isPlayerPolice() then
|
||||
table.insert(options, {
|
||||
title = locale('vt_get_phone') or "Get Owner's Phone Number",
|
||||
description = locale('vt_get_phone_description') or "Try to extract the owner's phone number",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue