Forum

> > CS2D > Scripts > !Mute Command
Forums overviewCS2D overview Scripts overviewLog in to reply

English !Mute Command

6 replies
To the start Previous 1 Next To the start

old !Mute Command

KagamineLen
User Off Offline

Quote
please help me make a mute command like when you say !mute 1 it will mute player 1(he can't message using z-button)

old Re: !Mute Command

Cure Pikachu
User Off Offline

Quote
Here you go.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
function initArray(a,v)
	local array = {}
	for i = 1, a do
		array[i] = v
	end
	return array
end

mute = initArray(32,false)
admintable = {70919}

function checkadmin(id)
	for _, u in ipairs(admintable) do
		if player(id,"usgn") == u then
			return true
		end
	end
	return false
end

addhook("say","muted")
function muted(id,msg)
	if checkadmin(id) then
		if msg:sub(1,5) == "!mute" then
			local victim = tonumber(msg:sub(7))
			if mute[victim] == false then
				mute[victim] = true
				msg2(id,"©000255000You muted "..player(victim,"name").."!")
				msg2(victim,"©255000000You been muted by "..player(id,"name").."!")
			elseif mute[victim] == true then
				mute[victim] = false
				msg2(id,"©255000000You unmuted "..player(victim,"name").."!")
				msg2(victim,"©000255000You been unmuted by "..player(id,"name").."!")
			end
			return 1
		end
	else
		if mute[id] == true then
			msg2(id,"©255000000You are muted, so you can't say anything!")
			return 1
		end
	end
	return 0
end
edited 1×, last 17.08.11 01:39:40 pm

old Re: !Mute Command

buraxia3
User Off Offline

Quote
user Cure Pikachu has written
Here you go.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
function initArray(a,v)
	local array = {}
	for i = 1, a do
		array[i] = v
	end
	return array
end

mute = initArray(32,false)
admintable = {70919}

function checkadmin(id)
	for _, u in ipairs(admintable) do
		if player(id,"usgn") == u then
			return true
		end
	end
	return false
end

addhook("say","muted")
function muted(id,msg)
	if checkadmin(id) then
		if msg:sub(1,5) == "!mute" then
			local victim = tonumber(msg:sub(7))
			if mute[victim] == false then
				mute[victim] = true
				msg2(id,"©000255000You muted "..player(victim,"name").."!")
				msg2(victim,"©255000000You been muted by "..player(id,"name").."!")
			elseif mute[victim] == true then
				mute[victim] = false
				msg2(id,"©255000000You unmuted "..player(victim,"name").."!")
				msg2(victim,"©000255000You been unmuted by "..player(id,"name").."!")
			end
			return 1
		end
	else
		if mute[id] == true then
			msg2(id,"©255000000You are muted, so you can't say anything!)
			return 1
		end
	end
	return 0
end

great! its better then writeable only console mute lua. THANKS!

old Re: !Mute Command

KagamineLen
User Off Offline

Quote
thanks but you got 1 error

1
2
3
4
5
6
7
if mute[id] == true then
               msg2(id,"©255000000You are muted, so you can't say anything!) <----- Put "
               return 1
          end
     end
     return 0
end

it should be
1
2
3
4
5
6
7
if mute[id] == true then
               msg2(id,"©255000000You are muted, so you can't say anything!")
               return 1
          end
     end
     return 0
end

old Re: !Mute Command

KimKat
GAME BANNED Off Offline

Quote
It won't disable the key Z it will just disable the chat function, making the player you muted unable to chat in general. I doubt that this will solve anything though unless the player you want to mute is a spammer or just plain mean. Great script.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview