AR/getBans: Difference between revisions
Jump to navigation
Jump to search
(Created page with "__NOTOC__ {{Server function}} This function will return a table over all the ban values in the server. ==Syntax== <syntaxhighlight lang="lua"> table getBans () </syntaxhighlight> ===Returns=== Ret...") |
|||
Line 31: | Line 31: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{ | {{AR/Admin_functions}} | ||
[[ru:getBans]] | [[ru:getBans]] |
Revision as of 18:25, 1 September 2012
This function will return a table over all the ban values in the server.
Syntax
table getBans ()
Returns
Returns a table of all the bans.
Example
Example 1: This example lists every ban when somebody types "/bans". WARNING: This will spam chat (for the player that executed the command) if the server has a lot of bans.
function listBans ( playerSource ) local banList = getBans() -- Return a table of all the bans. -- for banID, ban in ipairs ( banList ) do -- For every ban do the following... -- local nick = getBanNick ( ban ) -- Get the IP of the ban -- if nick then outputChatBox ( "Ban #" .. banID .. ": " .. nick, playerSource , 255, 0, 0, true ) -- Output the ban. end -- end -- end addCommandHandler ( "bans", listBans ) -- Add "/bans" as the trigger for the function.