GetBanAdmin: Difference between revisions
Jump to navigation
Jump to search
(Added oop syntax) |
No edit summary |
||
Line 22: | Line 22: | ||
local banner = getBanAdmin(ban) -- Get the name of the admin who banned the player | 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 | local reason = getBanReason(ban) -- Get the reason the player was banned | ||
outputChatBox("-----BAN-----", | outputChatBox("-----BAN-----",root,255,0,0) | ||
if (banned) then | if (banned) then | ||
outputChatBox("Player banned: "..banned, | outputChatBox("Player banned: "..banned,root,255,0,0) -- Output the player name who was banned | ||
end | end | ||
if (banner) then | if (banner) then | ||
outputChatBox("Banner: "..banner, | outputChatBox("Banner: "..banner,root,255,0,0) -- Output the admin name who performed the ban | ||
end | end | ||
if (reason) then | if (reason) then | ||
outputChatBox("Reason: "..reason, | outputChatBox("Reason: "..reason,root,255,0,0) -- outputt the reason the player was banned | ||
end | end | ||
end | end | ||
addEventHandler("onBan", | addEventHandler("onBan",root,outputBan) -- When a player is banned trigger the outputBan function | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Latest revision as of 15:48, 5 July 2020
This function will return the responsible admin (nickname of the admin) of the specified ban.
Syntax
string getBanAdmin ( ban theBan )
OOP Syntax Help! I don't understand this!
- Method: ban:getAdmin(...)
- Variable: .admin
- Counterpart: setBanAdmin
Required Arguments
- theBan: The ban you want to return the admin of.
Returns
Returns a string of the admin if everything was successful, false if invalid arguments are specified if there was no admin specified for the ban.
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-----",root,255,0,0) if (banned) then outputChatBox("Player banned: "..banned,root,255,0,0) -- Output the player name who was banned end if (banner) then outputChatBox("Banner: "..banner,root,255,0,0) -- Output the admin name who performed the ban end if (reason) then outputChatBox("Reason: "..reason,root,255,0,0) -- outputt the reason the player was banned end end addEventHandler("onBan",root,outputBan) -- When a player is banned trigger the outputBan function