Item Spawning Function
How to spawn items with a function
Method 1
This method depends on the id of the item
local item = wOS:GetItemData( itemno )
wOS:CreateSaberItem( ply:GetPos(), item )
Replace "itemno" with the id of the item you wish to spawn on the player, to find the id of an item type "wos_listitems" in your clientside console
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:CreateSaberItem( ply:GetPos(), item1)
wOS:CreateSaberItem( ply:GetPos(), item2)
Method 2
This method depends on the string name of the item
wOS:CreateSaberItem( ply:GetPos(), "(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:CreateSaberItem( ply:GetPos(), "Crystal ( Green )" )
How to change where the item spawns
In the last examples we had made it so the item would only spawn on the player, to change that we will edit the first parameter in the function, in this case being ply:GetPos() to a vector
Vectors will allow us to spawn items in specific locations, to get the vector of a point you like, type "getpos" in console
It will return something like this: setpos 704.666809 -380.561432 -79.968750;setang 14.683965 -63.647835 0.000000
We want to take those first three numbers, and integrate them into a vector like this: Vector(704, -380, -79)
We will now get rid of the ply:GetPos() value and place our vector there in its place
Example of this:
wOS:CreateSaberItem(Vector(704, -380, -79), "Crystal ( Green )" )