Merge pull request #809 from Spudgun/main

feat: new FirstToUpper and tweak of HasPermissions functions
This commit is contained in:
Stan
2022-08-25 08:50:56 +01:00
committed by GitHub
2 changed files with 13 additions and 1 deletions
+8 -1
View File
@@ -357,7 +357,14 @@ end
function QBCore.Functions.HasPermission(source, permission)
local src = source
if IsPlayerAceAllowed(src, permission) then return true end
if type(permission) == "string" then
if IsPlayerAceAllowed(src, permission) then return true end
elseif type(permission) == "table" then
for _, permLevel in pairs(permission) do
if IsPlayerAceAllowed(src, permLevel) then return true end
end
end
return false
end
+5
View File
@@ -35,6 +35,11 @@ function QBShared.Trim(value)
return (string.gsub(value, '^%s*(.-)%s*$', '%1'))
end
function QBShared.FirstToUpper(value)
if not value then return nil end
return (value:gsub("^%l", string.upper))
end
function QBShared.Round(value, numDecimalPlaces)
if not numDecimalPlaces then return math.floor(value + 0.5) end
local power = 10 ^ numDecimalPlaces