1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
function msg3(txt,x,y,rx,ry)
	print(txt)
	if (rx==nil and ry==nil) then
		rx,ry=400,400
	end
	local xl,yl,xb,yb=x-rx,y-ry,x+rx,y+ry
	for _, p in ipairs(player(0,"table")) do
		if player(p,"x")>=xl and player(p,"x")<=xl and player(p,"y")>=yb and player(p,"y")<=yb then
			msg2(p,txt)
		end
	end
end
addhook("say","chatstoofz")
function chatstoofz(id,txt)
	if (choosingname[id]) then
		playername[id]=txt
		choosingname[id]=false
		msg2(id,"Your name is now "..playername[id])
	end
	if (canchat[id]) then
		if (chatchannel[id]==1) then
			if (txt:len()<=19) then
				msg3("©255255000"..playername[id]..": "..txt,player(id,"x"),player(id,"y"))
			else
				local l=txt:sub(1,20)
				local k=txt:sub(20,txt:len())
				msg3("©255255000"..playername[id]..": "..l,player(id,"x"),player(id,"y"))
				msg3("©255255000"..playername[id]..": "..k,player(id,"x"),player(id,"y"))
			end
			chattoggle(id,0)
			timer(1000,"parse","lua chattoggle("..id..",1)")
			print("©255255000"..playername[id]..": "..txt)
		elseif (chatchannel[id]==2) then
			msg("©010120000// "..playername[id]..": "..txt)
			chattoggle(id,0)
			timer(1000,"parse","lua chattoggle("..id..",1)")
		elseif (chatchannel[id]==3) then
			msg3("©255255000"..playername[id]..": "..txt,player(id,"x"),player(id,"y"))
			chattoggle(id,0)
			timer(1000,"parse","lua chattoggle("..id..",1)")
			print("©255255000"..playername[id]..": "..txt)
		end
	end
	return 1
end