OnBan: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Fixed incorrect onBan parameters)
Line 5: Line 5:
==Parameters==
==Parameters==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
string theIPOrSerial
ban theBan
</syntaxhighlight>  
</syntaxhighlight>  


*'''theIPOrSerial''': The IP address or serial that was banned from the server.
*'''theBan ''': The [[ban]] which was added.


==Source==
==Source==
Line 23: Line 23:
root = getRootElement()
root = getRootElement()


function announceBan( sz )
function announceBan( theBan )
if getElementType( source ) then --Check if a player banned the IP/Serial
if getElementType( source ) then --Check if a player banned the IP/Serial
outputChatBox( getPlayerName( source ) .. " banned " .. sz ) --Output to the chatbox saying the player has 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
end
end

Revision as of 14:35, 8 February 2010

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

If this event is canceled, the requested ban is not performed.

Example

This example does...

root = getRootElement()

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'

See Also

Server events


Event functions