OnBan: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (Reverted edits by Violence (talk) to last revision by Botder)
Tag: Rollback
 
Line 3: Line 3:
This event is triggered when an IP address or serial is banned from the server.
This event is triggered when an IP address or serial is banned from the server.


==Sözdizimi==
==Parameters==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
yasaklama theBan
ban theBan
</syntaxhighlight>  
</syntaxhighlight>  


*'''theBan''': Eklenmiş olan yasak.
*'''theBan''': the [[ban]] which was added.


==Kaynak==
==Source==
Bu olayın kaynağı, yasaklanmadan sorumlu olan değişkendir.Eğer hiçbir sorumlu yoksa o zaman kaynak, genel root değişkeni olur.
The [[event system#Event source|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.


==İptal Etme==
==Cancel effect==
Bu olay iptal edilemez.
This event cannot be canceled.


==Örnek==  
==Example==  
Bu örnek, bir oyuncu yasaklandığında herkese bir mesaj gönderiyor.
This example outputs a simple message to all players when a player added a ban.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function announceBan( theBan )
function announceBan( theBan )
Line 26: Line 26:
addEventHandler( "onBan", root, announceBan ) -- Adds the event handler for "onBan" and must be bound to root
addEventHandler( "onBan", root, announceBan ) -- Adds the event handler for "onBan" and must be bound to root
</syntaxhighlight>
</syntaxhighlight>
{{See also/Server event|Server events}}

Latest revision as of 14:11, 22 August 2020

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

See Also

Server events


Event functions