Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local ITEM = BRICKS_SERVER.Func.CreateItemType( "custom_printer" ) -- This line creates the item, the argument should be the entity class.
- ITEM.GetItemData = function( ent ) -- This function is used for getting the data from an entity
- local itemData = { "custom_printer", ent:GetModel() } -- The 1st value should be the entity class and the 2nd the model
- itemData[3] = ent:GetMoney() -- Any other values can be used for entity specific data
- return itemData, 1 -- You need to return two values, the first is the itemData and the second is the amount
- end
- ITEM.OnSpawn = function( ply, pos, itemData, itemAmount ) -- This function is used when the entity is dropped
- local ent = ents.Create( "custom_printer" )
- if( not IsValid( ent ) ) then return end
- ent:SetPos( pos )
- ent:SetModel( itemData[2] )
- ent:SetMoney( itemData[3] )
- ent:Spawn()
- end
- ITEM.GetInfo = function( itemData ) -- This function returns info about the entity, the itemData is provided here
- return { "Money Printer", "A basic money printer!", (BRICKS_SERVER.CONFIG.INVENTORY.ItemRarities or {})["custom_printer"] } -- The 1st value is the name, the 2nd is the description and the 3rd is the item rarity
- end
- ITEM:Register()
Advertisement
Add Comment
Please, Sign In to add comment