Forum

> > CS2D > Scripts > Not working "return 1" code
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Not working "return 1" code

7 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Not working "return 1" code

HedShot
User Off Offline

Zitieren
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

alt Re: Not working "return 1" code

lucaSWAT
User Off Offline

Zitieren
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

alt Re: Not working "return 1" code

Avo
User Off Offline

Zitieren
@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.

alt Re: Not working "return 1" code

Gajos
BANNED Off Offline

Zitieren
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
1× editiert, zuletzt 27.03.13 17:36:11

alt Not work

HedShot
User Off Offline

Zitieren
Its not work. And when I delete the script, then work! And if I restart the server, not work! (sorry for my english)
1× editiert, zuletzt 29.03.13 08:48:32
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht