GetBanReason: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (Needs example)
(Added oop syntax)
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
__NOTOC__  
__NOTOC__  
{{Server function}}
{{Server function}}
This function will return the ban reason of the specified [[ban]] pointer.
This function will return the ban reason of the specified [[ban]].


==Syntax==  
==Syntax==  
Line 7: Line 7:
string getBanReason ( ban theBan )
string getBanReason ( ban theBan )
</syntaxhighlight>
</syntaxhighlight>
{{OOP||[[ban]]:getReason|reason|setBanReason}}


===Required Arguments===  
===Required Arguments===  
Line 16: Line 18:
==Example==
==Example==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
--TODO
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-----",getRootElement(),255,0,0)
if (banned) then
outputChatBox("Player banned: "..banned,getRootElement(),255,0,0) -- Output the player name who was banned
end
if (banner) then
outputChatBox("Banner: "..banner,getRootElement(),255,0,0) -- Output the admin name who performed the ban
end
if (reason) then
outputChatBox("Reason: "..reason,getRootElement(),255,0,0) -- outputt the reason the player was banned
end
end
addEventHandler("onBan",getRootElement(),outputBan) -- When a player is banned trigger the outputBan function
</syntaxhighlight>
</syntaxhighlight>


==See Also==
==See Also==
{{Admin functions}}
{{Admin functions}}
[[Category:Needs Example]]
[[ru:getBanReason]]

Latest revision as of 15:23, 6 August 2016

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

Syntax

string getBanReason ( ban theBan )


OOP Syntax Help! I don't understand this!

Method: ban:getReason(...)
Variable: .reason
Counterpart: setBanReason


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.

Example

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-----",getRootElement(),255,0,0)
	if (banned) then
		outputChatBox("Player banned: "..banned,getRootElement(),255,0,0) -- Output the player name who was banned
	end
	if (banner) then
		outputChatBox("Banner: "..banner,getRootElement(),255,0,0) -- Output the admin name who performed the ban
	end
	if (reason) then
		outputChatBox("Reason: "..reason,getRootElement(),255,0,0) -- outputt the reason the player was banned
	end
end
addEventHandler("onBan",getRootElement(),outputBan) -- When a player is banned trigger the outputBan function

See Also