uen / Leveling-System

Leveling system in gLua (For DarkRP)
Other
35 stars 22 forks source link

Printers for certain ranks. #43

Closed dsgassassin closed 8 years ago

dsgassassin commented 8 years ago

Hi,

I know this question has been "answered" before, but the answer is of little use, I've tried several different ways of restricting printers to certain ranks, but to no avail, I was wondering if you could help?

local Printer={} Printer.Name = 'Ruby Printer' Printer.Type = 'ruby' Printer.XPPerPrint = 0 Printer.MoneyPerPrint = 250 Printer.Color = Color(185,0,0) Printer.Model = 'models/props_lab/reciever01a.mdl' Printer.Price = 12500 Printer.Level = 0 Printer.Prestige = 0 customCheck = function(ply) return table.HasValue({"vip_user", "vip_respected", "vip_moderator", "vip_senior_moderator", "vip_admin", "vip_sadmin", "vip_superadmin"}, ply:GetUserGroup() == "vip_user") end customCheckFailMsg = "In order to use this printer, you must donate to become a VIP." table.insert(Printers,Printer)

That custom check doesnt work... Can you tell me a WORKING way to do this? Thanks

uen commented 8 years ago

You've added a random custom check in the middle of the file, that's not even how it's done in DarkRP

https://github.com/vrondakis/Leveling-System/issues/38

You need to use Printer.CustomCheck

dsgassassin commented 8 years ago

I just tried that and no luck, everyone can still spawn those printers, any ideas?

uen commented 8 years ago

--Not a bug report, 'tried that and no luck' doesn't help

dsgassassin commented 8 years ago

Printer.CustomCheck

or #38

Printer.CanBuy

You suggested two different ways of doing this, both of which don't work and don't spit any errors at you, the only information I can give you is that it DOESN'T work.

uen commented 8 years ago

I added Printer.DParams, so you can add whatever you want to the default DarkRP item table

example:

local Printer = {}
Printer.Name = 'Whatever'
...
Printer.DParams = {
    ent = 'yourcustomentity',
    sortOrder = 100,
    customCheck = function(ply) return ply:GetUserGroup() == "donator" end,
    CustomCheckFailMsg = function(ply, entTable) return "You need to be a donator to buy this entity!" end
}

table.insert(Printers,Printer)

which will override the default settings in this system