Forum

> > CS2D > Scripts > Colour Remove (admin)
Forums overviewCS2D overview Scripts overviewLog in to reply

English Colour Remove (admin)

27 replies
Page
To the start Previous 1 2 Next To the start

old Colour Remove (admin)

Misho
User Off Offline

Quote
Hey guys
I need some help with one script.
1
2
3
4
5
6
7
8
9
10
11
Admin = {xxxxx}

addhook("say","adminsay")
function adminsay(id,txt)
for _, usgn in ipairs(Admin) do
if player(id,'usgn') == usgn then
msg("©255255255"..player(id,"name").." [Admin] : "..txt)
return 1
end
end
end

So i need one command:
!q and this command will remove the colour of the admin.
I hope you guys can help me.
edited 1×, last 28.04.12 12:32:32 pm

old Re: Colour Remove (admin)

Jynxxx
User Off Offline

Quote
well 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
function Array(p,q)
	local array = {}
	for o = 1, p do
		array[o] = q or false
	end
	return array
end

admincolor = 1

Admin = {18627}

addhook("say","adminsay")
function adminsay(id,txt)
	for _, usgn in ipairs(Admin) do
		if player(id,"usgn") == usgn then
			if txt=="!q" then
				admincolor = 0
				msg2(id,"adminchat removed")
				return 1
			elseif txt=="!a" then
				admincolor = 1
				msg2(id,"adminchat activated")
				return 1
			elseif admincolor == 1 then
				msg("©255255255"..player(id,"name").." [Admin] : "..txt)
				return 1
			end
		end
	end
end

old Re: Colour Remove (admin)

sheeL
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
Admin = {45813,xxxxx}

colors = 1

addhook("say","says")
function says(id,t)
for _, usgn in ipairs(Admin) do
if player(id,'usgn') == usgn then
if colors == 1 then
msg("©255255255"..player(id,"name").." [Admin] : "..t)
return 1
end
end
end
end

addhook("say","sayss")
function sayss(id,t)
if colors == 0 then
return false
end
end

addhook("say","ed")
function ed(id,txt)
for _, usgn in ipairs(Admin) do
if player(id,'usgn') == usgn then
if txt == "!enable" then
colors = 1
elseif txt == "!disable" then
colors = 0
end
return 1
end
end
end

fixed
fine works
edited 1×, last 28.04.12 08:04:36 pm

old Re: Colour Remove (admin)

sheeL
User Off Offline

Quote
user Jynxxx has written
what was the problem and why do you have 3 different say hooks?


yeah
If you put it all together, would not work perfectly
but at least works

Is there a problem?

old Re: Colour Remove (admin)

Jynxxx
User Off Offline

Quote
what was the problem with my script , mine is more cleaner and shorter what if he doesn't want the text !enable to show to everyone.

*edit*
the code really didnt need the array function

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
admincolor = 1

Admin = {18627}

addhook("say","adminsay")
function adminsay(id,txt)
	for _, usgn in ipairs(Admin) do
		if player(id,"usgn") == usgn then
			if txt=="!q" then
				admincolor = 0
				msg2(id,"adminchat removed")
				return 1
			elseif txt=="!a" then
				admincolor = 1
				msg2(id,"adminchat activated")
				return 1
			elseif admincolor == 1 then
				msg("©255255255"..player(id,"name").." [Admin] : "..txt)
				return 1
			end
		end
	end
end
edited 1×, last 28.04.12 08:23:39 pm

old Re: Colour Remove (admin)

Yates
Reviewer Off Offline

Quote
user Jynxxx has written
what was the problem with my script

Your code will turn everyone's text on and off, and not just your own.

old Re: Colour Remove (admin)

krabob
User Off Offline

Quote
I got a feeling this should work

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
function initArray(m)
local array = {}
for i = 1, m do
array[i]=0
end
return array
end

admincolor=initArray(32)


addhook("say","adminsay")
function adminsay(id,txt)
for _, usgn in ipairs(Admin) do
if player(id,'usgn') == usgn then
if admincolor == 1 then
msg("©255255255"..player(id,"name").." [Admin] : "..txt)
end
if txt=="!q" then
if admincolor[id]==1 then
admincolor[id]=0
msg2(id,"adminchat removed")
return 1
elseif admincolor[id]==0 then
admincolor[id]= 1
msg2(id,"adminchat activated")
return 1
end
end
end
end
end
edited 1×, last 29.04.12 02:44:12 pm

old Re: Colour Remove (admin)

Misho
User Off Offline

Quote
user krabob has written
I got a feeling this should work

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
function initArray(m)
local array = {}
for i = 1, m do
array[i]=0
end
return array
end

admincolor=initArray(32)


addhook("say","adminsay")
function adminsay(id,txt)
for _, usgn in ipairs(Admin) do
if player(id,'usgn') == usgn then
if admincolor == 1 then
msg("©255255255"..player(id,"name").." [Admin] : "..txt)
end
if txt=="!q" then
if admincolor[id]==1 then
admincolor[id]=0
msg2(id,"adminchat removed")
return 1
elseif admincolor[id]==0 then
admincolor[id]= 1
msg2(id,"adminchat activated")
return 1
end
end
end
end
end


I agree with user Yates i need the admin table.
To the start Previous 1 2 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview