SetBanReason: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Server function}} | {{Server function}} | ||
{{New items| | {{New items|3.0140|1.4| | ||
This function | This function sets new reason for a [[ban]]. | ||
}} | }} | ||
Line 12: | Line 12: | ||
===Required Arguments=== | ===Required Arguments=== | ||
*'''theBan:''' The [[ban]] | *'''theBan:''' The [[ban]] that you wish to set the reason of. | ||
*'''theReason:''' the new reason (max 60 characters) | *'''theReason:''' the new reason (max 60 characters). | ||
===Returns=== | ===Returns=== | ||
Returns ''true'' | Returns ''true'' if the new reason was set successfully, ''false'' otherwise. | ||
==Example== | ==Example== | ||
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.'' | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function | function setReason (player,cmd,name,...) | ||
local reason = table.concat({...}," ") | local reason = table.concat({...}," ") | ||
if name and reason then | if name and reason then | ||
Line 32: | Line 33: | ||
end | end | ||
end | end | ||
addCommandHandler("setreason", | addCommandHandler("setreason", setReason) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{Admin_functions}} | {{Admin_functions}} |
Revision as of 22:02, 30 July 2014
This function sets new reason for a ban.
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 60 characters).
Returns
Returns true if the new reason was set successfully, false otherwise.
Example
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.
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)
See Also
- addBan
- banPlayer
- getBanAdmin
- getBanIP
- getBanNick
- getBanReason
- getBanSerial
- getBanTime
- getBanUsername
- getBans
- getUnbanTime
- isBan
- kickPlayer
- setBanAdmin
- setBanNick
- setBanReason
- setUnbanTime
- reloadBans
- removeBan