From 1dde82348635b5ef6eb23c93d9642642086a6042 Mon Sep 17 00:00:00 2001 From: Spudgun Date: Tue, 23 Aug 2022 19:53:06 +1200 Subject: [PATCH 1/2] feat: first character of word to uppercase function --- shared/main.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/shared/main.lua b/shared/main.lua index 3eb8f61..6b09b12 100644 --- a/shared/main.lua +++ b/shared/main.lua @@ -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 From c61d0b204e88e13c7413a3e53f48584742f0480c Mon Sep 17 00:00:00 2001 From: Spudgun Date: Wed, 24 Aug 2022 18:57:53 +1200 Subject: [PATCH 2/2] tweak: HasPermissions accept both string and table Enables single and multiple permission checks --- server/functions.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/server/functions.lua b/server/functions.lua index 045e6fc..08aa696 100644 --- a/server/functions.lua +++ b/server/functions.lua @@ -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