Author Topic: Message Printing Twice  (Read 907 times)

0 Members and 1 Guest are viewing this topic.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2554
  • Karma: 391
    • View Profile
    • |G4P| Gman4President
Re: Message Printing Twice
« Reply #15 on: January 07, 2017, 12:18:02 AM »
Oh.. you might want to make sure that they are in UCL..

ULib.ucl.getUserInfoFromID( sid ) will be nil if there isn't any info for that steamid, so you can't index it.

Offline iViscosity

  • Hero Member
  • *****
  • Posts: 676
  • Karma: 34
    • View Profile
    • iViscosity Gaming
Re: Message Printing Twice
« Reply #16 on: January 07, 2017, 08:52:53 AM »
Ah so if they're the 'user' rank they're not considered in UCL?
I'm iViscosity. I like gaming and programming. Need some help? Shoot me a PM or Join my Discord!.
--==[ Links ]==--
Steam
YouTube
Steam Group (feel free to join!)
Forums
Public Discord
Teamspeak

Quote from: Steve Jobs
Your work is going to fill a large part of your life, and the only way to be truly satisfied is to do what you believe is great work. And the only way to do great work is to love what you do. If you haven't found it yet, keep looking. Don't settle. As with all matters of the heart, you'll know when you find it. And, like any great relationship, it just gets better and better as the years roll on. So keep looking until you find it. Don't settle.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2554
  • Karma: 391
    • View Profile
    • |G4P| Gman4President
Re: Message Printing Twice
« Reply #17 on: January 07, 2017, 09:33:32 AM »
That's correct.

Ucl only registers players who have been given access. All other players fall back into the user group, but it doesn't store them in the table.

Could you imagine how massive the access table would get if every player was added to it?

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2554
  • Karma: 391
    • View Profile
    • |G4P| Gman4President
Re: Message Printing Twice
« Reply #18 on: January 07, 2017, 09:39:11 AM »
This would work. I'm storing the group to a local string var before the check, and I'm only indexing the UCL table if it exists.

Code: Lua
  1. if SERVER then
  2.    gameevent.Listen( 'player_disconnect' )
  3.    hook.Add( "player_disconnect", "Announce Leaves", function( data )
  4.       local name = data.name
  5.       local sid = data.networkid
  6.       local bot = data.bot
  7.       local reason = data.reason
  8.       local group = "user"
  9.          
  10.       if ULib.ucl.getUserInfoFromID( sid ) then
  11.          group = ULib.ucl.getUserInfoFromID( sid ).group
  12.       end
  13.  
  14.  
  15.       if group == "superadmin" then
  16.          ULib.tsayColor( _, "", white, "[", announce, "VG Disconnect", white, "] [OWNER] ", name_col, name, white, " {", red, sid, white, "} has left the Server. Reason: " .. reason )
  17.       else
  18.          ULib.tsayColor( _, "", white, "[", announce, "VG Disconnect", white, "] ", name_col, name, white, " {", red, sid, white, "} has left the Server. Reason: " .. reason )
  19.       end
  20.    end )
  21. end
  22.  

Offline iViscosity

  • Hero Member
  • *****
  • Posts: 676
  • Karma: 34
    • View Profile
    • iViscosity Gaming
Re: Message Printing Twice
« Reply #19 on: January 07, 2017, 09:56:27 AM »
Thank you very much. Now that I think about it that would be a massive table if everyone was stored in it... So in this case if they have access, check it, but if not just ignore it... Ok makes sense. Thanks for your help.

Sent using Tapatalk. Owner of iViscosity Gaming.

I'm iViscosity. I like gaming and programming. Need some help? Shoot me a PM or Join my Discord!.
--==[ Links ]==--
Steam
YouTube
Steam Group (feel free to join!)
Forums
Public Discord
Teamspeak

Quote from: Steve Jobs
Your work is going to fill a large part of your life, and the only way to be truly satisfied is to do what you believe is great work. And the only way to do great work is to love what you do. If you haven't found it yet, keep looking. Don't settle. As with all matters of the heart, you'll know when you find it. And, like any great relationship, it just gets better and better as the years roll on. So keep looking until you find it. Don't settle.