Examples
Glitch Spawn Objects is a lightweight and efficient FiveM resource designed to spawn, synchronise, and persist world objects seamlessly across all players on the server.
Usage Examples
-- Basic object spawning
/spawnobject-- View all synced objects in the area
/syncedobjectsClient Exports
-- Standard get closest object
local closestObj, distance = exports['glitch-spawnobjects']:getClosestObject()
-- Get closest object to specific coordinates
local coords = vector3(100.0, 200.0, 30.0)
local closestObj, distance = exports['glitch-spawnobjects']:getClosestObject(coords)
-- Get closest object within 50 units of player
local closestObj, distance = exports['glitch-spawnobjects']:getClosestObject(nil, 50.0)
-- Get closest object within 25 units of specific coordinates
local coords = vector3(100.0, 200.0, 30.0)
local closestObj, distance = exports['glitch-spawnobjects']:getClosestObject(coords, 25.0)
-- Check if an object was found
if closestObj then
print('Found closest object:', closestObj.model, 'at distance:', distance)
print('Object ID:', closestObj.id)
print('Position:', closestObj.posX, closestObj.posY, closestObj.posZ)
else
print('No objects found within range')
endServer Exports
Parameter
Description
Parameter
Description
Parameter
Description
Last updated