-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathserver_hook.lua
More file actions
81 lines (69 loc) · 1.88 KB
/
server_hook.lua
File metadata and controls
81 lines (69 loc) · 1.88 KB
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
if CAS.Framework == "qb" then
QBCore = exports["qb-core"]:GetCoreObject()
else
ESX = exports["es_extended"]:getSharedObject()
end
GetPlayersFw = function()
if CAS.Framework == "qb" then
return QBCore.Functions.GetPlayers()
else
return ESX.GetPlayers()
end
end
GetPlayer = function(player)
if CAS.Framework == "qb" then
return QBCore.Functions.GetPlayer(player)
else
return ESX.GetPlayerFromId(player)
end
end
GetJob = function(player)
if CAS.Framework == "qb" then
return player.PlayerData.job
else
return player.getJob()
end
end
GetGrade = function(player)
if CAS.Framework == "qb" then
return player.PlayerData.job.grade.name
else
return player.getJob().grade_name
end
end
GetSource = function(player)
if CAS.Framework == "qb" then
return player.PlayerData.source
else
return player.source
end
end
GetPlayerRName = function(player)
local xPlayer = GetPlayer(player)
if CAS.Framework == "qb" then
return xPlayer.PlayerData.charinfo.firstname.." "..xPlayer.PlayerData.charinfo.lastname
else
return xPlayer.getName()
end
end
CreateThread(function()
if CAS.Framework == "qb" then
QBCore.Functions.CreateUseableItem("bodycam",function(source)
if source ~= 0 then
TriggerClientEvent("useBodycam",source)
end
end)
else
ESX.RegisterUsableItem('bodycam', function(playerId)
TriggerClientEvent("useBodycam",playerId)
end)
end
end)
Notify = function (src,text)
if CAS.Framework == "qb" then
return TriggerClientEvent("QBCore:Notify", src, text)
else
local xPlayer = GetPlayer(src)
return xPlayer.showNotification(text)
end
end