⚠️ Major Update ⚠️

- Major cleanup of all files including reformatting & notations
- Added an optional export to add to scripts as an alternative to import.lua
- Added player state to OnPlayerLoaded so no more need for isLoggedIn inside scripts
- Updated all events to the new RegisterNetEvent and got rid of unneeded handlers
- Added the ability for ACE permissions with commands
- Added two new config options for player update interval and status update
- Changed players table to use citizenid column as primary key <-- very important
- Overall sloppy code cleanup, removal of unused code, got rid of nil checks
This commit is contained in:
Kakarot
2021-09-24 22:46:20 -06:00
parent e683b991c6
commit 923f3d3a31
16 changed files with 5283 additions and 5580 deletions
+18 -20
View File
@@ -1,36 +1,34 @@
RegisterServerEvent('QBCore:DebugSomething')
AddEventHandler('QBCore:DebugSomething', function(resource, obj, depth)
print("\x1b[4m\x1b[36m["..resource..":DEBUG]\x1b[0m")
if type(obj) == "string" then
print(string.format("%q", obj))
elseif type(obj) == "table" then
local str = "{"
RegisterServerEvent('QBCore:DebugSomething', function(resource, obj, depth)
print('\x1b[4m\x1b[36m[' .. resource .. ':DEBUG]\x1b[0m')
if type(obj) == 'string' then
print(string.format('%q', obj))
elseif type(obj) == 'table' then
local str = '{'
for k, v in pairs(obj) do
if type(v) == "table" then
if type(v) == 'table' then
for ik, iv in pairs(v) do
str = str.."\n["..k.."] -> ["..ik.."] -> "..tostring(iv)
str = str .. '\n[' .. k .. '] -> [' .. ik .. '] -> ' .. tostring(iv)
end
else
str = str.."\n["..k.."] -> "..tostring(v)
str = str .. '\n[' .. k .. '] -> ' .. tostring(v)
end
end
print(str.."\n}")
print(str .. '\n}')
else
local success, value = pcall(function() return tostring(obj) end)
print((success and value or "<!!error in __tostring metamethod!!>"))
print((success and value or '<!!error in __tostring metamethod!!>'))
end
print("\x1b[4m\x1b[36mEND OF DEBUG\x1b[0m")
print('\x1b[4m\x1b[36mEND OF DEBUG\x1b[0m')
end)
QBCore.Debug = function(resource, obj, depth)
function QBCore.Debug(resource, obj, depth)
TriggerEvent('QBCore:DebugSomething', resource, obj, depth)
end
QBCore.ShowError = function(resource, msg)
print("\x1b[31m["..resource..":ERROR]\x1b[0m "..msg)
function QBCore.ShowError(resource, msg)
print('\x1b[31m[' .. resource .. ':ERROR]\x1b[0m ' .. msg)
end
QBCore.ShowSuccess = function(resource, msg)
print("\x1b[32m["..resource..":LOG]\x1b[0m "..msg)
end
function QBCore.ShowSuccess(resource, msg)
print('\x1b[32m[' .. resource .. ':LOG]\x1b[0m ' .. msg)
end