OnBan: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (Improving)
No edit summary
Line 14: Line 14:


==Cancel effect==
==Cancel effect==
If this event is [[Event system#Canceling|canceled]], the requested ban is not performed.
This event cannot be canceled.


==Example==  
==Example==  

Revision as of 03:35, 24 October 2012

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 getElementType( source ) then --Check if a player banned the IP/Serial
		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