OnPlayerVoiceStart: Difference between revisions
Jump to navigation
Jump to search
(Created page with "{{Server event}} __NOTOC__ <div style="border: 1px dotted blue; background: #00CC66;padding:4px;margin-bottom:2px;">'''Note''': This event should only be used as a low-level fu...") |
(added example) |
||
Line 14: | Line 14: | ||
==Example== | ==Example== | ||
This | This example shows how to forbid use voice for not logged in players | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
-- | addEventHandler( 'onPlayerVoiceStart', root, | ||
function() | |||
-- if player is not logged in | |||
-- do not broadcast his voice to other players | |||
if isGuestAccount( getPlayerAccount(source) ) then | |||
cancelEvent() | |||
end | |||
end | |||
) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
[[Category:Needs_Example]] | [[Category:Needs_Example]] | ||
{{See also/Server event|Player events}} | {{See also/Server event|Player events}} |
Revision as of 18:28, 19 November 2011
Note: This event should only be used as a low-level function for advanced users. For typical Voice scripting, please see the Voice Resource
This event is triggered when a player starts talking through voice chat.
Parameters
No parameters.
Source
The source of this event is the player element that just started talking through voice chat.
Cancel effect
If this event is canceled the player will not broadcast his voice chat to anyone in the server.
Example
This example shows how to forbid use voice for not logged in players
addEventHandler( 'onPlayerVoiceStart', root, function() -- if player is not logged in -- do not broadcast his voice to other players if isGuestAccount( getPlayerAccount(source) ) then cancelEvent() 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