AR/getBanIP: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
Line 14: Line 14:
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]].
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.
This example will show the user who banned a player the IP adress of that banned player.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function banPlayerCommand ( thisPlayer, commandName, bannedName, reason )
function banPlayerCommand ( thisPlayer, commandName, bannedName, reason )
     if ( hasObjectPermissionTo ( thisPlayer, "function.banPlayer" ) ) then -- If the command user has the rights
     if ( hasObjectPermissionTo ( thisPlayer, "function.banPlayer" ) ) then -- اذا كانت الكلمه صحيحه
         local bannedPlayer = getPlayerFromNick ( bannedName ) -- Get the ID from the player who gets banned
         local bannedPlayer = getPlayerFromNick ( bannedName ) -- احضار اسم المتبند
         if getElementType ( bannedPlayer ) == "player" then -- If it's a player
         if getElementType ( bannedPlayer ) == "player" then --اذا كان لاعب
             local theBan = banPlayer ( bannedPlayer, thisPlayer, reason ) -- Ban the player
             local theBan = banPlayer ( bannedPlayer, thisPlayer, reason ) -- يبند الاعب
             outputChatBox ( "ban: " .. bannedName .. " successfully banned", thisPlayer ) -- Send the banner a succes message
             outputChatBox ( "ban: " .. bannedName .. " successfully banned", thisPlayer ) -- ارسال للي بنده كلام بالشات
             outputChatBox ( "At IP Adress: " ..getBanIP ( theBan ), thisPlayer ) -- And send him the IP adress of the banned player
             outputChatBox ( "At IP Adress: " ..getBanIP ( theBan ), thisPlayer ) -- و ارسال الاي بي حق الي تبند
         end
         end
     else
     else
         outputChatBox ( "ban: You don't have enough permissions", thisPlayer ) -- If the command user doesn't have the permissions
         outputChatBox ( "ban: You don't have enough permissions", thisPlayer ) -- اذا كانت الكلمه غير صحيحه
     end
     end
end
end

Revision as of 17:56, 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.

مثال

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 -- اذا كانت الكلمه صحيحه
        local bannedPlayer = getPlayerFromNick ( bannedName ) -- احضار اسم المتبند
        if getElementType ( bannedPlayer ) == "player" then --اذا كان لاعب
            local theBan = banPlayer ( bannedPlayer, thisPlayer, reason ) -- يبند الاعب
            outputChatBox ( "ban: " .. bannedName .. " successfully banned", thisPlayer ) -- ارسال للي بنده كلام بالشات
            outputChatBox ( "At IP Adress: " ..getBanIP ( theBan ), thisPlayer ) -- و ارسال الاي بي حق الي تبند
        end
    else
        outputChatBox ( "ban: You don't have enough permissions", thisPlayer ) -- اذا كانت الكلمه غير صحيحه
    end
end
addCommandHandler ( "ban", banPlayerCommand )

See Also