forked from Project-Sloth/ps-mdt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.lua
51 lines (42 loc) · 1.13 KB
/
utils.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
local QBCore = exports['qb-core']:GetCoreObject()
function GetPlayerData(source)
local Player = QBCore.Functions.GetPlayer(source)
return Player.PlayerData
end
function UnpackJob(data)
local job = {
name = data.name,
label = data.label
}
local grade = {
name = data.grade.name,
}
return job, grade
end
function PermCheck(src, PlayerData)
local result = true
if not Config.AllowedJobs[PlayerData.job.name] then
print(("UserId: %s(%d) tried to access the mdt even though they are not authorised (server direct)"):format(GetPlayerName(src), src))
result = false
end
return result
end
function ProfPic(gender, profilepic)
if profilepic then return profilepic end;
if gender == "f" then return "img/female.png" end;
return "img/male.png"
end
function IsJobAllowedToMDT(job)
if Config.PoliceJobs[job] then
return true
elseif Config.AmbulanceJobs[job] then
return true
elseif Config.DojJobs[job] then
return true
else
return false
end
end
function GetNameFromPlayerData(PlayerData)
return ('%s %s'):format(PlayerData.charinfo.firstname, PlayerData.charinfo.lastname)
end