• Print

Author Topic: Disconnected players  (Read 9640 times)

0 Members and 1 Guest are viewing this topic.

Offline Willdy

  • Jr. Member
  • **
  • Posts: 54
  • Karma: 1
Disconnected players
« on: September 09, 2011, 03:31:14 pm »
Would it be possible for someone to make a plugin for ULX which would show recently disconnected players (last 5 or 10) and there Steam IDs?

I run a TTT server and many people join, RDM a bit then leave. We have made a simple lua plugin to display the SID of people when they disconnect but a few of our admins find it hard to read the console when the server is busy.

I suggest either a command.. ulx_displaydisconnect and it will show the last 5 or 10 people who disconnected, name and SID or a small GUI which shows 5-10 names.

Offline pikkip

  • Newbie
  • *
  • Posts: 27
  • Karma: 1
Re: Disconnected players
« Reply #1 on: January 01, 2012, 11:29:04 am »
That would be awesome to have yes, maybe it would be better that when they disconnect, it says in chat with the standard blue color: "Player [Name] ([SteamID]) disconnected from the game."

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Disconnected players
« Reply #2 on: January 01, 2012, 07:04:10 pm »
I think I always meant to get around to making something like this. Try the following:

Code: Lua
  1. local NUM_TO_KEEP = 10
  2. local recentDC = {}
  3. function ulx.recentDisconnects( calling_ply )
  4.         if #recentDC == 0 then
  5.                 ULib.console( calling_ply, "No recent disconnects to report" )
  6.                 return
  7.         end
  8.  
  9.         ULib.console( calling_ply, "Steam ID           IP              Name" )
  10.         for i=1, #recentDC do
  11.                 local str = string.format( "%-19s%-16s%s", recentDC[ i ].steamid, recentDC[ i ].ip, recentDC[ i ].name )
  12.                 ULib.console( calling_ply, str )
  13.         end
  14. end
  15.  
  16. local recentDisconnects = ulx.command( "Utility", "ulx recentdisconnects", ulx.recentDisconnects )
  17. recentDisconnects:defaultAccess( ULib.ACCESS_ADMIN )
  18. recentDisconnects:help( "Shows recently disconnected players." )
  19.  
  20. local function captureDC( ply )
  21.         table.insert( recentDC, 1, { name=ply:Name(), steamid=ply:SteamID(), ip=ply:IPAddress() })
  22.         if #recentDC > NUM_TO_KEEP then
  23.                 table.remove( recentDC )
  24.         end
  25. end
  26. hook.Add( "PlayerDisconnected", "ULXRecentDisconnects", captureDC )

Create a new file in addons/ulx/lua/ulx/modules/sh and paste that code in the new file. Only lightly tested, so let me know if there are any issues.

I'm open to including this in base ULX if you all think it fits well. :)
Experiencing God's grace one day at a time.

Offline pikkip

  • Newbie
  • *
  • Posts: 27
  • Karma: 1
Re: Disconnected players
« Reply #3 on: January 02, 2012, 08:51:01 am »
I also got another idea about this thing, then people is connecting, you can see that they do, because of GMod, but it don't says anything when they are on the server.

Is it possible to make some kinda when they spawn, people can see they spawned, ect. : [Name:rank color] Spawned as [Rank]

or something like that
« Last Edit: January 02, 2012, 11:11:21 am by pikkip »

Offline krooks

  • Sr. Member
  • ****
  • Posts: 382
  • Karma: 32
  • I don't like video games.
    • Diamond Krooks
Re: Disconnected players
« Reply #4 on: January 04, 2012, 09:07:40 am »
Great job Megiddo, no reason not to include it. Could be very very handy. I'm usually going through the console trying to find a person's join time so that I can get their steamID for a ban.
Maybe integrating this into XGUI's ban pannel, have a "recent disconnected" list in the drop down. That would be unbelievably handy.
My TTT server. Join the fun!

  • Print