Skip to content

Commit

Permalink
Whitelisted errors
Browse files Browse the repository at this point in the history
  • Loading branch information
NeenGame committed Dec 17, 2023
1 parent 4a17170 commit fd43e31
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
14 changes: 13 additions & 1 deletion neen-errorlog/client/cl_error.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
RegisterNetEvent('__cfx_internal:serverPrint')
AddEventHandler('__cfx_internal:serverPrint', function(msg)
if (msg == "") then return end
local BlER = CheckForBlacklistedErrors(string.sub(msg, 1, 6))
local str = string.sub(msg, 1, 6)
local BlER = CheckForBlacklistedErrors(str)
local WLER = CheckForWhitelistedErrors(str)
if BlER then return end
if not WLER then return end
local PlayerName = GetPlayerName(PlayerId())
local PlayerId = GetPlayerServerId(PlayerId())
print('[SERVER SIDE ERROR]: \n'..msg)
Expand All @@ -18,4 +21,13 @@ function CheckForBlacklistedErrors(str)
end
end
return false
end

function CheckForWhitelistedErrors(str)
for i=1,#SHERROR.WhiteListedErrors do
if string.match(str, SHERROR.WhiteListedErrors[i]) then
return true
end
end
return false
end
4 changes: 4 additions & 0 deletions neen-errorlog/shared/sh_config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,8 @@ SHERROR = {
'Scan',
'Argume'
},
WhiteListedErrors = {
'SCRI',
'Invoke'
},
}

0 comments on commit fd43e31

Please sign in to comment.