Hello!
I found a new local chat script. It's working just when a write a command (example.: /reconnect) It's writing out in the cahtbox /reconenct. I searching on the internet and now the script know what is command what it's simple message,but i don't know what can i do whit the command how i can use.
chat_range=5
function bindOnJoin()
bindKey(source,"t","down","chatbox","Mondod")
end
addEventHandler("onPlayerJoin",getRootElement(),bindOnJoin)
function bindRStart()
for index, player in pairs(getElementsByType("player")) do
bindKey(player,"t","down","chatbox","Mondod")
end
end
addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), bindRStart)
function isPlayerInRangeOfPoint(player,x,y,z,range)
local px,py,pz=getElementPosition(player)
return ((x-px)^2+(y-py)^2+(z-pz)^2)^0.5<=range
end
function onChat(player,_,...)
local px,py,pz=getElementPosition(player)
local msg = table.concat({...}, " ")
local nick=getPlayerName(player)
if string.sub(msg, 1, 1) == "/" then
--What should here write?
else
for _,v in ipairs(getElementsByType("player")) do
if isPlayerInRangeOfPoint(v,px,py,pz,chat_range) then
outputChatBox(nick.." mondja: "..msg,v,255,255,255,true)
end
end
end
end
addCommandHandler("Mondod",onChat)