Hi, I have a problem with the command giveitem.
When I type the correct command like /giveitem 1 bread 1 i get this error:
Can somebody help me?
Hi, I have a problem with the command giveitem.
When I type the correct command like /giveitem 1 bread 1 i get this error:
Item added to database and inventory started?
Yes, i started the inventory
This is a part of the database; I was trying to give mi WEAPON_PISTOL that is in the database
Well then It seems like a problem of es_extended…
Could you send the function that includes string 60?
you mean the string 60 in commands.lua?
Yeah exactly
Not only string 60 but all it’s function
Here it is
You need to get the esx player object with
ESX.GetPlayerFromId(args[1]) — assuming that the first argument is the player id
Then the function returns the player object which have the function addInventoryItem
ok, so what will the function look like?
ESX.GetPlayerFromId(args[1]).addInventoryItem(args[2], args[3])
Looking at the code
Shouldnt it be xplayer.function rather then args.function?
not in es_extended apparently. and my works fine
My code looks the same for me as his.
I’ve used this function but the error doesn’t change
ESX.RegisterCommand('giveitem', 'admin', function(xPlayer, args, showError)
ESX.GetPlayerFromId(args[1]).addInventoryItem(args[2], args[3])
end, true, {help = _U('command_giveitem'), validate = true, arguments = {
{name = 'playerId', help = _U('commandgeneric_playerid'), type = 'player'},
{name = 'item', help = _U('command_giveitem_item'), type = 'item'},
{name = 'count', help = _U('command_giveitem_count'), type = 'number'}
}})
then send us the screenshot of functions.lua 130
which version of esx you’re using?
where can I see it? I’ve downloaded it on github but I don’t remember.
I think is the latest because it doesn’t use the essentialmode database but only the es_extended
EDIT: es_extended is at version 1.2
Somebody know how to help me?