Memory Posted September 30, 2012 Share Posted September 30, 2012 Hi, Can you are help with anti vote spam? How activated "function mutePlayer" on started vote for change map, and "function UnmutePlayer" on stop vote? function mutePlayer() for _, player in ipairs ( getElementsByType ( "player" ) ) do setPlayerMuted(player, true) outputChatBox("#FF0000All has been muted.", getRootElement(), 255, 255, 255, true ) end for i,v in ipairs(getAccounts()) do setPlayerMuted(v, true) end addCommandHandler("mute",mutePlayer) function UnmutePlayer() for _, player in ipairs ( getElementsByType ( "player" ) ) do setPlayerMuted(player, false) outputChatBox("#FF0000All has been unmuted.", getRootElement(), 255, 255, 255, true ) end for i,v in ipairs(getAccounts()) do setPlayerMuted(v, false) end addCommandHandler("unmute",UnmutePlayer) Link to comment
Jaysds1 Posted September 30, 2012 Share Posted September 30, 2012 try this: function mutePlayers() for _, player in ipairs ( getElementsByType ( "player" ) ) do setPlayerMuted(player, true) outputChatBox("#FF0000All has been muted.",player, 255, 255, 255, true ) end end --forgot end addCommandHandler("mute",mutePlayers) function unmutePlayers() for _, player in ipairs ( getElementsByType ( "player" ) ) do setPlayerMuted(player, false) outputChatBox("#FF0000All has been unmuted.",player, 255, 255, 255, true ) end end --forgot end addCommandHandler("unmute",unmutePlayers) addEventHandler("onPollStarting",root,function() mutePlayers() end) addEventHandler("onRaceStateChanging",root,function(state) if state=="LoadingMap" then unmutePlayers() end end) oh, and there was no need for the accounts loop, you could only set players muted. Link to comment
Memory Posted September 30, 2012 Author Share Posted September 30, 2012 Don't work. Only on command "mute" work outputChatBox, but not muted. Link to comment
LoveFist Posted September 30, 2012 Share Posted September 30, 2012 Probably your anti vote spam resource don't have rights to use setPlayerMuted. Link to comment
Memory Posted September 30, 2012 Author Share Posted September 30, 2012 Sure, I add, now command work, but on vote start don't work Link to comment
Memory Posted September 30, 2012 Author Share Posted September 30, 2012 Can be this? But don't work function mutePlayers() for _, player in ipairs ( getElementsByType ( "player" ) ) do setPlayerMuted(player, true) outputChatBox("#FF0000All has been muted.",player, 255, 255, 255, true ) end end addEventHandler("onPollStarting",root, mutePlayers) function unmutePlayers(state) for _, player in ipairs ( getElementsByType ( "player" ) ) do if state=="LoadingMap" then setPlayerMuted(player, false) outputChatBox("#FF0000All has been unmuted.",player, 255, 255, 255, true ) end end addEventHandler("onRaceStateChanging",root, unmutePlayers) Link to comment
Entity Posted September 30, 2012 Share Posted September 30, 2012 It doesn't have any errors now, but I'm not sure if it works. function mutePlayers() for _, player in ipairs ( getElementsByType ( "player" ) ) do setPlayerMuted(player, true) outputChatBox("#FF0000All has been muted.",player, 255, 255, 255, true ) end end addEventHandler("onPollStarting",root, mutePlayers) function unmutePlayers(state) for _, player in ipairs ( getElementsByType ( "player" ) ) do if state=="LoadingMap" then setPlayerMuted(player, false) outputChatBox("#FF0000All has been unmuted.",player, 255, 255, 255, true ) end end end addEventHandler("onRaceStateChanging",root, unmutePlayers) Link to comment
Jaysds1 Posted September 30, 2012 Share Posted September 30, 2012 wait, this script is for race right? Link to comment
Guest Guest4401 Posted October 1, 2012 Share Posted October 1, 2012 addEvent("onPollStarting",true) Link to comment
Memory Posted October 1, 2012 Author Share Posted October 1, 2012 (edited) Thanks, work I still added "addEvent("onRaceStateChanging",true)" for all unmuted. Full code, add resource name to acl "Admin", function mutePlayers() for _, player in ipairs ( getElementsByType ( "player" ) ) do setPlayerMuted(player, true) outputChatBox("#FF0000All has been muted.",player, 255, 255, 255, true ) end end addEvent("onPollStarting",true) addEventHandler("onPollStarting",root, mutePlayers) function unmutePlayers(state) for _, player in ipairs ( getElementsByType ( "player" ) ) do if state=="LoadingMap" then setPlayerMuted(player, false) outputChatBox("#FF0000All has been unmuted.",player, 255, 255, 255, true ) end end end addEvent("onRaceStateChanging",true) addEventHandler("onRaceStateChanging",root, unmutePlayers) Edited October 1, 2012 by Guest Link to comment
Cadu12 Posted October 1, 2012 Share Posted October 1, 2012 I guess it can bugged, player will be unmuted who is spam, insult, etc, when map is started. Link to comment
Memory Posted October 1, 2012 Author Share Posted October 1, 2012 This scripts only for stoped spam of number, when continues vote. 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