mirror of
https://github.com/qbcore-fivem/qb-core.git
synced 2026-08-29 01:08:57 +00:00
⚠️ 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:
+18
-20
@@ -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
|
||||
Reference in New Issue
Block a user