Forum

> > CS2D > Scripts > Distance chat
Forums overviewCS2D overview Scripts overviewLog in to reply

English Distance chat

9 replies
To the start Previous 1 Next To the start

old Distance chat

Flame
BANNED Off Offline

Quote
Can sombody make me a lua like this :


In this distance player's can hear each other :

IMG:https://img824.imageshack.us/img824/7345/dedust00000.jpg


And in this distance player's can't hear each other :

IMG:https://img11.imageshack.us/img11/9017/dedust00003.jpg


Please if sombody can make this just post it here i really need it !

old Re: Distance chat

Flame
BANNED Off Offline

Quote
I mean the chat thing... in small distance player's can see each other's words .
And in big distance they cant

old Re: Distance chat

Flame
BANNED Off Offline

Quote
addhook("say","_say")
addhook("sayteam","_say")

max_dist=20 --max range for message to be heard in tiles

function _say(id,message)
if player(id,"health")>0 then
for _,id2 in ipairs(player(0,"tableliving")) do
if math.abs(player(id,"tilex")-player(id2,"tilex"))<max_dist and math.abs(player(id,"tiley")-player(id2,"tiley"))<max_dist then
msg2(id2,player(id,"name")..": "..message)
end
end
end
return 1
end

See when i write somthing 2 messages come ....

IMG:https://img820.imageshack.us/img820/3179/dedust00012.jpg

old Re: Distance chat

EP
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
function radiusmsg(words, x, y, radiusx, radiusy)
	print(words)
	if not (radiusx and radiusy) then radiusx, radiusy = 128, 128 end
	local x1, y1, x2, y2 = x-radiusx, y-radiusy, x+radiusx, y+radiusy
	for _, v in ipairs(player(0, 'table')) do
		if player(v, 'x') >= x1 and player(v, 'x') <= x2 and player(v, 'y') >= y1 and player(v, 'y') <= y2 then
			msg2(v,words)
		end
	end
	return 1
end


addhook("say","rmsg")
function rmsg(id,txt)
	text = "©255255000"..player(id,"name").." : "..txt
	radiusmsg(text, player(id, 'x'), player(id, 'y'), radiusx, radiusy)
	return 1
end
It will show the message to the players who are in the distance "x" and "y", in a square of 4x4 tiles, change it if you want

old Re: Distance chat

Flame
BANNED Off Offline

Quote
I mean a lua that can show message if only player's are close to each other ... Like in RPG tibia

old Re: Distance chat

Flame
BANNED Off Offline

Quote
Well it's not a distance chat one...

So can anybody help me ;// ?
edited 1×, last 09.01.12 08:46:51 pm
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview