Forum

> > CS2D > Scripts > text:rank not work on (color script)
Forums overviewCS2D overview Scripts overviewLog in to reply

English text:rank not work on (color script)

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

old text:rank not work on (color script)

DarkBooy
User Off Offline

Quote
Hello us , when i use this script :

More >




And say : rank .... i not show my stats

can anyone give me solution For it . Or other text for show stats .

old Re: text:rank not work on (color script)

DarkBooy
User Off Offline

Quote
@user BcY:


i try to add this ... but not Work

IF me(admin) say rank : i not get stats

More >


i need other solution

old Re: text:rank not work on (color script)

Rainoth
Moderator Off Offline

Quote
Is this the whole script ? I'm preety sure it doesn't work because you put it after all those ends so it's like.
Whole Thing works > You end it > then you make an "if". It won't work that way. Could you give whole script ? especially the "list_adm" part

old Re: text:rank not work on (color script)

DarkBooy
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
list_adm = {89037}
addhook("say", "rankSay")
function rankSay(id, text)
			for _, i in ipairs(list_adm) do
			if (i == player(id, "usgn")) then
			local mtext = (player(id,"name").."©255255255 »Admin« ©255128000: ©000255000"..text)
			if player(id,"team")==1 then --T
			mtext=string.char(169).."255000000"..mtext
			elseif player(id,"team")==2 then --CT
			mtext=string.char(169).."050150255"..mtext
			elseif player(id,"team")==0 then --SPEC
			mtext=string.char(169).."255220000"..mtext
			end
			msg(mtext)
			return 1;
			end	
           	end 
                        end


> IF you have solution ... give me it

• Note : the edit i forgot put this : list_adm = {89037}

old Re: text:rank not work on (color script)

Dynamite07
User Off Offline

Quote
i said you to try to add my code.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
addhook("say", "rankSay")
function rankSay(id, text)
               for _, i in ipairs(list_adm) do
               if (i == player(id, "usgn")) then
       if (text =="rank") then
             parse(id,"say rank")
           return 1
          end
               local mtext = (player(id,"name").."©255255255 »Admin« ©255128000: ©000255000"..text)
               if player(id,"team")==1 then --T
               mtext=string.char(169).."255000000"..mtext
               elseif player(id,"team")==2 then --CT
               mtext=string.char(169).."050150255"..mtext
               elseif player(id,"team")==0 then --SPEC
               mtext=string.char(169).."255220000"..mtext
               end
               msg(mtext)
               return 1;
               end     
                end
end

old Re: text:rank not work on (color script)

Rainoth
Moderator Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
list_adm = {15476}
addhook("say", "rankSay")
function rankSay(id, text)
               for _, i in ipairs(list_adm) do
		 if string.lower(text) == "rank" then
         	 return 0
          	end
               if (i == player(id, "usgn")) then
               local mtext = (player(id,"name").."©255255255 »Admin« ©255128000: ©000255000"..text)
               if player(id,"team")==1 then --T
               mtext=string.char(169).."255000000"..mtext
               elseif player(id,"team")==2 then --CT
               mtext=string.char(169).."050150255"..mtext
               elseif player(id,"team")==0 then --SPEC
               mtext=string.char(169).."255220000"..mtext
               end
               msg(mtext)
               return 1;
               end     
                end 
                        end

Don't forget to change the adm_list back to your USGN

old Re: text:rank not work on (color script)

EngiN33R
Moderator Off Offline

Quote
@user Dynamite07: That will never ever work.

Even though that works, I'd like to contribute a way I find prettier and more 'correct' - in this case, when there's only one exception.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
addhook("say", "rankSay")
function rankSay(id, text)
	for _, i in ipairs(list_adm) do
		if (i == player(id, "usgn")) then
			if (text~="rank") then
				local mtext = (player(id,"name").."©255255255 »Admin« ©255128000: ©000255000"..text)
				if player(id,"team")==1 then --T
					mtext=string.char(169).."255000000"..mtext
				elseif player(id,"team")==2 then --CT
					mtext=string.char(169).."050150255"..mtext
				elseif player(id,"team")==0 then --SPEC
					mtext=string.char(169).."255220000"..mtext
				end
				msg(mtext)
				return 1;
			end
		end     
	end
end

old Re: text:rank not work on (color script)

DarkBooy
User Off Offline

Quote
Thanx all , but i have more problem

can help me ?

i need to :

1
2
3
4
5
6
7
8
9
10
11
playsound = {"rock star.ogg"};

addhook("say","snd")
function snd(id,txt)
for _, i in ipairs(list_adm) do
if(txt=="!rock star")then
parse("sv_sound ".. playsound[math.random(1,#playsound)]);
end
if (txt=="!the way") then parse("sv_sound \"fun/thats_the_way.wav\""); end
end
end


its work but i saw player say !rock star .. and it work ..

i need just work in admin ..

and i need this "!" just admin can use it in text

and no show in text

((maybe you no understand me))
edited 1×, last 23.02.13 03:29:48 pm

old Re: text:rank not work on (color script)

Rainoth
Moderator Off Offline

Quote
add
1
if player(id,"usgn") == 15476 then
after your 5th line and add one more "end" in the end.
EDIT : Though my way it's still going to show text I think. Don't you want to make a menu ? It would be much more simple than writing and other people wouldn't see when you use it.

old Re: text:rank not work on (color script)

EngiN33R
Moderator Off Offline

Quote
user Rainoth has written
add
1
if player(id,"usgn") == 15476 then


That would enable it only for one player.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
playsound = {"rock star.ogg"};

addhook("say","snd")
function snd(id,txt)
	for _, i in ipairs(list_adm) do
		if player(id,"usgn")==i then
			if(txt=="!rock star")then
				parse("sv_sound ".. playsound[math.random(1,#playsound)]);
				return 1;
			end
			if (txt=="!the way") then parse("sv_sound \"fun/thats_the_way.wav\""); return 1; end
		end
	end
end

Learn proper indentation, user DarkBooy.

old Re: text:rank not work on (color script)

Rainoth
Moderator Off Offline

Quote
user EngiN33R has written
user Rainoth has written
add
1
if player(id,"usgn") == 15476 then


That would enable it only for one player.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
playsound = {"rock star.ogg"};

addhook("say","snd")
function snd(id,txt)
	for _, i in ipairs(list_adm) do
		if player(id,"usgn")==i then
			if(txt=="!rock star")then
				parse("sv_sound ".. playsound[math.random(1,#playsound)]);
				return 1;
			end
			if (txt=="!the way") then parse("sv_sound \"fun/thats_the_way.wav\""); return 1; end
		end
	end
end

Learn proper indentation, user DarkBooy.


That's true but can't you make "or player(id,"usgn") == xxxxx or player(id,"usgn") = xxxxy ?

old Re: text:rank not work on (color script)

EngiN33R
Moderator Off Offline

Quote
user Rainoth has written
That's true but can't you make "or player(id,"usgn") == xxxxx or player(id,"usgn") = xxxxy ?


You can, but then you'll have to add one such check for every administrator, and then place "or" between them all. What if there are 10 or more? It would just look crowded.

user DarkBooy has written
can you make function for command "!" not show in text


1
2
3
if (text:sub(1,1)=="!") then
	return 1
end

old Re: text:rank not work on (color script)

DarkBooy
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
addhook("say", "rankSay")
function rankSay(id, text)
     for _, i in ipairs(list_adm) do
          if (i == player(id, "usgn")) then
                 if (text:sub(1,1)=="!") then
                    return 1
                       end
               if (text~="rank") then
                    local mtext = (player(id,"name").."©255255255 »Admin« ©255128000: ©000255000"..text)
                    if player(id,"team")==1 then --T
                         mtext=string.char(169).."255000000"..mtext
                    elseif player(id,"team")==2 then --CT
                         mtext=string.char(169).."050150255"..mtext
                    elseif player(id,"team")==0 then --SPEC
                         mtext=string.char(169).."255220000"..mtext
                    end
                    msg(mtext)
                    return 1;
               end
          end     
     end
end





like this?

old Re: text:rank not work on (color script)

EngiN33R
Moderator Off Offline

Quote
Yes, but your tabbing is a little screwed up.

Code >
To the start Previous 1 2 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview