setBanReason | Multi Theft Auto: Wiki Skip to content

setBanReason

Client-side
Server-side
Shared

Pair: getBanReason

This function sets the reason for the specified ban.

OOP Syntax Help! I don't understand this!

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

Syntax

bool setBanReason ( ban theBan, string theReason )
Required Arguments
  • theBan: The ban that you wish to set the reason of.
  • theReason: The new reason (max 125 characters).

Returns

  • bool: result

Returns true if the new reason was set successfully, false otherwise.

Code Examples

server

This example adds the command setreason which can be used to change the reason of a ban by nickname of the banned player. For example: setreason someguy reason.

local function setReason (player,cmd,name,...)
local reason = table.concat({...}," ")
if (name and reason) then
local bans = getBans()
for i,v in ipairs(bans)do
if (getBanNick(v) == name) then
setBanReason(v,reason)
outputChatBox("Successfully edited the new Ban Reason.",player,0,125,0)
end
end
end
end
addCommandHandler("setreason", setReason)