• Print

Author Topic: Message Printing Twice  (Read 11825 times)

0 Members and 1 Guest are viewing this topic.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2727
  • Karma: 430
    • |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

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 803
  • Karma: 58
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 PM.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2727
  • Karma: 430
    • |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: 2727
  • Karma: 430
    • |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

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 803
  • Karma: 58
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 PM.

  • Print