Python1320

Python1320

Sep 4th, 2010
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.03 KB | None | 0 0
  1.  
  2. local tagcol=Color(100,100,100)
  3. local teamcol=Color(80,151,199)
  4. local white=Color(255,255,255)
  5. local green=Color(0,255,0)
  6. local red=Color(255,0,0)
  7.  
  8. local joinmsgs={
  9.     "is attending",
  10.     "is attending the sessions",
  11.     "wants to game",
  12.     "is joining",
  13.     "is coming to the server",
  14.     "is sending tcp packets",
  15.     "is coming!!!!",
  16.     "is in connect state",
  17.     "joining the server",
  18.     "is joining the server",
  19.     "is joining the game",
  20.     "joining the server",
  21.     "is knocking the gates",
  22.     "is signing in",
  23.     "will be here shortly",
  24.     "should arrive shortly",
  25.     "joining the game",
  26. }
  27.  
  28. local discmsg={
  29.     "left",
  30.     "no longer interest",
  31.     "fuck this shit",
  32.     "left the server",
  33.     "had enough",
  34.     "hit the wrong button",
  35.     "just disconnected",
  36.     "I wonder what this button does",
  37.     "bye",
  38.     "baibai",
  39.     "found better things to do",
  40.     "disconnected",
  41.     "leaving",
  42.     "unattending the session",
  43.     "abandoned the server",
  44.     "brb, gentoo",
  45. }
  46.  
  47. hook.Add('ChatText','JoinDisconnectReplace', function ( UserID, Name, msg, msgtype )
  48.    
  49.     if (msgtype!='joinleave') then return end
  50.    
  51.     local join=string.gmatch(tostring(msg) or "", "Player (.+) has joined the game")()
  52.     if join then
  53.    
  54.         chat.AddText(green," ● ",team.GetColor(100) or teamcol,join,white," ",table.Random(joinmsgs))
  55.    
  56.         return true
  57.    
  58.     end
  59.    
  60.     local leave
  61.     local leavemsg
  62.     for _Name,_leavemsg in string.gmatch(tostring(msg) or "", "Player (.+) left the game %((.+)%)") do
  63.         leave=_Name
  64.         leavemsg=_leavemsg      
  65.     end
  66.    
  67.     if leave then
  68.    
  69.         leavemsg=leavemsg or ""
  70.         leavemsg=string.gsub(leavemsg,"Kicked by Console : ","")
  71.         leavemsg=string.gsub(leavemsg,"Disconnect by user%.",table.Random(discmsg))
  72.         if string.find(leavemsg,"time",1,true) then
  73.             leavemsg="Crashed!"
  74.         end
  75.        
  76.         if string.find(leavemsg,"steam logon",1,true) then
  77.             leavemsg="Blame steam!"
  78.         end
  79.    
  80.         chat.AddText(red," ● ",team.GetColor(100) or teamcol,leave,white," left: ",Color(200,200,255),tostring(leavemsg))
  81.        
  82.         return true
  83.        
  84.     end
  85.    
  86.     error("Unhandled join/disconnect message, dying: "..tostring(msg))
  87.  
  88. end)
Advertisement
Add Comment
Please, Sign In to add comment