Added checks for 'nocensor' permission (refs #87)

This commit is contained in:
Timo Smit 2019-02-06 12:27:19 +01:00
parent 5109159dca
commit d3dee0e495
2 changed files with 17 additions and 5 deletions

View file

@ -112,6 +112,10 @@ function censor.clear()
end
function censor.onClientConnectAttempt(clientId, firstTime, isBot)
if auth.isPlayerAllowed(clientId, auth.PERM_NOCENSOR) then
return
end
local clientInfo = et.trap_GetUserinfo(clientId)
local censored, censoredName = censor.filterName(et.Info_ValueForKey(clientInfo, "name"))
@ -130,6 +134,10 @@ function censor.onClientConnectAttempt(clientId, firstTime, isBot)
end
function censor.onClientNameChange(clientId, oldName, newName)
if auth.isPlayerAllowed(clientId, auth.PERM_NOCENSOR) then
return
end
local censored, censoredName = censor.filterName(newName)
if censored then

View file

@ -17,6 +17,8 @@
local censor = wolfa_requireModule("admin.censor")
local auth = wolfa_requireModule("auth.auth")
local commands = wolfa_requireModule("commands.commands")
local players = wolfa_requireModule("players.players")
@ -42,6 +44,7 @@ function commandSay(clientId, command, ...)
return true
end
if not auth.isPlayerAllowed(clientId, auth.PERM_NOCENSOR) then
local censored, message = censor.filterMessage(...)
if censored and settings.get("g_censorMode") ~= 0 then
@ -51,6 +54,7 @@ function commandSay(clientId, command, ...)
return true
end
end
if settings.get("fs_game") == "legacy" then
logs.writeChat(clientId, types[command], ...)