Jump to content

Chat for players in dimension


Recommended Posts

You should mantain t chat as the global. And add a handler to a command. When commamd is typed loop through all players and check if they are in same dim. If so output. Tomorrow i can give u the example. Now i am in mobile. U will need

addCommandHandler 
getElementsByType 
getElementDimension 
outputChatBox 

Link to comment
You should mantain t chat as the global. And add a handler to a command. When commamd is typed loop through all players and check if they are in same dim. If so output. Tomorrow i can give u the example. Now i am in mobile. U will need
addCommandHandler 
getElementsByType 
getElementDimension 
outputChatBox 

this?

addEventHandler("onPlayerChat",root,function(message, messageType) 
if messageType == 0 then cancelEvent() 
local dimLocal = getElementDimension(source) 
        for k,v in ipairs(getElementsByType("player")) do 
                local dimRoot = getElementDimension(v) 
            if dimLocal == dimRoot then 
                outputChatBox(getPlayerName(source)..": #FFFFFF"..message,v,255,255,255,true) 
            outputServerLog("CHAT: "..getPlayerName(source)..": "..message) 
  
        end 
    end 
end  
end) 
    

fixed line 6.

Edited by Guest
Link to comment
this?
addEventHandler("onPlayerChat",root,function(message, messageType) 
if messageType == 0 then cancelEvent() 
local dimLocal = getElementDimension(source) 
        for k,v in ipairs(getElementsByType("player")) do 
                local dimRoot = getElementDimension(v) 
            if dinLocal == dinRoot then 
                outputChatBox(getPlayerName(source)..": #FFFFFF"..message,v,255,255,255,true) 
            outputServerLog("CHAT: "..getPlayerName(source)..": "..message) 
  
        end 
    end 
end  
end) 
    

It has a typo at line 6 ('dinLocal' and 'dinRoot').

Link to comment

That would edit 't' chat. I mantain my opinion that you should leave it as the "all dimension" chat. I make you a command that u type like "t/dimchat mensage" and u can bind it on join with bindKey for all players. Just my opinion.

EDIT: I didnt saw the return if msgtype = 0. Ok that should work. Forget what i typed above

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...