Assassin-NL Posted May 12, 2010 Share Posted May 12, 2010 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
B!ERPuNK Posted May 12, 2010 Share Posted May 12, 2010 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
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