SetBanReason: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
(Added oop syntax)
Line 9: Line 9:
bool setBanReason( ban theBan, string theReason )
bool setBanReason( ban theBan, string theReason )
</syntaxhighlight>  
</syntaxhighlight>  
{{OOP||[[ban]]:setReason|reason|getBanReason}}


===Required Arguments===  
===Required Arguments===  

Revision as of 15:24, 6 August 2016

This function sets new reason for a ban.

Syntax

bool setBanReason( ban theBan, string theReason )


OOP Syntax Help! I don't understand this!

Method: ban:setReason(...)
Variable: .reason
Counterpart: getBanReason


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