Skip to content

CreateiObject

Create a iObject

Argument Data Type Needed Default Description
Id string/number - The id to manage the iObject
Model string/number - The mode of the iObject
Coords vector3 - The coordinates to create the iObject
Heading number - The heading to create the iObject
Interaction Distance number - The distance for the interaction
Network boolean - If the iObject is networked or not
Job string/table - The job to interact with the iObject
Returns
Data Type Description
iObject The object handle
vector3 The object coords

Dont need to be called every frame, if called every frame and the iObject already exist, sleep the loop for 100 ms to prevent spam


Example

Creating iObject

local iobj, coords = CreateiObject("myid", "prop_weed_01", vector3(-239.89, -989.42, 28.29), 0.0, 5.0)

How to listen the interaction

For listen the interaction you need to use the emitter

Example

-- This create the iObject
local iobj, coords = CreateiObject("myid", "prop_weed_01", vector3(-239.89, -989.42, 28.29), 0.0, 5.0)

-- Listening the interaction
On("object", function(id)
    if id == "myid" then
        print("Hello")
    end
end)
LSS: If i press E near the iObject in the F8 console will be printed Hello


Last update: October 31, 2022
Created: June 27, 2021