• Print

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

0 Members and 1 Guest are viewing this topic.

Offline Patrick Palson

  • Newbie
  • *
  • Posts: 7
  • Karma: 0
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

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

  • Print