-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.lua
More file actions
31 lines (25 loc) · 932 Bytes
/
Copy pathserver.lua
File metadata and controls
31 lines (25 loc) · 932 Bytes
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
--[[
Vehicle Spawner v2.0
Author: choda
]]
-- Returns the list of category names this player is allowed to see,
-- honoring each category's optional per-category `permission` field.
local function GetAllowedCategories(src)
local allowed = {}
for category, data in pairs(Config.Vehicles) do
if not Config.UsePermissions or not data.permission or IsPlayerAceAllowed(src, data.permission) then
allowed[#allowed + 1] = category
end
end
table.sort(allowed)
return allowed
end
RegisterNetEvent('vehiclespawner:requestOpen', function()
local src = source
local allowedCategories = GetAllowedCategories(src)
if #allowedCategories == 0 then
TriggerClientEvent('vehiclespawner:notify', src, 'You do not have permission to use the vehicle spawner.', 'error')
return
end
TriggerClientEvent('vehiclespawner:openMenu', src, allowedCategories)
end)