Forum

> > CS2D > Scripts > Not working "return 1" code
Forums overviewCS2D overview Scripts overviewLog in to reply

English Not working "return 1" code

7 replies
To the start Previous 1 Next To the start

old Not working "return 1" code

HedShot
User Off Offline

Quote
This code doesn't work! Help me pls!

1
2
3
4
5
6
7
addhook("say","coloursay")
function coloursay(id,message)
if player(id,"name")=="PLAYERNAME" then
parse("msg ©255000000"..player(id,"name").." says: ©123999999"..message)
return 1 --This don't work :(
end
end

old Re: Not working "return 1" code

lucaSWAT
User Off Offline

Quote
1
2
3
4
5
addhook("say","coloursay")
function coloursay(id,message)
msg(string.char(169).."255000000"..player(id,"name").." says: "..string.char(169).."123999999"..message)
return 1
end

old Re: Not working "return 1" code

Avo
User Off Offline

Quote
@user lucaSWAT: Let him learn something. At first, use tabs. CS2D has special lua function "msg" - he doesn't have to parse it.

1
2
3
4
5
6
7
addhook("say","coloursay")
function coloursay(id,txt)
	if player(id,"name")=="PLAYERNAME" then
		msg("©255000000"..player(id,"name").." says: ©123999999"..txt)
		return 1;
	end
end

Also "©" can be replaced with function that return ASCII's char:
1
string.char(169)
becouse it's faster and more comfortable than copying it from another place (copyright sign's number in ASCII is 169).

Btw, if you're planning to host dedicated server with script like this, you must know, that using name is pointless, becouse everybody will be able to use your name when you're not on server.

old Re: Not working "return 1" code

Gajos
BANNED Off Offline

Quote
EDIT:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
adm = {
	admins = {108942}
}

c = string.char(169)
addhook('say','adm.say',2)
adm.say = function(id,txt)
	if adm.isAdmin(id) then
		msg(c..'255000000'..player(id,'name')..' [Admin]: '..c..'123999999'..txt)
		return 1
	end
end

adm.isAdmin = function(id)
	for _, i in pairs(adm.admins) do
		if player(id,'usgn') == i then
			return true
		end
	end
	return false
end
edited 1×, last 27.03.13 05:36:11 pm

old Not work

HedShot
User Off Offline

Quote
Its not work. And when I delete the script, then work! And if I restart the server, not work! (sorry for my english)
edited 1×, last 29.03.13 08:48:32 am
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview