edited 1×, last 31.05.25 03:07:14 am
Forum
Scripts
Radius Chat (tibia-like)
Radius Chat (tibia-like)
8 replies
1

1
2
3
4
5
6
7
8
9
10
11
12
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.
edited 1×, last 31.05.25 03:07:27 am
hodja:@r <msg> -- for radius chat
@g <msg> -- for global chat
edited 2×, last 31.05.25 03:07:39 am
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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.
edited 1×, last 31.05.25 03:07:53 am
Now it works, I'll edit it later.
Thanks.
1

Offline