All pastes #979659 Raw Edit

Unnamed

public text v1 · immutable
·published 2008-04-10 14:44 UTC
rendered paste body
vanityname = nil --A permanant name shown to other servers for your server. Set to nil to use your hostname.
----------------------------------------------------
--Don't edit below here.
----------------------------------------------------
for k, v in pairs(player.GetAll()) do
	v:ChatPrint("Rendezvous is starting...")
end
require("socket")
local conn = socket.connect("pandora.dnsdojo.com", 1702)
conn:settimeout(0)
conn:setoption("keepalive",true)
if vanityname == nil then
	conn:send(GetConVarString("hostname").."\n")
	CURRHOST = GetConVarString("hostname")
else
	conn:send(vanityname.."\n")
end

function SendMessage( ply, text, toall )
	conn:send(text.."\n")
end
function RecvMessage()
	local data = conn:receive("*l")
	if data ~= nil then
		for k, v in pairs(player.GetAll()) do
			v:ChatPrint(data)
		end
	end
end
function CheckHost()
	if(vanityname == nil) then	
		if GetConVarString("hostname") ~= CURRHOST then
			conn:send("HOST "..GetConVarString("hostname").."\n")
			CURRHOST = GetConVarString("hostname")
		end
	end
end
hook.Add("PlayerSay", "RendezvousSendMessage", SendMessage)
timer.Create("RendezvousRecvMessage", 2, 0, RecvMessage)
timer.Create("RendezvousCheckHost", 5, 0, CheckHost)
for k, v in pairs(player.GetAll()) do
	v:ChatPrint("Rendezvous has started!")
end