Pivity

PS2 Add Item Command

Last read Never
#1

Hi, I'm trying to add a ps2 add item command there is documentation on it however I don't understand it.

http://pointshop2.kamshak.com/en/latest/developer/points.html#giving-items

Many thanks

Chris

#2

In the Code example they give


function GiveItemByPrintName( ply, printName )
local itemClass = Pointshop2.GetItemClassByPrintName( printName )
if not itemClass then
error( "Invalid item " .. tostring( printName ) )
end
return ply:PS2_EasyAddItem( itemClass.className )
end
GiveItemByPrintName( player.GetByID( 1 ), "Gas Mask" )


This is exactly what you're looking for, in your command you'll just need to get the Player ID and Pass it to

GiveItemByPrintName( player.GetByID( 1 ), "Gas Mask" )


And obviously the print name of the item you'd want :)

All this function does is

local itemClass = Pointshop2.GetItemClassByPrintName( printName )
  1. Tell PointShop2 to get the item information of printName ( So this would be the normal text name you'd see of an item )

Next it checks if the item is a valid item or not


Then it just adds the item to the player object on the ID you provided :)


Hope I helped.

Users viewing this thread
Nobody