SetPlayerVoiceIgnoreFrom: Difference between revisions
Jump to navigation
Jump to search
(Created page with "{{Server function}} __NOTOC__ This function allows you to mute voices for a player. ==Syntax== <syntaxhighlight lang="lua"> bool setPlayerVoiceIgnoreFrom ( element thePlayer, mixed ignoreFr...") |
m (→See Also) |
||
(7 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
{{Server function}} | {{Server function}}__NOTOC__ | ||
__NOTOC__ | |||
This function allows you to mute voices for a player. | This function allows you to mute voices for a player. | ||
{{Important Note|This function should only be used as a low-level function for advanced users. For typical Voice scripting, please see the [[Resource:Voice|Voice Resource]]}} | |||
==Syntax== | ==Syntax== | ||
Line 8: | Line 8: | ||
bool setPlayerVoiceIgnoreFrom ( element thePlayer, mixed ignoreFrom ) | bool setPlayerVoiceIgnoreFrom ( element thePlayer, mixed ignoreFrom ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{OOP||[[player]]:setVoiceIgnoreFrom|voiceIgnoreFrom|}} | |||
===Required Arguments=== | ===Required Arguments=== | ||
*'''thePlayer:''' The [[player]] you wish to change | *'''thePlayer:''' The [[player]] you wish to change | ||
Line 17: | Line 17: | ||
==Example== | ==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 ) | |||
<section name="Server" class="server" show="true"> | <section name="Server" class="server" show="true"> | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function voiceMuteFunction( Muter , cmd , MutedName , mutual) | |||
if not MutedName then | |||
return outputChatBox("Syntax: /".. cmd .." <player name> <mutual>", Muter) | |||
end | |||
local Muted = getPlayerFromName(MutedName) | |||
if not Muted then | |||
return outputChatBox('enter the correct player name' , Muter) | |||
end | |||
if Muted == Muter then | |||
return outputChatBox("You cannot mute yourself!", Muter) | |||
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) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
</section> | </section> | ||
==See Also== | ==See Also== | ||
{{ | {{Player functions|server}} |
Latest revision as of 22:44, 6 September 2024
This function allows you to mute voices for a player.
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 [-]
Serverfunction voiceMuteFunction( Muter , cmd , MutedName , mutual) if not MutedName then return outputChatBox("Syntax: /".. cmd .." <player name> <mutual>", Muter) end local Muted = getPlayerFromName(MutedName) if not Muted then return outputChatBox('enter the correct player name' , Muter) end if Muted == Muter then return outputChatBox("You cannot mute yourself!", Muter) 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
- getAlivePlayers
- getDeadPlayers
- getPlayerACInfo
- getPlayerAnnounceValue
- getPlayerCount
- getPlayerIdleTime
- getPlayerIP
- getPlayerVersion
- getRandomPlayer
- isPlayerMuted
- redirectPlayer
- resendPlayerACInfo
- resendPlayerModInfo
- setPlayerAnnounceValue
- setPlayerMuted
- setPlayerScriptDebugLevel
- setPlayerTeam
- setPlayerVoiceBroadcastTo
- setPlayerVoiceIgnoreFrom
- setPlayerWantedLevel
- spawnPlayer
- takePlayerScreenShot
- Shared
- 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