Jump to content

setPlayerMuted for a certain time


Recommended Posts

function mutePlayer(player,command,victimName)
-- if the player has specified a victim name to mute
if victimName then
-- get the victim player element from their name
local victim = getPlayerFromNick(victimName)
-- if the player exists
if victim then
-- if they arent already muted
if ( not isPlayerMuted(victim) ) then
-- mute them and output a message to the chat
setPlayerMuted(victim, true)
outputChatBox("You have been muted.",victim)
end
else
outputChatBox("Could not find player with name: "..tostring(victimName),player)
end
else
outputChatBox("Usage: /mute ",player)
end
end
-- add the /mute command
addCommandHandler("mute",mutePlayer)

how to mute a player for a certain time ?

Link to comment
function mutePlayer(player,command,victimName)
-- if the player has specified a victim name to mute
if victimName then
-- get the victim player element from their name
local victim = getPlayerFromNick(victimName)
-- if the player exists
if victim then
-- if they arent already muted
if ( not isPlayerMuted(victim) ) then
-- mute them and output a message to the chat
setPlayerMuted(victim, true)
outputChatBox("You have been muted.",victim)
end
else
outputChatBox("Could not find player with name: "..tostring(victimName),player)
end
else
outputChatBox("Usage: /mute ",player)
end
end
-- add the /mute command
addCommandHandler("mute",mutePlayer)

how to mute a player for a certain time ?

Sorry but i am new to scripting, but i think this would work:

Under the place where it says setPlayerMuted(victim, true) you could set a time with the setTimer command, so something like this:

setPlayerMuted(victim, true)
setTimer(setPlayerMuted, 1000, 1, victim, false)

And then change 1000 to the amount of miliseconds you want it to last before the player gets unmuted. Like for example, 1000 is 1 second, so 60000 is 1 minute.

Hope it works!

Link to comment

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...