Last active
June 28, 2017 11:48
-
-
Save ValentinFunk/3bf0e70316fbab83c00a95d36c14d29e to your computer and use it in GitHub Desktop.
Give a random item from category
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local function GiveRandomItemFromCategory( ply, categoryName ) | |
local factory = Pointshop2.ItemFromCategoryFactory:new() | |
factory.settings = { | |
["ManualSettings.CategoryName"] = categoryName, | |
["BasicSettings.WeightedRandom"] = true | |
} | |
local item = factory:CreateItem( true ) | |
return ply:PS2_EasyAddItem( item.class.className ) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
e.g.