diff --git a/server/admin_server.lua b/server/admin_server.lua index 43bd9cb7..71c47440 100644 --- a/server/admin_server.lua +++ b/server/admin_server.lua @@ -946,8 +946,30 @@ Citizen.CreateThread(function() updateBan(blacklisted.banid,newBanData) -- send it off! end PrintDebugMessage("Connection of "..getName(player).." Declined, Banned for "..blacklist[bi].reason..", Ban ID: "..blacklist[bi].banid.."\n", 3) - deferrals.done(string.format( GetLocalisedText("bannedjoin"), blacklist[bi].reason, formatDateString(blacklist[bi].expire), blacklist[bi].banid)) + + local banMessageTitleColour = GetConvar("ea_banMessageTitleColour", "#354557") + local banMessageServerName = GetConvar("ea_banMessageServerName", "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.") + + if banMessageShowStaff == "false" then + banMessageStaffName = 'Server Staff' + end + + local banMessageReason = getStringUntilSuffix(blacklist[bi].reason, ", Banned by:") + -- 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( + '

' .. banMessageServerName .. '


'.. banMessageSubHeader ..'


Expires: ' .. + formatDateString(blacklist[bi].expire) .. '
Banned By: ' .. banMessageStaffName .. + '
Ban Reason: ' .. banMessageReason .. + '
Ban ID: ' .. + blacklist[bi].banid .. + '

' .. banMessageFooter .. '

') return + end end end diff --git a/shared/util_shared.lua b/shared/util_shared.lua index 7ce0c618..4f5bfb79 100644 --- a/shared/util_shared.lua +++ b/shared/util_shared.lua @@ -329,6 +329,15 @@ function mergeTables(t1, t2) return t end +-- used to get raw ban reason +function getStringUntilSuffix(inputStr, suffix) + local endPos = string.find(inputStr, suffix) + if endPos then + return string.sub(inputStr, 1, endPos-1) + else + return inputStr + end +end -- terrible function to look for URLs in a string function matchURL(text_with_URLs)