GetBanNick: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
Line 14: Line 14:
Returns a ''string'' of the nickname if everything was successfull, ''false'' if invalid arguments are specified if there was no nickname specified for the [[ban]] element.
Returns a ''string'' of the nickname if everything was successfull, ''false'' if invalid arguments are specified if there was no nickname specified for the [[ban]] element.


==Example==
==Пример==
<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>


==See Also==
==See Also==
{{Admin functions}}
{{Admin functions}}

Revision as of 15:21, 26 March 2012

This function will return the nickname (nickname that the player had when he was banned) of the specified ban.

Syntax

string getBanNick ( ban theBan )

Required Arguments

  • theBan: The ban element which nickname you want to return.

Returns

Returns a string of the nickname if everything was successfull, false if invalid arguments are specified if there was no nickname specified for the ban element.

Пример

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