Forum

> > CS2D > Scripts > How i can fix it that will work?
Forums overviewCS2D overview Scripts overviewLog in to reply

English How i can fix it that will work?

4 replies
To the start Previous 1 Next To the start

old How i can fix it that will work?

Crash13
User Off Offline

Quote
Can anyone help me with this script? When i write: then message appear on centre of cs2d, and dont show my name. I played with scripts 2 minutes, until i wrote this script. (This is useful for that , if you dont want that ppls know that you are admin). First script works, but second no, i wanna that when someone say my name: then i will write: !<my message> --- then will appear: Crash13: <my message> . But not in centre. Sorry if understand, write reply.

√ --> Syntax is correct.. console don't find any bugs.

More >
edited 1×, last 08.01.12 07:07:19 pm

old Re: How i can fix it that will work?

Yates
Reviewer Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Admins = {33373}

addhook("say","adm_say")
function adm_say(id,txt)
	for _, usgn in ipairs(Admins) do
		if player(id, "usgn") == usgn then
			msg("©255255255"..txt.." @C")
			return 1
		end
		if (txt=="!"..txt) then
			msg(""..player(id,"name")..": "..txt)
		end
	end
end
More than one say hook will fuck them all up.

old Re: How i can fix it that will work?

EngiN33R
Moderator Off Offline

Quote
user Crash13 has written
user Anti-Grav has written
Try:

1
msg("©255255255 "..txt.." ")


No.... all work, mistake are here:

1
if (txt=="!"..txt) then


You're basically checking if the text is itself plus a symbol, which will never be true.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
Admins = {33373}

addhook("say","adm_say")
function adm_say(id,txt)
	for _, usgn in ipairs(Admins) do
		if player(id, "usgn") == usgn then
			msg("©255255255"..txt.." @C")
			if (txt:sub(1,1)=="!") then
				msg(player(id,"name")..": "..txt)
			end
			return 1
		end
	end
end

I'm guessing that's what you want?.. I'm really not sure.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview