MrLoKi Posted May 6, 2023 Share Posted May 6, 2023 Hello Guys ! How To Mute Voice Player In Loading MTA ?? I want to not hear the player sound when the player enters the server in the download and upload resources section Link to comment
Shady1 Posted May 6, 2023 Share Posted May 6, 2023 38 minutes ago, MrLoKi said: Hello Guys ! How To Mute Voice Player In Loading MTA ?? I want to not hear the player sound when the player enters the server in the download and upload resources section hello @MrLoKi welcome the forum , I have prepared a piece of code for your question, I hope it will be useful for you, I did not test it, if you have a problem or in a different way, let me know, I will help you function onClientResourceStart() -- get all the players in the server local players = getElementsByType("player") for i, player in ipairs(players) do -- mute the player's voice setPlayerVoiceIgnoreFrom(player, root, true) end end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), onClientResourceStart) Link to comment
MrLoKi Posted May 6, 2023 Author Share Posted May 6, 2023 This is a server-side function and generally does not work function Joined() local players = getElementsByType("player") for i, player in ipairs(players) do setPlayerVoiceIgnoreFrom(player, source, true) end end addEventHandler("onPlayerJoin",getRootElement(),Joined) Link to comment
Shady1 Posted May 6, 2023 Share Posted May 6, 2023 2 hours ago, MrLoKi said: This is a server-side function and generally does not work function Joined() local players = getElementsByType("player") for i, player in ipairs(players) do setPlayerVoiceIgnoreFrom(player, source, true) end end addEventHandler("onPlayerJoin",getRootElement(),Joined) function onClientPlayerJoin() -- Get the player element that just joined local joinedPlayer = source -- Mute the new player's voice for the local player setPlayerVoiceIgnore(joinedPlayer, true) end addEventHandler("onClientPlayerJoin", getRootElement(), onClientPlayerJoin) Link to comment
Addlibs Posted May 7, 2023 Share Posted May 7, 2023 On 06/05/2023 at 17:16, Shady1 said: function onClientPlayerJoin() -- Get the player element that just joined local joinedPlayer = source -- Mute the new player's voice for the local player setPlayerVoiceIgnore(joinedPlayer, true) end addEventHandler("onClientPlayerJoin", getRootElement(), onClientPlayerJoin) The only way this would work is if download priority was set higher for the resource with this code, otherwise this code won't execute until everything downloads and thus voice will be heard until download completes. 1 Link to comment
Shady1 Posted May 8, 2023 Share Posted May 8, 2023 45 minutes ago, Addlibs said: The only way this would work is if download priority was set higher for the resource with this code, otherwise this code won't execute until everything downloads and thus voice will be heard until download completes. Thank you for your comment but I just posted an example code, if the player expects more code support from me, just let me know and I'm ready to give more support to the players. 1 Link to comment
MrLoKi Posted May 14, 2023 Author Share Posted May 14, 2023 Yes, I want a code that does not make any sound during download Help me with this Link to comment
MrLoKi Posted May 16, 2023 Author Share Posted May 16, 2023 Can anyone help me with this? Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now