maarten123 Posted June 25, 2010 Share Posted June 25, 2010 hello, I have a script and thus you can use a command everyone to hear a sound, but you can spam with a binder. and so I want to mute sound that spammers make an application for playing the sound become blocked, another it makes no sense. I had started only this works for everyone: P So when I am mute everyone muted. Serverside: nomute = 1 function knightrider (player) local playerName = getPlayerName(player) if(nomute == 1) then outputChatBox(playerName .. ':#FFFFFF has test knightrider', getRootElement(), 255, 255, 0, true) triggerClientEvent("knightrider", player) else outputChatBox(playerName .. 'Test sound mute', getRootElement(), 255, 255, 0, true) end end addCommandHandler ( "knightrider", knightrider ) ----Sound Mute------------------------------ function soundmute () local nomute = 0 outputChatBox ("#ffaa00Sound mute test", 255, 255, 255, true ) end addCommandHandler ( "soundmute", soundmute ) Greeting maarten123 sorry for my bad english i'm dutch Link to comment
kevin11 Posted June 25, 2010 Share Posted June 25, 2010 i got a answer ban and restart resource... ( or someone just help you with scripting ) Link to comment
maarten123 Posted June 25, 2010 Author Share Posted June 25, 2010 i got a answer ban and restart resource... ( or someone just help you with scripting ) yes , but ban is to hard for a player with sound spam if he do again then a ban Link to comment
dzek (varez) Posted June 25, 2010 Share Posted June 25, 2010 kevin - dont have anything to say? just dont say anything answer: timeToMute = 5 -- in sec. mute = { } function knightrider (player) local playerName = getPlayerName(player) if (not mute[player]) then outputChatBox(playerName .. ':#FFFFFF has test knightrider', getRootElement(), 255, 255, 0, true) triggerClientEvent("knightrider", player) mute[player]=true setTimer(function(playerElement) mute[playerElement]=false end, timeToMute*1000, 1, player) else -- i think you dont need this "else", just do nothing, cause this will spam chatbox outputChatBox(playerName .. ' muted', getRootElement(), 255, 255, 0, true) end end addCommandHandler ("knightrider", knightrider) not tested Link to comment
maarten123 Posted June 27, 2010 Author Share Posted June 27, 2010 kevin - dont have anything to say? just dont say anythinganswer: timeToMute = 5 -- in sec. mute = { } function knightrider (player) local playerName = getPlayerName(player) if (not mute[player]) then outputChatBox(playerName .. ':#FFFFFF has test knightrider', getRootElement(), 255, 255, 0, true) triggerClientEvent("knightrider", player) mute[player]=true setTimer(function(playerElement) mute[playerElement]=false end, timeToMute*1000, 1, player) else -- i think you dont need this "else", just do nothing, cause this will spam chatbox outputChatBox(playerName .. ' muted', getRootElement(), 255, 255, 0, true) end end addCommandHandler ("knightrider", knightrider) not tested Nice script man thanks a lot but I also want a manual to make sound mute Script: function soundautomute (thePlayer, command, playerName) playerName = getPlayerFromName(playerName) adminName = getPlayerName(player) if playerName then if (not automute[playerName]) then outputChatBox ("#ffaa00" .. playerName .. " has been sound mute by " .. adminName, getRootElement(), 255, 255, 255, true ) automute[playerName]=true else outputChatBox ("#ffaa00Player is already muted", thePlayer, 255, 255, 255, true ) end else outputChatBox ("Iets vergeten intevullen?", thePlayer, 255, 255, 255, true ) end end addCommandHandler ( "soundautomute", soundautomute ) Error's [2010-06-27 19:20:38] WARNING: sounds/server.lua:96: Bad argument @ 'getPlayerFromName' [2010-06-27 19:20:38] WARNING: sounds/server.lua:97: Bad argument @ 'getPlayerName' [2010-06-27 19:20:47] WARNING: sounds/server.lua:97: Bad argument @ 'getPlayerName' [2010-06-27 19:20:47] ERROR: sounds/server.lua:100: attempt to concatenate global 'adminName' (a boolean value) i hope you can help me Greetings Maarten123 Sorry for my bad englush i'm dutch Link to comment
dzek (varez) Posted June 27, 2010 Share Posted June 27, 2010 i think you modified my script, so please post WHOLE script you have, not only muting selected player (btw you are not checking who is trying to mute, anyone can mute another player, and this mute won't be stopped automatically) 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