Global Chat?

How would i make a seperate chat like. /glob <message> for players to talk over multiple servers. As i own 2 garry’s mod server’s. Ive seen this done on a few server’s too.

Anyways please reply ASAP if you know how.

  • DaM1ND

Hmm, I’m a newb with LUA, but I guess you could do something like this :
It’s a chatbox somewhere, maybe a website, and it registers what you say, and then prints to both server?
Not sure.

Use this module.
There probably is a script less than a google search away if you don’t feel like learning sockets.

Don’t post in my topics if your a newb. I clearly said:

Thanks.

I believe Pulsar Effect saved it to a database and just had it check for new entries and print them out.

wrote this a long time ago but i doubt it that the place where you rent the servers from is gone like it. (asuming you dont have your own dedicated server)

Server
[lua]-- Settings
local serverport = 4001 – Server ID/PORT Has to be unque for every server
local serveridentifyer = “[Sandbox]” – Server indentifyer (how it appears in chat)
local servers = { 4000 } – Servers to communicate with excluding self.
local serverip = “127.0.0.1”
local debugmode = false

print(“CSC Starting”);

if not(require(“oosocks”)) then
print(“CSC: OOSocks Module not found” … "
CSC Closing")
return
end

local connection = OOSock(IPPROTO_UDP);
function CSC(socket, callType, callId, err, data, peer, peerPort)
if(callType == SCKCALL_BIND && err == SCKERR_OK) then
print("CSC binded to port: " … tostring(serverport));
connection:ReceiveDatagram();
end

if(callType == SCKCALL_REC_DATAGRAM && err == SCKERR_OK) then  	
	umsg.Start("CSCChatIncome", ply)
		umsg.String( data )
	umsg.End()
	connection:ReceiveDatagram();
end  
  
if(err != SCKERR_OK) then  
	print("CSC error: " .. tostring(err) .. "

CSC Closing")
socket:Close()
connection:Close()
end
end
connection:SetCallback(CSC);
connection:Bind("", serverport);

function CSCSayHook( ply, text, team, death )
if (string.sub(text, 1, 7) == “/global”) then
if ply.NextGlobalChat == nil || ply.NextGlobalChat < CurTime() then
ply.NextGlobalChat = CurTime() + 5
datastring = serveridentifyer … " " … "
" … ply:GetName() … “:” … "
" … string.sub(text, 8)
umsg.Start(“CSCChatIncome”, ply)
umsg.String( datastring )
umsg.End()
for k, v in pairs(servers) do
connection:Send(datastring, serverip, v);
end
end
return “”

end

end
hook.Add( “PlayerSay”, “CSCSay”, CSCSayHook );

function CSCStop(ply,command,args)
if !ply:IsPlayer() || ply:IsSuperAdmin() then
print(“CSC Closing”)
connection:Close()
hook.Remove(“PlayerSay”, “CSCSay”)
concommand.Remove(“CSC_Stop”)
end
end

concommand.Add( “CSC_Stop”, CSCStop )[/lua]
Client:
[lua]function CSCChatHook( um )
datastring = um:ReadString()
datatable = string.Explode("
", datastring)
chat.AddText(
Color(255,0,0), datatable[1],
Color(0,255,0), datatable[2],
Color(255,255,255), datatable[3])
end
usermessage.Hook(“CSCChatIncome”, CSCChatHook)[/lua]

Yeah, I don’t have a dedicated server :.

-snip-

Can’t you use the think hook?

It’s can be bad on the server if there’s a lot hooked to Think, but yes you “could” use it.

-snip-