Forum

> > CS2D > Scripts > Colour Remove (admin)
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Colour Remove (admin)

27 Antworten
Seite
Zum Anfang Vorherige 1 2 Nächste Zum Anfang

alt Colour Remove (admin)

Misho
User Off Offline

Zitieren
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.
1× editiert, zuletzt 28.04.12 12:32:32

alt Re: Colour Remove (admin)

Jynxxx
User Off Offline

Zitieren
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

alt Re: Colour Remove (admin)

sheeL
User Off Offline

Zitieren
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
1× editiert, zuletzt 28.04.12 20:04:36

alt Re: Colour Remove (admin)

sheeL
User Off Offline

Zitieren
user Jynxxx hat geschrieben
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?

alt Re: Colour Remove (admin)

Jynxxx
User Off Offline

Zitieren
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
1× editiert, zuletzt 28.04.12 20:23:39

alt Re: Colour Remove (admin)

Yates
Reviewer Off Offline

Zitieren
user Jynxxx hat geschrieben
what was the problem with my script

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

alt Re: Colour Remove (admin)

krabob
User Off Offline

Zitieren
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
1× editiert, zuletzt 29.04.12 14:44:12

alt Re: Colour Remove (admin)

Misho
User Off Offline

Zitieren
user krabob hat geschrieben
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.
Zum Anfang Vorherige 1 2 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht