OnPlayerBan: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
Line 29: Line 29:
{{ChangelogItem|1.3.0-9.03908|Fixed responsible element parameter}}
{{ChangelogItem|1.3.0-9.03908|Fixed responsible element parameter}}


{{See also/Server event|Player events}}
==See Also==
===Player events===
{{Player_events}}
===Event functions===
{{Event functions}}


[[ru:onPlayerBan]]
[[ru:onPlayerBan]]

Revision as of 02:12, 27 September 2018

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 player who was banned.

Example

This example outputs the responsible element and the banned player's name when a ban takes place.

function outputBan ( banPointer, responsibleElement ) -- Define the banner and the ban pointer in the function.
	local banner = getPlayerName( responsibleElement ) or "Console" -- Get the banner's name.
	
	outputChatBox ( banner .." has banned ".. getPlayerName( source ) ..".", getRootElement(), 255, 0, 0 ) -- Output the ban.
end
addEventHandler ( "onPlayerBan", getRootElement(), outputBan ) -- Trigger the function when there is a ban.

Changelog

Version Description
1.3.0-9.03908 Fixed responsible element parameter

See Also

Player events


Event functions