Forum

> > CS2D > Scripts > Radius Chat (tibia-like)
Forums overviewCS2D overview Scripts overviewLog in to reply

English Radius Chat (tibia-like)

8 replies
To the start Previous 1 Next To the start

old Re: Radius Chat (tibia-like)

Rainoth
Moderator Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
addhook("say","_s")
function _s(id,t)
	if t:sub(#t-2,#t) == "@r" then
		for k,v in pairs (player(0,"tableliving")) do
			if (math.sqrt(((player(id,"x")-v.x)^2 + player(id,"y")-v.y)^2)<1000) then
				msg2(v,player(id,"name")..": "..t)
			end
		end
	elseif t:sub(#t-2,#t) == "@g" then
		msg(player(id,"name")..": "..t)
	end
end

General concept. May or may not work. Fine-tune and fix if something's wrong yourself.

old Re: Radius Chat (tibia-like)

Rainoth
Moderator Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
14
addhook("say","_s")
function _s(id,t)
	if t:sub(#t-1,#t) == "@r" then
		for k,v in pairs (player(0,"tableliving")) do
			if (math.sqrt(((player(id,"x")-player(v,"x"))^2 + (player(id,"y")-player(v,"y"))^2))<1000) then
				msg2(v,player(id,"name")..": "..t:sub(1,#t-2))
				return 1
			end
		end
	elseif t:sub(#t-1,#t) == "@g" then
		msg(player(id,"name")..": "..t:sub(1,#t-2))
		return 1
	end
end

Found a few dumb mistakes and fixed it up, you could have found them too, they're pretty dumb mistakes. Was indexing default CS2D table wrong way. Oops. Tested the code, works without a hitch.

Add all the fancy crap like team colors yourself. It doesn't require a lot of brain to do it. I believe in you.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview