OnBan: Difference between revisions
Jump to navigation
Jump to search
(→Source) |
Tag: Rollback |
||
(4 intermediate revisions by one other user not shown) | |||
Line 5: | Line 5: | ||
==Parameters== | ==Parameters== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
ban theBan | |||
</syntaxhighlight> | </syntaxhighlight> | ||
*'''theBan''': | *'''theBan''': the [[ban]] which was added. | ||
== | ==Source== | ||
The [[event system#Event source|source]] of this event is the [[element]] that was responsible for the banning. If no responsible was specified, the source is the global root element. | |||
==Cancel effect== | ==Cancel effect== |
Latest revision as of 14:11, 22 August 2020
This event is triggered when an IP address or serial is banned from the server.
Parameters
ban theBan
- theBan: the ban which was added.
Source
The source of this event is the element that was responsible for the banning. If no responsible was specified, the source is the global root element.
Cancel effect
This event cannot be canceled.
Example
This example outputs a simple message to all players when a player added a ban.
function announceBan( theBan ) if ( isElement( source ) ) and ( getElementType( source ) == "player" ) then -- Check if the element responsible for the ban is a player element outputChatBox( getPlayerName( source ) .. " banned " .. ( getBanSerial( theBan ) or getBanIP( theBan ) ) ) -- Output to the chatbox saying the player has banned the IP/Serial end end addEventHandler( "onBan", root, announceBan ) -- Adds the event handler for "onBan" and must be bound to root
See Also
Server events
Event functions
- addEvent
- addEventHandler
- cancelEvent
- cancelLatentEvent
- getEventHandlers
- getLatentEventHandles
- getLatentEventStatus
- removeEventHandler
- triggerEvent
- wasEventCancelled