AR/getBanIP: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
Line 9: Line 9:


===Required Arguments===  
===Required Arguments===  
*'''theBan:''' The [[ban]] in which you want to return the IP of.
*'''theBan:''' الباند الي تبي تجيب الاي بي حقه


===Returns===
===Returns===

Revision as of 17:39, 21 October 2012

This function will return the IP of the specified ban.

Syntax

string getBanIP ( ban theBan )

Required Arguments

  • theBan: الباند الي تبي تجيب الاي بي حقه

Returns

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.

Example

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

function banPlayerCommand ( thisPlayer, commandName, bannedName, reason )
    if ( hasObjectPermissionTo ( thisPlayer, "function.banPlayer" ) ) then -- If the command user has the rights
        local bannedPlayer = getPlayerFromNick ( bannedName ) -- Get the ID from the player who gets banned
        if getElementType ( bannedPlayer ) == "player" then -- If it's a player
            local theBan = banPlayer ( bannedPlayer, 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
        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 )

See Also