ULX Command to add Pointshop2 Items

So I noticed the lack of an easy to access and use command to give people items in PS2 with ulx and given the give item funcion of PS2 has been slightly broken recently(Not sure if that’s just for me or not but whatever). So I decided to make a command to easily spawn items for people on pointshop. The code for it is below if you want to add it to a file yourself and I there will also be a guthub link to download a file you can just drag and drop straight into addons if you don’t know how to install it yourself.

------------------------------ ADDITEM ------------------------------
function ulx.ps2additem( calling_ply , target_plys, item, amount)
	local itemClass = Pointshop2.GetItemClassByPrintName ( item )
	if not itemClass then 
		ULib.tsayError( calling_ply,item .. " is not a valid item names." )
	elseif tonumber(amount) > 10 then
		ULib.tsayError( calling_ply, "You can only give a maximum of 10 items at a time." )
		for k, v in pairs (target_plys) do
			if tonumber(amount) == 1 then
				ulx.fancyLogAdmin(calling_ply, true, "#A Gave a ".. item .. " to #T", target_plys)
				ulx.fancyLogAdmin(calling_ply, true, "#A Gave ".. amount .. " " .. item .. "s to #T", target_plys)				
			for i=1, amount do
				v:PS2_EasyAddItem( itemClass.className )
local ps2additem = ulx.command( "Utility", "ulx ps2additem", ulx.ps2additem, "!ps2additem", true )
ps2additem:defaultAccess( ULib.ACCESS_SUPERADMIN )
ps2additem:addParam{ type=ULib.cmds.PlayersArg }
ps2additem:addParam{ type=ULib.cmds.StringArg, hint="item"}
ps2additem:addParam{ type=ULib.cmds.StringArg, hint="amount", ULib.cmds.takeRestOfLine}
ps2additem:help( "Adds an item to a players inventory" )

As it is the maximum amount of items you can spawn at a time is 10 however that can be changed in the if statement on line 6. It’s super easy to use the command just type !ps2additem <name> <item> <amount>
If you have any suggestions for other commands I should make or anything i may have done wrong with this command be sure to comment below.

GitHub Download: https://github.com/Takail/PS2AdditemCommand

Oh my god, does this work for offline users too? I haven’t been able to give items to offline users in pointshop 2 for months.

No, this wouldn’t work for offline users unfortuantly but if you give me a day or two i can look into making a command for that as well.

That would be great and help a lot because Kamshak has bascially all but ignored my pleas for help :frowning: lol