Skip to content

Commit

Permalink
tweak(server/admin_server) extract ban reason dynamically (works with…
Browse files Browse the repository at this point in the history
… diff languages)
  • Loading branch information
Gravxd committed Jan 30, 2024
1 parent ff679a6 commit 791be45
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions server/admin_server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -948,7 +948,8 @@ Citizen.CreateThread(function()
PrintDebugMessage("Connection of "..getName(player).." Declined, Banned for "..blacklist[bi].reason..", Ban ID: "..blacklist[bi].banid.."\n", 3)

local banMessageTitleColour = GetConvar("ea_banMessageTitleColour", "#354557")
local banMessageServerName = GetConvar("ea_banMessageServerName", GetConvar("sv_projectName", "EasyAdmin")) local banMessageShowStaff = GetConvar("ea_banMessageShowStaff", "true")
local banMessageServerName = GetConvar("ea_banMessageServerName", GetConvar("sv_projectName", "EasyAdmin"))
local banMessageShowStaff = GetConvar("ea_banMessageShowStaff", "true")
local banMessageStaffName = blacklist[bi].banner
local banMessageFooter = GetConvar("ea_banMessageFooter", "You can appeal this by ban by visiting our discord.")
local banMessageSubHeader = GetConvar("ea_banMessageSubHeader", "You have been banned from this server.")
Expand All @@ -958,7 +959,7 @@ Citizen.CreateThread(function()
banMessageStaffName = 'Server Staff'
end

local banMessageReason = getStringUntilSuffix(blacklist[bi].reason, ", Banned by:")
local banMessageReason = getRawBanReason(blacklist[bi].reason, GetLocalisedText("bansuffix"))
-- gives us a raw ban reason with their nickname as we don't want the staff member displayed due to our new convar // "banned by:" field

deferrals.done(
Expand Down
2 changes: 1 addition & 1 deletion shared/util_shared.lua
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ function mergeTables(t1, t2)
end

-- used to get raw ban reason
function getStringUntilSuffix(inputStr, suffix)
function getRawBanReason(inputStr, suffix)
local endPos = string.find(inputStr, suffix)
if endPos then
return string.sub(inputStr, 1, endPos-1)
Expand Down

0 comments on commit 791be45

Please sign in to comment.