OnBan: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
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>
{{Şunlara da Bakın/Server event|Server events}}

Revision as of 14:10, 22 August 2020

This event is triggered when an IP address or serial is banned from the server.

Sözdizimi

yasaklama theBan
  • theBan: Eklenmiş olan yasak.

Kaynak

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.

İptal Etme

Bu olay iptal edilemez.

Örnek

Bu örnek, bir oyuncu yasaklandığında herkese bir mesaj gönderiyor.

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