GetBanNick: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
(Added an example.) |
||
Line 16: | Line 16: | ||
==Example== | ==Example== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
-- | function outputBan(ban) | ||
local banned = getBanNick(ban) -- Get the name of the player who was banned | |||
local banner = getBanAdmin(ban) -- Get the name of the admin who banned the player | |||
local reason = getBanReason(ban) -- Get the reason the player was banned | |||
outputChatBox("-----BAN-----",getRootElement(),255,0,0) | |||
if (banned) then | |||
outputChatBox("Player banned: "..banned,getRootElement(),255,0,0) -- Output the player name who was banned | |||
end | |||
if (banner) then | |||
outputChatBox("Banner: "..banner,getRootElement(),255,0,0) -- Output the admin name who performed the ban | |||
end | |||
if (reason) then | |||
outputChatBox("Reason: "..reason,getRootElement(),255,0,0) -- outputt the reason the player was banned | |||
end | |||
end | |||
addEventHandler("onBan",getRootElement(),outputBan) -- When a player is banned trigger the outputBan function | |||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{Admin functions}} | {{Admin functions}} | ||
Revision as of 03:53, 5 June 2010
This function will return the nickname (nickname that the player had when he was banned) of the specified ban element.
Syntax
string getBanNick ( ban theBan )
Required Arguments
- theBan: The ban element which nickname you want to return.
Returns
Returns a string of the nickname if everything was successfull, false if invalid arguments are specified if there was no nickname specified for the ban element.
Example
function outputBan(ban) local banned = getBanNick(ban) -- Get the name of the player who was banned local banner = getBanAdmin(ban) -- Get the name of the admin who banned the player local reason = getBanReason(ban) -- Get the reason the player was banned outputChatBox("-----BAN-----",getRootElement(),255,0,0) if (banned) then outputChatBox("Player banned: "..banned,getRootElement(),255,0,0) -- Output the player name who was banned end if (banner) then outputChatBox("Banner: "..banner,getRootElement(),255,0,0) -- Output the admin name who performed the ban end if (reason) then outputChatBox("Reason: "..reason,getRootElement(),255,0,0) -- outputt the reason the player was banned end end addEventHandler("onBan",getRootElement(),outputBan) -- When a player is banned trigger the outputBan function
See Also
- addBan
- banPlayer
- getBanAdmin
- getBanIP
- getBanNick
- getBanReason
- getBanSerial
- getBanTime
- getBanUsername
- getBans
- getUnbanTime
- isBan
- kickPlayer
- setBanAdmin
- setBanNick
- setBanReason
- setUnbanTime
- reloadBans
- removeBan