• Print

Author Topic: Checking group/ULib ban database without player being present  (Read 4372 times)

0 Members and 1 Guest are viewing this topic.

Offline jakej78b

  • Newbie
  • *
  • Posts: 26
  • Karma: 4
Probably a very stupid question with a very stupid answer but that's how I always feel so here it goes: I found a mod that is pretty much a custom ban message that works fine, and it uses a table named ULib.bans which is not specified anywhere in the ULib documentation, but it works anyways. I was wondering if there was a ULib table to get admins outside of the game without the player. What I'm wanting to do is make a server where only vips can join, where I assign them with ulx adduserid. Here is my start, I hope there is something I can do to finish it.

Code: [Select]
function GAMEMODE:CheckPassword( steamid64, ip, sv_password, cl_password, cl_name )
if( string.len( sv_password ) > 0 and sv_password ~= cl_password )then
return false, "Bad Password"
end

local steamid = util.SteamIDFrom64( steamid64 )
local admins = ULib.admins[ steamid ] -- In search of something that takes steamid and returns rank..?

if table.HasValue( {"vip","admin","superadmin"}, admins) then
return
end
return false, "VIPs Only!"
end
Also how do I make the code in lua format?
« Last Edit: May 16, 2014, 06:04:16 pm by jakej78b »

Offline Stickly Man!

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 1270
  • Karma: 164
  • What even IS software anymore?
    • XGUI
Re: Checking group/ULib ban database without player being present
« Reply #1 on: May 17, 2014, 12:31:05 am »
If I'm remembering correctly, you can find all of the users information stored in the "ULib.ucl.users" table. Do a PrintTable() on it and you'll see what it outputs, but it would work something like this: (untested)
Code: Lua
  1. local user = ULib.ucl.users[steamid]
  2. if user then
  3.   local group = user.group
  4. end
Gah, coffescript is ruining how I think about lua.

Also, the BBCode for lua is just [ code=lua ] [ /code ]
Join our Team Ulysses community discord! https://discord.gg/gR4Uye6

Offline jakej78b

  • Newbie
  • *
  • Posts: 26
  • Karma: 4
Re: Checking group/ULib ban database without player being present
« Reply #2 on: May 17, 2014, 12:28:59 pm »
Thanks, that helped a ton!

Fixed my second problem, apparently ULib uses string for ban so instead of ban.unban == 0 I used ban.unban == "0" just kinda derped there. Thanks for the help tons!
« Last Edit: May 17, 2014, 09:11:22 pm by jakej78b »

  • Print