OnPlayerBan: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
(Added an example.)
Line 15: Line 15:


==Example==  
==Example==  
This example outputs the responcible element and the ban pointer when a ban takes place.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
-- TODO
function outputBan ( banPointer, responcibleElement ) -- Define the banner and the ban pointer in the function.
outputChatBox ( getPlayerName(responcibleElement ).." has banned ".. banPointer ..".", getRootElement(), 255, 0, 0 ) -- Output the ban.
end
addEventHandler ( "onPlayerBan", getRootElement(), outputBan ) -- Trigger the function when there is a ban.
</syntaxhighlight>
</syntaxhighlight>


{{See also/Server event|Player events}}
{{See also/Server event|Player events}}
[[Category:Needs_Example]]

Revision as of 16:14, 24 February 2010

This event is triggered when a player added a ban (like onBan).

Parameters

ban banPointer, player responsibleElement
  • banPointer: The ban pointer which was added.
  • responsibleElement: The player who added the ban

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.

Example

This example outputs the responcible element and the ban pointer when a ban takes place.

function outputBan ( banPointer, responcibleElement ) -- Define the banner and the ban pointer in the function.
outputChatBox ( getPlayerName(responcibleElement ).." has banned ".. banPointer ..".", getRootElement(), 255, 0, 0 ) -- Output the ban.
end
addEventHandler ( "onPlayerBan", getRootElement(), outputBan ) -- Trigger the function when there is a ban.

See Also

Player events


Event functions