I need two modes in the script;
1. Radius Chat
2. Global Chat (@) or (@g)
If you didn't understand;
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
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
ERROR: sys/lua/test.lua:5: attempt to index local 'v' (a number value) -> sys/lua/test.lua:5: in function <sys/lua/test.lua:2> -> in Lua hook 'say', params: 1, '@r'