getBanIP | Multi Theft Auto: Wiki Skip to content

getBanIP

Client-side
Server-side
Shared

This function will return the IP of the specified ban.

OOP Syntax Help! I don't understand this!

  • Method: ban:getIP(...)
  • Variable: .ip

Syntax

string|false getBanIP ( ban theBan )
Required Arguments
  • theBan: The ban in which you want to return the IP of.

Returns

  • string|false: ip

Returns a string of the IP if everything was successful, false if invalid arguments are specified if there was no IP specified for the ban.

Code Examples

server

This example will show the user who banned a player the IP adress of that banned player.

local function banPlayerCommand(thisPlayer, commandName, bannedName, reason)
if (hasObjectPermissionTo(thisPlayer, "function.banPlayer")) then -- If the command user has the rights
local bannedPlayer = getPlayerFromName(bannedName) -- Get player by name
if (bannedPlayer) then
local theBan = banPlayer(bannedPlayer, true, false, true, thisPlayer, reason) -- Ban the player
outputChatBox("ban: " .. bannedName .. " successfully banned", thisPlayer) -- Send the banner a succes message
outputChatBox("At IP Adress: " ..getBanIP(theBan), thisPlayer) -- And send him the IP adress of the banned player
else
outputChatBox("Player "..bannedName." not found", thisPlayer)
end
else
outputChatBox("ban: You don't have enough permissions", thisPlayer) -- If the command user doesn't have the permissions
end
end
addCommandHandler("ban", banPlayerCommand)