mirror of
https://github.com/qbcore-fivem/qb-core.git
synced 2026-09-01 02:38:56 +00:00
Fix styling, docs, and a possible bug (#762)
* 🎨 Fix spacing and indentation * 🎨 Use single quotes over backticks * 📝 Fix docs * 🐛 Make replace function clear and extend locales correctly * Revert "🎨 Use single quotes over backticks" * Update config.lua
This commit is contained in:
+20
-20
@@ -3,9 +3,9 @@ QBShared = QBShared or {}
|
||||
local StringCharset = {}
|
||||
local NumberCharset = {}
|
||||
|
||||
for i = 48, 57 do NumberCharset[#NumberCharset+1] = string.char(i) end
|
||||
for i = 65, 90 do StringCharset[#StringCharset+1] = string.char(i) end
|
||||
for i = 97, 122 do StringCharset[#StringCharset+1] = string.char(i) end
|
||||
for i = 48, 57 do NumberCharset[#NumberCharset + 1] = string.char(i) end
|
||||
for i = 65, 90 do StringCharset[#StringCharset + 1] = string.char(i) end
|
||||
for i = 97, 122 do StringCharset[#StringCharset + 1] = string.char(i) end
|
||||
|
||||
function QBShared.RandomStr(length)
|
||||
if length <= 0 then return '' end
|
||||
@@ -22,16 +22,16 @@ function QBShared.SplitStr(str, delimiter)
|
||||
local from = 1
|
||||
local delim_from, delim_to = string.find(str, delimiter, from)
|
||||
while delim_from do
|
||||
result[#result+1] = string.sub(str, from, delim_from - 1)
|
||||
result[#result + 1] = string.sub(str, from, delim_from - 1)
|
||||
from = delim_to + 1
|
||||
delim_from, delim_to = string.find(str, delimiter, from)
|
||||
end
|
||||
result[#result+1] = string.sub(str, from)
|
||||
result[#result + 1] = string.sub(str, from)
|
||||
return result
|
||||
end
|
||||
|
||||
function QBShared.Trim(value)
|
||||
if not value then return nil end
|
||||
if not value then return nil end
|
||||
return (string.gsub(value, '^%s*(.-)%s*$', '%1'))
|
||||
end
|
||||
|
||||
@@ -42,24 +42,24 @@ function QBShared.Round(value, numDecimalPlaces)
|
||||
end
|
||||
|
||||
function QBShared.ChangeVehicleExtra(vehicle, extra, enable)
|
||||
if DoesExtraExist(vehicle, extra) then
|
||||
if enable then
|
||||
SetVehicleExtra(vehicle, extra, false)
|
||||
if not IsVehicleExtraTurnedOn(vehicle, extra) then
|
||||
QBShared.ChangeVehicleExtra(vehicle, extra, enable)
|
||||
end
|
||||
else
|
||||
SetVehicleExtra(vehicle, extra, true)
|
||||
if IsVehicleExtraTurnedOn(vehicle, extra) then
|
||||
QBShared.ChangeVehicleExtra(vehicle, extra, enable)
|
||||
end
|
||||
end
|
||||
end
|
||||
if DoesExtraExist(vehicle, extra) then
|
||||
if enable then
|
||||
SetVehicleExtra(vehicle, extra, false)
|
||||
if not IsVehicleExtraTurnedOn(vehicle, extra) then
|
||||
QBShared.ChangeVehicleExtra(vehicle, extra, enable)
|
||||
end
|
||||
else
|
||||
SetVehicleExtra(vehicle, extra, true)
|
||||
if IsVehicleExtraTurnedOn(vehicle, extra) then
|
||||
QBShared.ChangeVehicleExtra(vehicle, extra, enable)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function QBShared.SetDefaultVehicleExtras(vehicle, config)
|
||||
-- Clear Extras
|
||||
for i = 1,20 do
|
||||
for i = 1, 20 do
|
||||
if DoesExtraExist(vehicle, i) then
|
||||
SetVehicleExtra(vehicle, i, 1)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user