OnPlayerBan: Difference between revisions
Jump to navigation
Jump to search
(Added an example.) |
Paul Cortez (talk | contribs) No edit summary |
||
Line 12: | Line 12: | ||
==Source== | ==Source== | ||
The [[event system#Event source|source]] of this event is the [[ | The [[event system#Event source|source]] of this event is the [[player]] who was banned. | ||
==Example== | ==Example== | ||
This example outputs the | This example outputs the responsible element and the banned player's name when a ban takes place. | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function outputBan ( banPointer, | 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 | end | ||
addEventHandler ( "onPlayerBan", getRootElement(), outputBan ) -- Trigger the function when there is a ban. | addEventHandler ( "onPlayerBan", getRootElement(), outputBan ) -- Trigger the function when there is a ban. |
Revision as of 16:17, 25 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 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.
See Also
Player events
- onPlayerACInfo
- onPlayerBan
- onPlayerChangeNick
- onPlayerChat
- onPlayerClick
- onPlayerCommand
- onPlayerConnect
- onPlayerContact
- onPlayerDamage
- onPlayerJoin
- onPlayerLogin
- onPlayerLogout
- onPlayerMarkerHit
- onPlayerMarkerLeave
- onPlayerModInfo
- onPlayerMute
- onPlayerNetworkStatus
- onPlayerPickupHit
- onPlayerPickupLeave
- onPlayerPickupUse
- onPlayerPrivateMessage
- onPlayerQuit
- onPlayerScreenShot
- onPlayerSpawn
- onPlayerStealthKill
- onPlayerTarget
- onPlayerUnmute
- onPlayerVehicleEnter
- onPlayerVehicleExit
- onPlayerVoiceStart
- onPlayerVoiceStop
- onPlayerWasted
- onPlayerWeaponFire
- onPlayerWeaponSwitch
Event functions
- addEvent
- addEventHandler
- cancelEvent
- cancelLatentEvent
- getEventHandlers
- getLatentEventHandles
- getLatentEventStatus
- removeEventHandler
- triggerEvent
- wasEventCancelled