GetBanIP: Difference between revisions
Jump to navigation
Jump to search
Enterprise (talk | contribs) No edit summary |
(Example added.) |
||
Line 15: | Line 15: | ||
==Example== | ==Example== | ||
This example will | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
-- | function banPlayerCommand ( thisPlayer, commandName, bannedName, reason ) | ||
if ( hasObjectPermissionTo ( thisPlayer, "function.banPlayer" ) ) then -- If the command user has the rights | |||
if getElementType ( bannedPlayer ) == "player" then -- If it's a player | |||
local bannedPlayer = getPlayerFromNick ( bannedName ) -- Get the name from the player who gets banned | |||
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 ) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{Admin functions}} | {{Admin functions}} | ||
[[ru:getBanIP]] | [[ru:getBanIP]] |
Revision as of 14:02, 24 July 2010
This function will return the IP of the specified ban pointer.
Syntax
string getBanIP ( ban theBan )
Required Arguments
- theBan: The ban in which you want to return the IP of.
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
function banPlayerCommand ( thisPlayer, commandName, bannedName, reason ) if ( hasObjectPermissionTo ( thisPlayer, "function.banPlayer" ) ) then -- If the command user has the rights if getElementType ( bannedPlayer ) == "player" then -- If it's a player local bannedPlayer = getPlayerFromNick ( bannedName ) -- Get the name from the player who gets banned 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 )