You can also read this README in Portuguese.
vrp_worlditems
is a vRP resource for FiveM that creates items related to props.
- Make sure your artifacts (windows or linux) are up to date and
onesync
is activated. - Download the latest zip file at releases and extract it at your resources folder.
- Add
ensure vrp_worlditems
in yourserver.cfg
. - Configure the item models and the despawn time in the
config.json
file.
Creates a world item in the specified position or, if not passed, in the current player's position and returns it.
Arguments:
- player: number
- item_id_name: string
- item_amount: number
- position: vector3
Example:
local world_item = exports['vrp_worlditems']:createWorldItem(GetPlayers()[1], 'donut', 3, vector3(393.26, -1813.78, 28.99))
print(json.encode(world_item, {
indent = true
}))
Delete the world item with the specified id.
Arguments:
- id: string
Example:
local world_item = exports['vrp_worlditems']:createWorldItem(GetPlayers()[1], 'donut', 3)
SetTimeout(15000, function ()
exports['vrp_worlditems']:deleteWorldItem(world_item.id)
end)
Update the world item amount with the specified id.
Arguments:
- id: string
- amount: number
Example:
local world_item = exports['vrp_worlditems']:createWorldItem(GetPlayers()[1], 'donut', 3)
SetTimeout(5000, function ()
exports['vrp_worlditems']:updateWorldItemAmount(world_item.id, 10)
end)
Returns a world item with the specified id or nil
if not found.
Arguments:
- id: string
Example:
local world_item = exports['vrp_worlditems']:getWorldItem('0e2a7230-407f-4cc6-8aab-c490c0deb876')
print(json.encode(world_item, {
indent = true
}))
Returns a list with all the world items.
Example:
local world_items = exports['vrp_worlditems']:getWorldItems()
print(json.encode(world_items, {
indent = true
}))
- id: string
- idName: string
- name: string
- description: string
- weight: number
- amount: number
- prop:
- entityId: number
- networkId: number
- position: vector3
- Matheus Rodrigues - Infrastructure and Code Review
- Marco - Code Review
- UtinhaSz - Testing
Report any problem you have and try to provide all information about it.
Feel free to contribute and improve the code and the repository.