DarkRP, Check Pocket Items

Hi. Is there a way to check players pocket/inventory in DarkRP, to allow or disallow that player to buy certain items.
I want to make it so that players can only buy a certain item if they have a permit in their inventory.

Example: (Not working)


DarkRP.createFood("Example Supplements", {
    model = "models/weapons/w_packate.mdl",
    energy = 0,
    price = 0,
	requiresCook = 0,
	category = "Testing",
	buttonColor = Color(0, 0, 0, 0),
	customCheck = function (ply) return ply:getPocketItems("permit") end,
})

Did you read the darkrp wiki?

http://wiki.darkrp.com/index.php/Functions/Player/Shared/getPocketItems

It says in there, it returns a table of the stuff in the player’s pockets. It does not take any arguments.

I did yes, that’s where I got that line from, I know it doesn’t work that’s why I’m wondering if there is another way.

You aren’t telling us how it’s not working…

no, he’s saying you need to write your code with respect to what the functions Actually do, not what you Think they do.

What you’ve got isnt going to work and he has just told you why.

Alright, I made an entity to give run the command upon use for the activator.


print(activator:getPocketItems())

What it prints into the console:


table: 0x66aff260

This; “0x66aff260”, is one of ten diffrent numbers and letters it prints. All of them seem to be random. I don’t know what to do to make it check if I have a certain item/entity in my pocket/inventory.

did you write this code yourself?
just a friendly reminder that this forum is called Developer Discussion, as it is the place where developers discuss.
If you’re looking for a dev to write code for you try www.gmodstore.com instead

Sorry for asking for help…

I’ll try to be more clear this time, in the hopes that my question can be answered.
The example I made in the first post was a none working one because I don’t know how to actually make it work. I just provided a quick example to try and make it clearer about what I was trying to do. In this case, use the customCheck to see if the player has a “permit”(a made up entity name) in his or her inventory/pocket, and if so allow the player to buy the item.
I wrote the example myself with the DarkRP.CreateFood base, since that’s how you add food in DarkRp.

It provides a table so I’m just going to assume you have to iterate through the table to find the item you’re looking for?