OnPlayerTeamChange
Jump to navigation
Jump to search
Additionally, this event is triggered for all players on a team when that team is destroyed.
Parameters
team oldTeam, team newTeam
- oldTeam: An team representing the previous team of the player. If there is no old team, this is nil.
- newTeam: An team representing the new team of the player. If there is no new team, this is nil.
Source
The source of this event is the player whose team was changed.
Cancel effect
If this event is canceled, then the player's team change will be prevented.
Example
This example prints the name of the new team of a player whenever the player's team changes.
addEventHandler("onPlayerTeamChange", root, function(oldTeam, newTeam) local playerName = getPlayerName(source) if isElement(newTeam) then outputChatBox(playerName.."'s team changed. New team name: "..getTeamName(newTeam)) else outputChatBox(playerName.." is no longer in a team.") end end)
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