getBanReason | Multi Theft Auto: Wiki Skip to content

getBanReason

Client-side
Server-side
Shared

Pair: setBanReason

This function will return the ban reason of the specified ban.

OOP Syntax Help! I don't understand this!

  • Method:ban:getReason(...)
  • Variable: .reason

Syntax

string|false getBanReason ( ​ban theBan )
Required arguments
  • theBan: The ban in which you want to return the reason of.

Returns

Returns a string of the reason if everything was successful, false if invalid arguments are specified if there was no reason specified for the ban.

  • string|false: reason

Code Examples

server
local function outputBan(ban)
local banned = getBanNick(ban) -- Get the name of the player who was banned
local banner = getBanAdmin(ban) -- Get the name of the admin who banned the player
local reason = getBanReason(ban) -- Get the reason the player was banned
outputChatBox("-----BAN-----",root,255,0,0)
if (banned) then
outputChatBox("Player banned: "..banned,root,255,0,0) -- Output the player name who was banned
end
if (banner) then
outputChatBox("Banner: "..banner,root,255,0,0) -- Output the admin name who performed the ban
end
if (reason) then
outputChatBox("Reason: "..reason,root,255,0,0) -- outputt the reason the player was banned
end
end
addEventHandler("onBan", root, outputBan) -- When a player is banned trigger the outputBan function