forked from Simnation/Main
ed
This commit is contained in:
parent
a730434314
commit
109cfdabcc
91 changed files with 167 additions and 852 deletions
41
resources/[tools]/dc_propattach/server/sv_main.lua
Normal file
41
resources/[tools]/dc_propattach/server/sv_main.lua
Normal file
|
@ -0,0 +1,41 @@
|
|||
local QBCore, ESX = nil, nil
|
||||
|
||||
CreateThread(function()
|
||||
if Config.Framework == "qb" then
|
||||
QBCore = exports['qb-core']:GetCoreObject()
|
||||
elseif Config.Framework == "esx" then
|
||||
ESX = exports["es_extended"]:getSharedObject()
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNetEvent('dc_propattach:server:checkAdmin', function()
|
||||
local src = source
|
||||
local canUse = false
|
||||
if not Config.OnlyAdmins then
|
||||
canUse = true
|
||||
else
|
||||
if Config.Framework == "qb" then
|
||||
if QBCore then
|
||||
local Player = QBCore.Functions.GetPlayer(source)
|
||||
if Player then
|
||||
if QBCore.Functions.HasPermission(src, 'admin') or QBCore.Functions.HasPermission(src, 'god') then
|
||||
canUse = true
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif Config.Framework == "esx" then
|
||||
if ESX then
|
||||
local xPlayer = ESX.GetPlayerFromId(src)
|
||||
if xPlayer then
|
||||
local playerGroup = xPlayer.getGroup()
|
||||
if playerGroup == "admin" or playerGroup == "superadmin" then
|
||||
canUse = true
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif Config.Framework == "none" then
|
||||
canUse = true
|
||||
end
|
||||
end
|
||||
TriggerClientEvent('dc_propattach:client:admincheck', src, canUse)
|
||||
end)
|
Loading…
Add table
Add a link
Reference in a new issue