From Multi Theft Auto: Wiki
Revision as of 03:04, 27 September 2018 by Botder (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This event is triggered when an IP address or serial is banned from the server.


ban theBan
  • theBan: the ban which was added.


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.


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
addEventHandler( "onBan", root, announceBan ) -- Adds the event handler for "onBan" and must be bound to root

See Also

Server events

Event functions