-
Notifications
You must be signed in to change notification settings - Fork 1
/
client.lua
141 lines (120 loc) · 5.2 KB
/
client.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
QBCore = nil
Citizen.CreateThread(function()
while true do
Citizen.Wait(10)
if QBCore == nil then
TriggerEvent('QBCore:GetObject', function(obj) QBCore = obj end)
Citizen.Wait(200)
end
end
end)
local isLoggedIn = false
local AlertActive = false
PlayerData = {}
PlayerJob = {}
-- Code
Citizen.CreateThread(function()
Wait(100)
if QBCore.Functions.GetPlayerData() ~= nil then
PlayerData = QBCore.Functions.GetPlayerData()
PlayerJob = PlayerData.job
end
end)
RegisterNetEvent('QBCore:Client:OnJobUpdate')
AddEventHandler('QBCore:Client:OnJobUpdate', function(JobInfo)
PlayerJob = JobInfo
if JobInfo.name == "police" or JobInfo.name == "police1" or JobInfo.name == "police2" or JobInfo.name == "police3" or JobInfo.name == "police4" or JobInfo.name == "police5" or JobInfo.name == "police6" or JobInfo.name == "police7" or JobInfo.name == "police8" then
if PlayerJob.onduty then
PlayerJob.onduty = false
end
end
PlayerJob.onduty = true
end)
RegisterNetEvent('QBCore:Client:OnPlayerLoaded')
AddEventHandler('QBCore:Client:OnPlayerLoaded', function()
isLoggedIn = true
PlayerData = QBCore.Functions.GetPlayerData()
PlayerJob = QBCore.Functions.GetPlayerData().job
end)
RegisterNetEvent('qb-policealerts:ToggleDuty')
AddEventHandler('qb-policealerts:ToggleDuty', function(Duty)
PlayerJob.onduty = Duty
end)
RegisterNetEvent('qb-policealerts:client:AddPoliceAlert')
AddEventHandler('qb-policealerts:client:AddPoliceAlert', function(data, forBoth)
if forBoth then
if (PlayerJob.name == "police" or PlayerJob.name == "police1" or PlayerJob.name == "police2" or PlayerJob.name == "police3" or PlayerJob.name == "police4" or PlayerJob.name == "police5" or PlayerJob.name == "police6" or PlayerJob.name == "police7" or PlayerJob.name == "police8" or PlayerJob.name == "ems" or PlayerJob.name == "ems1" or PlayerJob.name == "ems2" or PlayerJob.name == "ems3" or PlayerJob.name == "ems4" or PlayerJob.name == "ems5" or PlayerJob.name == "ems6" or PlayerJob.name == "ems7" or PlayerJob.name == "ems8") and PlayerJob.onduty then
if data.alertTitle == "Assistance collegue" or data.alertTitle == "Assistence ambulance" or data.alertTitle == "Assistence Doctor" then
TriggerServerEvent("InteractSound_SV:PlayOnSource", "emergency", 0.7)
else
PlaySound(-1, "Event_Start_Text", "GTAO_FM_Events_Soundset", 0, 0, 1)
end
data.callSign = data.callSign ~= nil and data.callSign or PlayerData.metadata["callsign"]
data.alertId = math.random(11111, 99999)
SendNUIMessage({
action = "add",
data = data,
})
end
else
if (PlayerJob.name == "police" or PlayerJob.name == "police1" or PlayerJob.name == "police2" or PlayerJob.name == "police3" or PlayerJob.name == "police4" or PlayerJob.name == "police5" or PlayerJob.name == "police6" or PlayerJob.name == "police7" or PlayerJob.name == "police8") and PlayerJob.onduty then
if data.alertTitle == "Assistance collegue" or data.alertTitle == "Assistence ambulance" or data.alertTitle == "Assistence Doctor" then
TriggerServerEvent("InteractSound_SV:PlayOnSource", "emergency", 0.7)
else
PlaySound(-1, "Event_Start_Text", "GTAO_FM_Events_Soundset", 0, 0, 1)
end
data.callSign = data.callSign ~= nil and data.callSign or PlayerData.metadata["callsign"]
data.alertId = math.random(11111, 99999)
SendNUIMessage({
action = "add",
data = data,
})
end
end
AlertActive = true
SetTimeout(data.timeOut, function()
AlertActive = false
end)
end)
Citizen.CreateThread(function()
while true do
if AlertActive then
if IsControlJustPressed(0, Keys["LEFTALT"]) then
SetNuiFocus(true, true)
SetNuiFocusKeepInput(true, false)
SetCursorLocation(0.965, 0.12)
MouseActive = true
end
end
if MouseActive then
if IsControlJustReleased(0, Keys["LEFTALT"]) then
SetNuiFocus(false, false)
SetNuiFocusKeepInput(false, false)
MouseActive = false
end
end
Citizen.Wait(6)
end
end)
RegisterNUICallback('SetWaypoint', function(data)
local coords = data.coords
SetNewWaypoint(coords.x, coords.y)
QBCore.Functions.Notify('GPS ingesteld!')
SetNuiFocus(false, false)
SetNuiFocusKeepInput(false, false)
MouseActive = false
end)
-- Citizen.CreateThread(function()
-- Wait(500)
-- local ped = GetPlayerPed(-1)
-- local veh = GetVehiclePedIsIn(ped)
-- exports["vstancer"]:SetVstancerPreset(veh, -0.8, 0.0, -0.8, 0.0)
-- end)
-- #The max value you can increase or decrease the front Track Width
-- frontMaxOffset=0.25
-- #The max value you can increase or decrease the front Camber
-- frontMaxCamber=0.20
-- #The max value you can increase or decrease the rear Track Width
-- rearMaxOffset=0.25
-- #The max value you can increase or decrease the rear Camber
-- rearMaxCamber=0.20