Forum

> > CS2D > Scripts > Mute Lua
Forums overviewCS2D overview Scripts overviewLog in to reply

English Mute Lua

11 replies
To the start Previous 1 Next To the start

old Mute Lua

Jhony
User Off Offline

Quote
Pls create the script

!mute
!unmute

help me D=

old Re: Mute Lua

Apache uwu
User Off Offline

Quote
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
45
46
47
48
addhook("say","_say")
addhook("sayteam","_sayteam")

addhook("join","_join")

admins={89367}
muted={}

function is_admin(usgn)
	for _,id in pairs(admins) do
		if usgn==id then
			return true
		end
	end
	return false
end

function _say(id,message)
	if is_admin(player(id,"usgn")) then
		if string.sub(message,1,6)=="!mute " then
			local id2=tonumber(string.sub(message,7))
			if id2 and player(id2,"exists") then
				muted[id2]=true
				msg(string.char(169).."255000000"..player(id2,"name").." has been muted.")
				return 1
			end
		elseif string.sub(message,1,8)=="!unmute " then
			local id2=tonumber(string.sub(message,9))
			if id2 and player(id2,"exists") then
				muted[id2]=false
				msg(string.char(169).."255000000"..player(id2,"name").." has been unmuted.")
				return 1
			end
		end
	elseif muted[id]==true then
		return 1
	end
end

function _join(id)
	muted[id]=nil
end

function _sayteam(id)
	if muted[id]==true then
		return 1
	end
end

old Re: Mute Lua

Jhony
User Off Offline

Quote
user Apache uwu has written
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
45
46
47
48
addhook("say","_say")
addhook("sayteam","_sayteam")

addhook("join","_join")

admins={89367}
muted={}

function is_admin(usgn)
	for _,id in pairs(admins) do
		if usgn==id then
			return true
		end
	end
	return false
end

function _say(id,message)
	if is_admin(player(id,"usgn")) then
		if string.sub(message,1,6)=="!mute " then
			local id2=tonumber(string.sub(message,7))
			if id2 and player(id2,"exists") then
				muted[id2]=true
				msg(string.char(169).."255000000"..player(id2,"name").." has been muted.")
				return 1
			end
		elseif string.sub(message,1,8)=="!unmute " then
			local id2=tonumber(string.sub(message,9))
			if id2 and player(id2,"exists") then
				muted[id2]=false
				msg(string.char(169).."255000000"..player(id2,"name").." has been unmuted.")
				return 1
			end
		end
	elseif muted[id]==true then
		return 1
	end
end

function _join(id)
	muted[id]=nil
end

function _sayteam(id)
	if muted[id]==true then
		return 1
	end
end

works , but no mute the player
help pls

old Re: Mute Lua

Apache uwu
User Off Offline

Quote
Well it works, and you haven't described any errors. The only problem with this is that you can just rejoin, regardless most mute scripts I've seen work that way.

To be more "advanced" you need to store a table of IPs or USIDs--however since you are a leecher I don't feel much like helping you. ×

old Re: Mute Lua

Jhony
User Off Offline

Quote
user Apache uwu has written
Well it works, and you haven't described any errors. The only problem with this is that you can just rejoin, regardless most mute scripts I've seen work that way.

To be more "advanced" you need to store a table of IPs or USIDs--however since you are a leecher I don't feel much like helping you. ×


no works
look:

http://imageshack.us/photo/my-images/441/nowork.png/

old Re: Mute Lua

Jhony
User Off Offline

Quote
user J4x has written
Maybe you can't mute yourself..


Yes, I Already Muted Other players, and does not work

old Re: Mute Lua

Suprise
BANNED Off Offline

Quote
I tested it! And its work!
I play with 2 player! Me and me!
But the second me do not login to CS2D account! Its work

old Re: Mute Lua

krabob
User Off Offline

Quote
@user Jhony: Well, maybe you're using another script which contains a function with say. Try to use this by itself or just try to implement it into your scripts other function with the say hook.

old Re: Mute Lua

Jhony
User Off Offline

Quote
user krabob has written
@user Jhony: Well, maybe you're using another script which contains a function with say. Try to use this by itself or just try to implement it into your scripts other function with the say hook.


So has this script in my "server.lua"
Do not have another script within

old Re: Mute Lua

Jhony
User Off Offline

Quote
user Apache uwu has written
You can't mute admins -.- duh


@user Apache uwu: nevertheless
Mute not without Admin
Do not nobody Mute
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@topic
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
ismuted={}
for id=1,32 do
ismuted[id]=false
end

addhook("say","muteply")
function muteply(id,t)
     if (t:sub(1,5)=="!mute") then
          local mid=tonumber(t:sub(6))
          ismuted[mid]=true
     end
     if (ismuted[id]) then
          return 1
     end
end

add "!nomute"
pls?
edited 1×, last 11.03.12 12:36:24 am
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview