setPlayerVoiceBroadcastTo | Multi Theft Auto: Wiki Skip to content

setPlayerVoiceBroadcastTo

Client-side
Server-side
Shared

This page is incomplete! Help wanted!

Please finish this page using the corresponding Old Wiki article.
Go to Contribution guidelines for more information.


This function allows you to change who can hear the voice of a player.

Important

This function should only be used as a low-level function for advanced users. For typical Voice scripting, please see the Voice Resource

Syntax

setPlayerVoiceBroadcastTo ( )

Code Examples

server
function getPlayer( ... )
if ( ... ) then
local elements = {};
for _, string in ipairs( { ... } ) do
for _, element in ipairs( getElementsByType( 'player' ) ) do
if ( string.find( string:lower(), getPlayerName(element):lower(), 1, true ) ) then
table.insert( elements, element );
end
end
end
return elements;
end
return false
end
addCommandHandler( 'broadcast',
function( player, command, target, target_ )
if ( target and target_ ) then
target, target_ = getPlayer( target, target_ );
if ( target and target_ ) then
setPlayerVoiceBroadcastTo( target, target_ );
else
outputChatBox( not target and "Target 1 not found!" or not target_ and "Target 2 not found!", root, 255, 0, 0, false );
end
end
end
)

See Also