-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathclient.lua
More file actions
72 lines (70 loc) · 1.88 KB
/
client.lua
File metadata and controls
72 lines (70 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
-----------------------
--- DiscordPedPerms ---
-----------------------
restrictedPeds = {
{}, -- Trusted Civ (1)
{}, -- Donator (2)
{
"mickeymouse",
"deadpool",
"kermit",
"blackpanther",
}, -- Personal (3)
}
allowedPed = "xxxtentacion"
alreadyRan = false
isAllowed = {}
RegisterNetEvent('DiscordPedPerms:CheckPerms:Return')
AddEventHandler('DiscordPedPerms:CheckPerms:Return', function(hasPerms)
isAllowed = hasPerms
end)
function has_value (tab, val)
for index, value in ipairs(tab) do
if value == val then
return true
end
end
return false
end
Citizen.CreateThread(function()
while true do
Citizen.Wait(2000)
local ped = GetPlayerPed(-1)
local modelhashed = GetHashKey(allowedPed)
-- Request the model, and wait further triggering untill fully loaded.
RequestModel(modelhashed)
while not HasModelLoaded(modelhashed) do
RequestModel(modelhashed)
Citizen.Wait(0)
end
if not alreadyRan then
TriggerServerEvent('DiscordPedPerms:CheckPerms')
alreadyRan = true
end
for i = 1, #restrictedPeds do
for j = 1, #restrictedPeds[i] do
if IsPedModel(ped, GetHashKey(tostring(restrictedPeds[i][j]))) then
-- They can't use that ped
if not has_value(isAllowed, i) then
SetPlayerModel(PlayerId(), modelhashed)
SetModelAsNoLongerNeeded(modelHashed)
DisplayNotification('~r~RESTRICTED PED')
end
end
end
--[[
if IsPedModel(ped, GetHashKey(restrictedPeds[i])) then
-- They can't use that ped
SetPlayerModel(PlayerId(), modelhashed)
SetModelAsNoLongerNeeded(modelHashed)
DisplayNotification('~r~RESTRICTED PED')
end
--]]--
end
end
end)
function DisplayNotification( text )
SetNotificationTextEntry( "STRING" )
AddTextComponentString( text )
DrawNotification( false, false )
end