SetPlayerVoiceIgnoreFrom

From Multi Theft Auto: Wiki
Jump to navigation Jump to search

Accessories-text-editor.png Script Example Missing Function SetPlayerVoiceIgnoreFrom needs a script example, help out by writing one.

Before submitting check out Editing Guidelines Script Examples.


This function allows you to mute voices for a player.

[[{{{image}}}|link=|]] Important Note: This function should only be used as a low-level function for advanced users. For typical Voice scripting, please see the Voice Resource

Syntax

bool setPlayerVoiceIgnoreFrom ( element thePlayer, mixed ignoreFrom )

OOP Syntax Help! I don't understand this!

Method: player:setVoiceIgnoreFrom(...)
Variable: .voiceIgnoreFrom


Required Arguments

  • thePlayer: The player you wish to change
  • ignoreFrom: Element or table of elements which the player should not hear voices from. Use nil if no one should be ignored.

Returns

Returns true if the value was set successfully, false otherwise.

Example

By this example mute a player voice to yourself so you won't hear him ( note: use setPlayerVoiceMuted function if you are using the voice resource more information at https://wiki.multitheftauto.com/wiki/Resource:Voice )

Click to collapse [-]
Server
function voiceMuteFunction( Muter , cmd , MutedName , mutual)
local Muted = getPlayerFromName(MutedName)
if not Muted then
outputChatBox('enter the correct player name' , Muter)
return end
if mutual then --enter any string as the second arg for making this mute mutual or enter nothing to make it one-way
    setPlayerVoiceIgnoreFrom(Muter,Muted)
    setPlayerVoiceIgnoreFrom(Muted,Muter)
else
    setPlayerVoiceIgnoreFrom(Muter,Muted)
end    
end
addCommandHandler('voiceMute' ,voiceMuteFunction )
-- e.g. /voiceMute jacky y  (mutual)
-- e.g. /voiceMute jacky  (one-way)

See Also