Author Topic: Restricting entities to ULX Groups? Is it possible?  (Read 163 times)

0 Members and 1 Guest are viewing this topic.

Offline Patrick Palson

  • Newbie
  • *
  • Posts: 7
  • Karma: 0
    • View Profile
Restricting entities to ULX Groups? Is it possible?
« on: December 02, 2016, 02:29:05 PM »
Hi, as you can probably see, I'm new to these forums and I just joined today.

I came here because this is the site of ULX and the problem I'm having is related to ULX Groups.

Whenever I restrict a printer (DarkRP Printer) to only show up in the buy menu if you match the ulx group, it works and doesn't work, I've tried many custom checks, and when it doesn't work, all printers don't show up, when it does work, the ranks that can only see it, are not able to spawn it in, they'll buy it, it'll use their money, but no printer spawns.

When I take the custom check out entirely, anybody can buy the printer, and it DOES spawn.

Here's the file I'm struggling with, how do I make it only show up in the menu to specific ranks, and still spawn when that specific rank buys the printer?
sh_init.lua

Code: Lua
  1. DarkRP.createEntity("VIP Money Printer", {
  2.     ent = "vip_money_printer",
  3.     model = "models/props_c17/consolebox01a.mdl",
  4.     price = 25000,
  5.     max = 2,
  6.     cmd = "buyvipmoneyprinter"
  7.  

Here's one of the MANY things that I've tried:
Code: Lua
  1. customCheck = function(ply) return CLIENT or
  2.    table.HasValue({VIP, VIP+, admin, superadmin, Owner}, ply:GetNWString("usergroup"))
  3. end,
  4. CustomCheckFailMsg = "This is VIP only!"

But, like I've said, when the check works right, the printer never spawns upon purchase, I'm stuck here, any help is appreciated!
« Last Edit: December 02, 2016, 02:32:57 PM by Patrick Palson »

Offline iViscosity

  • Hero Member
  • *****
  • Posts: 509
  • Karma: 22
    • View Profile
    • iViscosity Gaming
Re: Restricting entities to ULX Groups? Is it possible?
« Reply #1 on: December 14, 2016, 04:26:29 AM »
Instead of GetNWString, do ply: GetUserGroup().
Also, why do you have CLIENT there?

One way I did it back when I had a darkrp server, if you have inheritances in a linear tree (VIP < VIP+ < admin < superadmin) you could make the customcheck
Code: Lua
  1.  customCheck = function( ply )
  2.     return ply:CheckGroup( "VIP" )
  3. end,
or whatever the lowest rank you want to have it is.

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.