Pointshop random boxes

So i was wondering if someone could possibly help me setup some random boxes for the pointshop?
I have a table configured i just want to learn how to create a function that when you buy the box(s)
then you will get a random pointshop item (whoa amazing :P).
I will also like it so it sells or removes the box from owner ship so you cant equip it. Thanks for any help
or showing me where i could possibly learn how to do this.
One last thing would it be possible to have a noticafaction pop up on the users screen to tell them what
they have won from the shop?
Any help on where i could learn any of this will be greatly appreciated.



ITEM.Name = 'Shit Box'
ITEM.Price = 25000
ITEM.Model = 'Wood box model goes here later :P'
ITEM.SingleUse = true

tableshit = {"item lua file name", "another one here", "Lets add another for a good example"

function ITEM:OnBuy( player )
	
end


This? http://coderhire.com/scripts/view/918

No i want to make something different then that. I have seen what i am making once before so i know it can be done i just am unsure how.
I also understand that it will require the



table.random( tablenamehere )


Well, you won’t get anyone coding for you for free here. Go on coderhire and start a job application.

I dont want you to code it for me. if you were kind enough to read the OP. I was asking for help on how to do this my self.

What have you tried so far, show some code of how you believe the function should be.

It’s impossible to “help you do it” when you don’t know how to code lua yourself. It would be like us doing it for you and teach you at the same time.

Not sure how to make it remove the item automatically though



ITEM.Name = 'Shit Box'
ITEM.Price = 25000
ITEM.Model = 'models/props_junk/wood_crate001a_damaged.mdl'
ITEM.SingleUse = true

tableshit = {"bubbles", "spooks", "nevermore"}

function ITEM:OnBuy( player )
            print (You got ..table.Random(tableshit).. from you shit box )
            ITEM.Give ( ..table.Random(tableshit).. )
end


So i did an little screwing around with it and i now get this-



ITEM.Name = 'Shit Box'
ITEM.Price = 25000
ITEM.Model = 'models/props_junk/wood_crate001a_damaged.mdl'
ITEM.SingleUse = true

tableshit = {"bubbles", "spooks", "nevermore"}

function ITEM:OnBuy( ply )
        print "You got" table.Random(tableshit) "from your shit box!"
		ply:Give ( table.Random(tableshit))
end



That’s because you’re giving them a string, not an entity or weapon.

And what Nookyava said.


print "You got" table.Random(tableshit) "from your shit box!"

What.

[lua]print(“You got " … table.Random(tableshit) … " from your shit box!”)[/lua]

Also does what you’re after, plus some.

As stated above I am trying to learn lua not buy some scripts. And this isnt what i want at all. I want a simple item in the pointshop that gives you a random item that could be worth more then the box or less then the box.

[editline]22nd March 2014[/editline]

So i am having an issue with the table and the giving of the item(s).
Every thing seems right and i am not getting any errors any more.



tableshit = {"donators/nevermore.lua"}




        ply:PS_GiveItem(table.Random(tableshit))


My system gives you crates. Which you open for a random item in pointshop :wink:

But ok. I’d be up for helping you, however pc died. Hopefully someone can step in though.

Also, quick hint, try

[lua]
local tableshit = {“nevermore”}
[/lua]

Pointshop Items are specified by the lua file’s name, which becomes it’s ID, hence nevermore.lua becomes nevermore in Pointshop.

Ok thank you i was confused on that as i was told to use thier lua file name but i got a ton of different people saying what it needs to be

So how would i make the pointshop items in to an entity? Would i put the model for the items in the table?

Since you’re only giving them a string and not the entity (I assume is the follower “Nevermore”) I’d assume in that string you’d give them the entity that the follower uses rather than the name