• Pointshop CalculateBuyPrice Multiple Ranks
    6 replies, posted
I did this in the past but I totally forget how I did it and I lost my code for it. I'm trying to discount the prices for multiple groups (all the same discounted price) but I'm not sure how to go about doing it. I need to do it for 2 ranks at 90% discount and 4 ranks at a 50% discount. Would you be able to make a table to do this? I'm not very good with lua so I apologize. [code] PS.Config.CalculateBuyPrice = function(ply, item) -- You can do different calculations here to return how much an item should cost to buy. -- There are a few examples below, uncomment them to use them. -- Everything half price for admins: -- if ply:IsAdmin() then return math.Round(item.Price * 0.5) end -- 25% off for the 'donators' group -- if ply:IsUserGroup('donators') then return math.Round(item.Price * 0.75) end return item.Price end [/code]
Anyone have any ideas on how I could go about doing this? I would really appreciate it :)
................... It litteraly says exactly how to do it in the code Just replace 'donator' with whatever group name you want and the multiply value to whatever you want
if ply:IsUserGroup('donators') then return math.Round(item.Price * 0.75) end there u go bud, so hard to write but done it :):)
No no, with multiple ranks.. I was told that its not a good idea to repeat it.. example "donator" and "donator+"
Then do something like: [CODE] if ply:IsUserGroup( "donator", "donator+" ) then return math.Round(item.Price * 0.75) end [/CODE]
[QUOTE=Aeternal;46880980]Then do something like: [CODE] if ply:IsUserGroup( "donator", "donator+" ) then return math.Round(item.Price * 0.75) end [/CODE][/QUOTE] Thank you :)
Sorry, you need to Log In to post a reply to this thread.