Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if SERVER then
- AddCSLuaFile("autorun/joinreplace.lua")
- return
- end
- local tagcol=Color(100,100,100)
- local teamcol=Color(80,151,199)
- local white=Color(255,255,255)
- local green=Color(0,255,0)
- local red=Color(255,0,0)
- local gray=Color(200,200,255)
- local joinmsgs=
- [[is joining
- is joining the game
- joining
- joining the game
- wants to play
- is about to enter the server
- is about to come to lag you
- is spawning
- clicked connect
- will soon be here
- will be spawning soon
- is coming
- would like to play
- would like to join
- is joining
- is connecting
- is connecting here
- is loading
- connected and is now loading
- initated a session with the server
- is sending UDP packets
- has been detected on the perimeter
- has an urge to join the server
- joining the server
- is joining the server
- sending some packets to the server
- is soon ingame
- is soon ingame, hopefully]]
- joinmsgs = string.Explode("\n",joinmsgs)
- local discmsg=[[Found other things to do
- Left the server
- Got bored
- going to the bed
- Just left
- bbl
- disconnected
- parted the channel
- left the game
- BBL!
- Cut the wire
- removing gmod
- ragequit
- quit
- leaving
- My presence is not required here
- I can't take this anymore
- I'm leaving
- I'm packing my bags
- Hit the wrong button
- What does this button do?
- Oops
- Hit the red button
- EOF
- EndOfTransmission]]
- discmsg = string.Explode("\n",discmsg)
- hook.Add('ChatText','JoinDisconnectReplace', function ( UserID, Name, msg, msgtype )
- if (msgtype!='joinleave') then return end
- local join=string.gmatch(tostring(msg) or "", "Player (.+) has joined the game")()
- if join then
- chat.AddText(green," ● ",team.GetColor(100) or teamcol,join,white," ",table.Random(joinmsgs))
- return true
- end
- local leave
- local leavemsg
- for _Name,_leavemsg in string.gmatch(tostring(msg) or "", "Player (.+) left the game %((.+)%)") do
- leave=_Name
- leavemsg=_leavemsg
- end
- if leave then
- leavemsg=leavemsg or ""
- if string.find(leavemsg,"time",1,true) then
- leavemsg="Crashed!"
- end
- if string.find(leavemsg,"Steam logon",1,true) then
- leavemsg="Blame steam!"
- end
- if string.find(leavemsg,"ERROR! Reliable snaphsot overflow.",1,true) then
- leavemsg="DISCONNECTED DUE TO TOO MUCH SPAM.\n=== GLOBAL WARNING: SERVER IS OVERFLOWING. PLEASE CLEAN UP YOUR PROPS TO PREVENT FULL CRASH ==="
- end
- if string.find(leavemsg,"Connection closing",1,true) then
- leavemsg="Reconnecting..."
- end
- leavemsg=string.gsub(leavemsg,"Kicked by Console : ","")
- leavemsg=string.gsub(leavemsg,"Disconnect by user%.",table.Random(discmsg))
- chat.AddText(red," ● ",team.GetColor(100) or teamcol,leave,white," left: ",gray,tostring(leavemsg))
- return true
- end
- MsgN("Unhandled join/disconnect message, dying: "..tostring(msg))
- hook.Remove('ChatText','JoinDisconnectReplace')
- end)
Advertisement
Add Comment
Please, Sign In to add comment