onPlayerBan | Multi Theft Auto: Wiki Skip to content

onPlayerBan

Client-side
Server-side
Shared

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

element: The source of this event is the player who was banned.

Canceling

This event cannot be canceled.

Code Examples

server

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 ) ..".", root, 255, 0, 0 ) -- Output the ban.
end
addEventHandler ( "onPlayerBan", root, outputBan ) -- Trigger the function when there is a ban.

See Also