DirkScripts
Docs
Objects
βΉοΈ Client Module - This can only be used on the client
#lib.objects.register
Create a new object
lualib.objects.register(name, new_data)
| Parameter | Type | Required | Description |
|---|---|---|---|
| name | String | true | Unique reference for object |
| new_data | Object | true | Options for the object, refer to Data Structure |
#lib.objects.get
Get information regarding an object
lualocal obj = lib.objects.get(name)
| Parameter | Type | Required | Description |
|---|---|---|---|
| id | String | true | Unique reference for the object |
#lib.objects.destroy
Completely remove an object
lualib.object.destroy(id)
| Parameter | Type | Required | Description |
|---|---|---|---|
| id | String | true | Unique reference for the object |
#Data Structure
This is the data structure of an object and the valid options
lua{ type = "ped", -- ped, vehicle, object, or weapon model = `a_f_m_bevhills_01`, -- Model hash pos = vector4(0, 0, 0, 0), -- Position (also accepts vector3) rotation = vector3(0, 0, 0), -- Optional rotation renderDist = 50, -- When to render the object freeze = true, -- Freeze the entity in place collision = true, -- Enable collision invincible = true, -- Make entity invincible zone = { -- Optional: auto-spawn/despawn zone radius = 50, onEnter = function() end, onExit = function() end, }, onSpawn = function(entity) -- Called when entity spawns end, onDespawn = function(entity) -- Called when entity despawns end, }
