SetBanReason: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "__NOTOC__ {{Server function}} {{Needs_Example}} {{New items|4.0132|1.4| This function set a new reason in the ban. }} ==Syntax== <syntaxhighlight lang="lua"> bool setBanReason( ban t...")
 
No edit summary
Line 1: Line 1:
__NOTOC__  
__NOTOC__  
{{Server function}}
{{Server function}}
{{Needs_Example}}
{{New items|4.0132|1.4|
{{New items|4.0132|1.4|
This function set a new reason in the [[ban]].
This function set a new reason in the [[ban]].
Line 21: Line 20:
==Example==
==Example==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
--TODO
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.")
end
end
end
end
addCommandHandler("setreason",setreason)
</syntaxhighlight>
</syntaxhighlight>


==See Also==
==See Also==
{{Admin_functions}}
{{Admin_functions}}

Revision as of 15:17, 23 July 2014

ADDED/UPDATED IN VERSION 1.4 :

This function set a new reason in the ban.


Syntax

bool setBanReason( ban theBan, string theReason )

Required Arguments

  • theBan: The ban in which you wish to retrieve the username of.
  • theReason: the new reason (max 60 characters)

Returns

Returns true when is changed, false otherwise.

Example

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.")
			end
		end
	end
end
addCommandHandler("setreason",setreason)

See Also