GetBanNick: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
(Added oop syntax)
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
__NOTOC__  
__NOTOC__  
{{Server function}}
{{Server function}}
Эта функция возвращает ник заблокированного игрока через [[ban]].
This function will return the nickname (nickname that the player had when he was banned) of the specified [[ban]].


==Синтаксис==  
==Syntax==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
string getBanNick ( ban theBan )
string getBanNick ( ban theBan )
</syntaxhighlight>
</syntaxhighlight>


===Обязательный аргумент===
{{OOP||[[ban]]:getNick|nick|setBanNick}}
*'''theBan:''' [[ban]] элемент, ник которого вы хотите вернуть.


===Возвращение===
===Required Arguments===
Возвращает ник, если все было правильно, ''Неправильно'' если указаны неверные аргументы , либо не было ника, указанного для запрета элемента [[ban]].
*'''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.
 
==Example==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function outputBan(ban)
function outputBan(ban)
local banned = getBanNick(ban) -- Получить имя игрока, который был забанен
local banned = getBanNick(ban) -- Get the name of the player who was banned
local banner = getBanAdmin(ban) -- Получить имя администратора, который забанил игрока
local banner = getBanAdmin(ban) -- Get the name of the admin who banned the player
local reason = getBanReason(ban) -- Получить причину бана  игрока
local reason = getBanReason(ban) -- Get the reason the player was banned
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) -- Удаление данных игрока, который был забанен
outputChatBox("Player banned: "..banned,getRootElement(),255,0,0) -- Output the player name who was banned
end
end
if (banner) then
if (banner) then
outputChatBox("Banner: "..banner,getRootElement(),255,0,0) -- Удаление данных администратора, который забанил игрока
outputChatBox("Banner: "..banner,getRootElement(),255,0,0) -- Output the admin name who performed the ban
end
end
if (reason) then
if (reason) then
outputChatBox("Reason: "..reason,getRootElement(),255,0,0) -- Удаление причины по которой был забанен игрок
outputChatBox("Reason: "..reason,getRootElement(),255,0,0) -- outputt the reason the player was banned
end
end
end
end
addEventHandler("onBan",getRootElement(),outputBan)  
addEventHandler("onBan",getRootElement(),outputBan) -- When a player is banned trigger the outputBan function
</syntaxhighlight>
</syntaxhighlight>


==См. также==
==See Also==
{{Admin functions}}
{{Admin functions}}

Latest revision as of 15:22, 6 August 2016

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

Syntax

string getBanNick ( ban theBan )


OOP Syntax Help! I don't understand this!

Method: ban:getNick(...)
Variable: .nick
Counterpart: setBanNick


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.

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