hof-errors/client/cl_main.lua
2025-02-24 17:04:19 -06:00

32 lines
1003 B
Lua

local _trace = Citizen.Trace
local errorWords = {"failure", "error", "not", "failed", "not safe", "invalid", "cannot", ".lua", "server", "client", "attempt", "traceback", "stack", "function"}
function error(...)
local resource = GetCurrentResourceName()
print(string.format("----- RESOURCE ERROR -----"))
print(...)
print(string.format("------ PLEASE REPORT THIS TO STAFF ------"))
print(string.format("------ IDEALLY WITH CLIPS & SCREENSHOTS OF WHAT YOU'RE DOING ------"))
TriggerServerEvent("Error:Server:Report", resource, ...)
end
---@diagnostic disable-next-line: duplicate-set-field
function Citizen.Trace(...)
if type(...) == "string" then
local args = string.lower(...)
for _, word in ipairs(errorWords) do
if string.find(args, word) then
error(...)
return
end
end
end
_trace(...)
end
RegisterCommand('error:trigger', function()
local math = 1 + nil
print(math)
end)