Item Giving Function

Item Giving Function

How to give items through functions

Method 1

This method depends on the id of the item

local item = wOS:GetItemData( itemno )
wOS:HandleItemPickup( ply, item.Name )


Replace "itemno" with the id of the item you wish to give the player, to find the id of an item type "wos_listitems" in your clientside console

If their inventory is full then it won't give it to them.

If you are trying to give an item like this multiple times, and do not want to mix them up, define different values to each item id, and make sure to replace the value in the function aswell

 

Examples of this as shown:

local item1 = wOS:GetItemData( item1no )
local item2 = wOS:GetItemData( item2no )

wOS:HandleItemPickup( ply, item1.Name )
wOS:HandleItemPickup( ply, item2.Name )

 

 

Method 2

This method depends on the string name of the item

wOS:HandleItemPickup( ply, "(Name of Item)")

With this you will replace the (Name of Item) with the actual name of the item, make sure to keep the quotation mark

 

Examples of this as shown:

wOS:HandleItemPickup( ply, "Crystal ( Green )")

  • 1 Users Found This Useful
Was this answer helpful?

Related Articles

Set Permissions For wOS Admin Commands

How to configure permissions for wOS admin commands "Admin Commands" refer to the console...

Console Commands

wOS admin console commands wos_openadminmenu - Opens a menu that allows you to set peoples...

XP Giving Function

Giving XP Through Code How to give XP through functions   ply:AddSkillXP( number )   You can...

Item Spawning Function

Item Spawning Function How to spawn items with a function Method 1 This method depends on the...