Jump to content

soundsmute


Recommended Posts

Posted

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 :D

sorry for my bad english i'm dutch

Posted
i got a answer ban and restart resource... ( or someone just help you with scripting xD)

yes :P, but ban is to hard for a player with sound spam if he do again then a ban

Posted

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 ;)

Posted
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

Nice script man thanks a lot :D

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 :D

Greetings Maarten123

Sorry for my bad englush i'm dutch :D

Posted

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)

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...