mirror of
https://github.com/qbcore-fivem/qb-core.git
synced 2026-09-04 17:23:31 +00:00
Merge pull request #821 from thelindat/main
Resolve UI lag / blocking events
This commit is contained in:
+12
-15
@@ -308,25 +308,23 @@ end
|
|||||||
-- Setting & Removing Permissions
|
-- Setting & Removing Permissions
|
||||||
|
|
||||||
function QBCore.Functions.AddPermission(source, permission)
|
function QBCore.Functions.AddPermission(source, permission)
|
||||||
local src = source
|
if not IsPlayerAceAllowed(source, permission) then
|
||||||
local license = QBCore.Functions.GetIdentifier(src, 'license')
|
ExecuteCommand(('add_principal player.%s qbcore.%s'):format(source, permission))
|
||||||
ExecuteCommand(('add_principal identifier.%s qbcore.%s'):format(license, permission))
|
QBCore.Commands.Refresh(source)
|
||||||
QBCore.Commands.Refresh(src)
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function QBCore.Functions.RemovePermission(source, permission)
|
function QBCore.Functions.RemovePermission(source, permission)
|
||||||
local src = source
|
|
||||||
local license = QBCore.Functions.GetIdentifier(src, 'license')
|
|
||||||
if permission then
|
if permission then
|
||||||
if IsPlayerAceAllowed(src, permission) then
|
if IsPlayerAceAllowed(source, permission) then
|
||||||
ExecuteCommand(('remove_principal identifier.%s qbcore.%s'):format(license, permission))
|
ExecuteCommand(('remove_principal player.%s qbcore.%s'):format(source, permission))
|
||||||
QBCore.Commands.Refresh(src)
|
QBCore.Commands.Refresh(source)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
for _, v in pairs(QBCore.Config.Server.Permissions) do
|
for _, v in pairs(QBCore.Config.Server.Permissions) do
|
||||||
if IsPlayerAceAllowed(src, v) then
|
if IsPlayerAceAllowed(source, v) then
|
||||||
ExecuteCommand(('remove_principal identifier.%s qbcore.%s'):format(license, v))
|
ExecuteCommand(('remove_principal player.%s qbcore.%s'):format(source, v))
|
||||||
QBCore.Commands.Refresh(src)
|
QBCore.Commands.Refresh(source)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -335,12 +333,11 @@ end
|
|||||||
-- Checking for Permission Level
|
-- Checking for Permission Level
|
||||||
|
|
||||||
function QBCore.Functions.HasPermission(source, permission)
|
function QBCore.Functions.HasPermission(source, permission)
|
||||||
local src = source
|
|
||||||
if type(permission) == "string" then
|
if type(permission) == "string" then
|
||||||
if IsPlayerAceAllowed(src, permission) then return true end
|
if IsPlayerAceAllowed(source, permission) then return true end
|
||||||
elseif type(permission) == "table" then
|
elseif type(permission) == "table" then
|
||||||
for _, permLevel in pairs(permission) do
|
for _, permLevel in pairs(permission) do
|
||||||
if IsPlayerAceAllowed(src, permLevel) then return true end
|
if IsPlayerAceAllowed(source, permLevel) then return true end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
+1
-4
@@ -183,13 +183,10 @@ function QBCore.Player.CreatePlayer(PlayerData, Offline)
|
|||||||
self.PlayerData = PlayerData
|
self.PlayerData = PlayerData
|
||||||
self.Offline = Offline
|
self.Offline = Offline
|
||||||
|
|
||||||
function self.Functions.UpdatePlayerData(dontUpdateChat)
|
function self.Functions.UpdatePlayerData()
|
||||||
if self.Offline then return end -- Unsupported for Offline Players
|
if self.Offline then return end -- Unsupported for Offline Players
|
||||||
TriggerEvent('QBCore:Player:SetPlayerData', self.PlayerData)
|
TriggerEvent('QBCore:Player:SetPlayerData', self.PlayerData)
|
||||||
TriggerClientEvent('QBCore:Player:SetPlayerData', self.PlayerData.source, self.PlayerData)
|
TriggerClientEvent('QBCore:Player:SetPlayerData', self.PlayerData.source, self.PlayerData)
|
||||||
if not dontUpdateChat then
|
|
||||||
QBCore.Commands.Refresh(self.PlayerData.source)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function self.Functions.SetJob(job, grade)
|
function self.Functions.SetJob(job, grade)
|
||||||
|
|||||||
Reference in New Issue
Block a user