IsVoiceEnabled: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
{{Server client function}}
{{Server client function}}
{{New items|3.0151|1.4|
Added to client side.
}}
__NOTOC__  
__NOTOC__  
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.
Line 11: Line 16:
===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.
{{New items|3.0151|1.4|
Added to client side.
}}


==Example==  
==Example==  

Revision as of 11:47, 11 September 2012

Added to client side.


This function allows you to make the server reveal whether or not voice is currently enabled.

Syntax

bool isVoiceEnabled ()

Returns

Returns true if the voice is enabled on the server, false otherwise.

Example

Click to collapse [-]
Server

This 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