RU/unbanIP: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
Enterprise (talk | contribs)
New page: {{Translate}} {{Server function}} {{Deprecated}} This function will unban the specified IP. ==Syntax== <syntaxhighlight lang="lua"> bool unbanIP ( string ipToUnban, [player unbanningPlayer = nil] ) ...
 
XRAY (talk | contribs)
No edit summary
Line 2: Line 2:
{{Server function}}
{{Server function}}
{{Deprecated}}
{{Deprecated}}
This function will unban the specified IP.
Эта функция исключает из списка банов указанный IP.


==Syntax==  
==Синтаксис==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
bool unbanIP ( string ipToUnban, [player unbanningPlayer = nil] )         
bool unbanIP ( string ipToUnban, [player unbanningPlayer = nil] )         
</syntaxhighlight>  
</syntaxhighlight>  


===Required Arguments===
===Необходимые аргументы===
*'''ipToUnban:''' The IP that should be unbanned.
*'''ipToUnban:''' IP, который нужно разбанить.
===Optional Arguments===
===Опциональные аргументы===
{{OptionalArg}}
{{OptionalArg}}
*'''unbanningPlayer:''' The player who is unbanning the IP. Defaults to nil, meaning no one.
*'''unbanningPlayer:''' Игрок, IP которого удаляется из списка банов. По умолчанию nil, то есть не один.


===Returns===
===Возвращения===
Returns ''true'' if the unban was successful, ''false'' otherwise.
Возвращает ''true'' если операция успешна, ''false'' в противном случае.


==Example==
==Пример==
This example adds a unbanip command for only admins to use (uses a ACL permission check).
Этот пример добавляет администраторам команду unbanip(необходимо добавить разрешение в ACL).
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
addCommandHandler( "unbanip", -- add a command handler to command 'unbanip'
addCommandHandler( "unbanip", -- добавляем команду 'unbanip' в обработчик
   function ( thePlayer, command, ip )
   function ( thePlayer, command, ip )
       if ( hasObjectPermissionTo ( thePlayer, "command.unbanip", false ) ) then -- check if the player has access to the command (specified in ACL)
       if ( hasObjectPermissionTo ( thePlayer, "command.unbanip", false ) ) then -- проверяем, получал ли игрок доступ к команде
         if not ip then outputChatBox( "No IP specified.", thePlayer ) return end -- if no IP was specified, abort command
         if not ip then outputChatBox( "No IP specified.", thePlayer ) return end -- если не введен IP, останавливаем выполнение
         if not findpattern( ip, '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+', 1 ) then outputChatBox( "Given IP is not valid.", thePlayer ) return end -- if IP is not in correct format, abort command
         if not findpattern( ip, '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+', 1 ) then outputChatBox( "Given IP is not valid.", thePlayer ) return end -- if IP is not in correct format, abort command
         local success = unbanIP( ip, thePlayer ) -- see whether the function was a success
         local success = unbanIP( ip, thePlayer ) -- see whether the function was a success

Revision as of 14:52, 20 July 2010

This page requires local translation. If page will remain not translated in reasonable period of time it would be deleted.
After translating the page completely, please remove the ‎{{translate}}‎ tag from the page.

This function is deprecated. This means that its use is discouraged and that it might not exist in future versions, but there should be a more generic way to perform what it does.

Эта функция исключает из списка банов указанный IP.

Синтаксис

bool unbanIP ( string ipToUnban, [player unbanningPlayer = nil] )         

Необходимые аргументы

  • ipToUnban: IP, который нужно разбанить.

Опциональные аргументы

NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use. For more information on optional arguments, see optional arguments.

  • unbanningPlayer: Игрок, IP которого удаляется из списка банов. По умолчанию nil, то есть не один.

Возвращения

Возвращает true если операция успешна, false в противном случае.

Пример

Этот пример добавляет администраторам команду unbanip(необходимо добавить разрешение в ACL).

addCommandHandler( "unbanip", -- добавляем команду 'unbanip' в обработчик
   function ( thePlayer, command, ip )
      if ( hasObjectPermissionTo ( thePlayer, "command.unbanip", false ) ) then -- проверяем, получал ли игрок доступ к команде
         if not ip then outputChatBox( "No IP specified.", thePlayer ) return end -- если не введен IP, останавливаем выполнение
         if not findpattern( ip, '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+', 1 ) then outputChatBox( "Given IP is not valid.", thePlayer ) return end -- if IP is not in correct format, abort command
         local success = unbanIP( ip, thePlayer ) -- see whether the function was a success
         if success then
            outputChatBox( "IP " .. ip .. " succesfully unbanned!", thePlayer ) -- if it was, tell that to player
         else
            outputChatBox( "Unbanning IP " .. ip .. " failed!", thePlayer ) -- if it wasn't, tell that to player
         end
      else
         outputChatBox( "You have no permission to use this command.", thePlayer ) -- tell player that he hasn't got right permission
      end
   end
)

-- specify the findpattern function used in the command handler
function findpattern(text, pattern, start)
	local found = string.find(text, pattern, start)
	if found ~= nil then
		return string.gsub(text, found)
	else return nil end
end

See Also

Серверные функции

  • addBan — блокирует доступ по серийному номеру, IP адресу и / или нику
  • banPlayer — блокирует указанного игрока по серийному номеру, IP адресу и / или нику
  • getBanAdmin — возвращает ник администратора, ответственного за указанную блокировку
  • getBanIP — возвращает заблокированный IP адрес для указанной блокировки
  • getBanNick — возвращает ник заблокированного игрока для указанной блокировки
  • getBanReason — возвращает причину выдачи для указанной блокировки
  • getBans — возвращает таблицу выданных блокировок
  • getBanSerial — возвращает заблокированный серийный номер для указанной блокировки
  • getBanTime — возвращает время в секундах, прошедшее от 1.01.1970 до момента выдачи указанной блокировки
  • getBanUsername — возвращает ник заблокированного игрока для указанной блокировки (устарела)
  • getUnbanTime — возвращает время в секундах, прошедшее от 1.01.1970 до момента снятия указанной блокировки
  • isBan — проверка значение на соответствие типу ban
  • kickPlayer — исключает указанного игрока из игры
  • setBanAdmin — изменяет никнейм ответственного за блокировку администратора
  • setBanNick — изменяет никнейм игрока для указанной блокировки
  • setBanReason — изменяет причину указанной блокировки
  • setUnbanTime — изменяет время разблокировки для указанного игрока
  • removeBan — удаляет указанную блокировку
  • reloadBans — обновление данных о выданных блокировках из файла banlist.xml