On every Game Instance there is a method called SendEventToClientFromServer. This allows you to send a message to any client from the server, you just need to know thier client id.
//Example Implementation, in the "client_sent_event" script
switch(eventName){
case "chat":
var chatMessage = messageStruct.chatMessage //sent by client
chatMessage = CussWordsFilter(chatMessage) //some function to clean cuss words
//now send this chat to everyone in the room
//firstly find the room this sender belongs to, then send the message to everyone
for(var roomId in game.rooms){
if(game.rooms[roomId].clients.hasOwnProperty(senderClientId){
//we found the sender
//now send the message to everyone here
for(var clientId in game.rooms[roomId].clients){
//make a messageStruct to send everyone
var a = {
message: chatMessage,
sender: clientId
}
game.SendEventToClientFromServer(clientId, "cuss_free_chat", a)
}
}
}
break;
}