AR/getBanReason: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
Line 17: Line 17:
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function outputBan(ban)
function outputBan(ban)
local banned = getBanNick(ban) -- Get the name of the player who was banned
local banned = getBanNick(ban) -- احضار اسم الشخص المتبند
local banner = getBanAdmin(ban) -- Get the name of the admin who banned the player
local banner = getBanAdmin(ban) -- احضار اسم الادمن الي بنده
local reason = getBanReason(ban) -- Get the reason the player was banned
local reason = getBanReason(ban) -- احضار اسم السبب للباند
outputChatBox("-----BAN-----",getRootElement(),255,0,0)
outputChatBox("-----BAN-----",getRootElement(),255,0,0)
if (banned) then
if (banned) then
outputChatBox("Player banned: "..banned,getRootElement(),255,0,0) -- Output the player name who was banned
outputChatBox("Player banned: "..banned,getRootElement(),255,0,0) -- يحط بالشات اسم المتبند
end
end
if (banner) then
if (banner) then
outputChatBox("Banner: "..banner,getRootElement(),255,0,0) -- Output the admin name who performed the ban
outputChatBox("Banner: "..banner,getRootElement(),255,0,0) -- يجط بالشات اسم الادمن الي بنده
end
end
if (reason) then
if (reason) then
outputChatBox("Reason: "..reason,getRootElement(),255,0,0) -- outputt the reason the player was banned
outputChatBox("Reason: "..reason,getRootElement(),255,0,0) -- يحط بالشات سبب الباند
end
end
end
end
addEventHandler("onBan",getRootElement(),outputBan) -- When a player is banned trigger the outputBan function
addEventHandler("onBan",getRootElement(),outputBan) --وقت بداء الوظيفه و هي لما يتبند شخص
</syntaxhighlight>
</syntaxhighlight>



Revision as of 19:07, 20 October 2012

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

Syntax

string getBanReason ( ban theBan )

Required Arguments

  • theBan: الباند الي تبي احضار سببه

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) -- احضار اسم الشخص المتبند
	local banner = getBanAdmin(ban) -- احضار اسم الادمن الي بنده
	local reason = getBanReason(ban) -- احضار اسم السبب للباند
	outputChatBox("-----BAN-----",getRootElement(),255,0,0)
	if (banned) then
		outputChatBox("Player banned: "..banned,getRootElement(),255,0,0) -- يحط بالشات اسم المتبند
	end
	if (banner) then
		outputChatBox("Banner: "..banner,getRootElement(),255,0,0) -- يجط بالشات اسم الادمن الي بنده
	end
	if (reason) then
		outputChatBox("Reason: "..reason,getRootElement(),255,0,0) -- يحط بالشات سبب الباند
	end
end
addEventHandler("onBan",getRootElement(),outputBan) --وقت بداء الوظيفه و هي لما يتبند شخص

See Also