IsVoiceEnabled: Difference between revisions
Jump to navigation
Jump to search
(Created page with "{{Server function}} __NOTOC__ This function allows you to make the server reveal whether or not voice is currently enabled. ==Syntax== <syntaxhighlight lang="lua"> bool isVoiceEnabled () </...") |
mNo edit summary |
||
(15 intermediate revisions by 7 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Server client function}} | |||
{{New feature/item|3.0140|1.4|4639| | |||
Added to client side. | |||
}} | |||
This function allows you to make the server reveal whether or not voice is currently enabled. | This function allows you to make the server reveal whether or not voice is currently enabled. | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
bool isVoiceEnabled () | bool isVoiceEnabled ( ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{OOP||[[Player]].isVoiceEnabled}} | |||
===Returns=== | ===Returns=== | ||
Returns ''true'' if the voice is enabled on the server, ''false'' otherwise. | Returns ''true'' if the voice is enabled on the server, ''false'' otherwise. | ||
Line 14: | Line 16: | ||
==Example== | ==Example== | ||
<section name="Server" class="server" show="true"> | <section name="Server" class="server" show="true"> | ||
This example shows how to forbid use voice for muted (in chat) players | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
-- only if voice enabled | |||
if isVoiceEnabled() then | |||
-- adding handler for voice start event | |||
addEventHandler( 'onPlayerVoiceStart', root, | |||
function() | |||
-- if player is muted in chat | |||
-- do not broadcast his voice to other players | |||
if isPlayerMuted(source) then cancelEvent() end | |||
end | |||
) | |||
end | |||
</syntaxhighlight> | </syntaxhighlight> | ||
</section> | </section> |
Latest revision as of 17:32, 27 February 2016
Added to client side. This function allows you to make the server reveal whether or not voice is currently enabled.
Syntax
bool isVoiceEnabled ( )
OOP Syntax Help! I don't understand this!
- Method: Player.isVoiceEnabled(...)
Returns
Returns true if the voice is enabled on the server, false otherwise.
Example
Click to collapse [-]
ServerThis example shows how to forbid use voice for muted (in chat) players
-- only if voice enabled if isVoiceEnabled() then -- adding handler for voice start event addEventHandler( 'onPlayerVoiceStart', root, function() -- if player is muted in chat -- do not broadcast his voice to other players if isPlayerMuted(source) then cancelEvent() end end ) end
See Also
- getPlayerTeam
- getPlayerBlurLevel
- setPlayerBlurLevel
- getPlayerSerial
- forcePlayerMap
- getPlayerScriptDebugLevel
- getPlayerFromName
- getPlayerMoney
- getPlayerName
- getPlayerNametagColor
- getPlayerNametagText
- getPlayerPing
- getPlayerWantedLevel
- givePlayerMoney
- isPlayerMapForced
- isPlayerNametagShowing
- setPlayerHudComponentVisible
- setPlayerMoney
- setPlayerNametagColor
- setPlayerNametagShowing
- setPlayerNametagText
- takePlayerMoney
- countPlayersInTeam
- getPlayersInTeam
- isVoiceEnabled
- setControlState
- getControlState