Skip to main content

CreatePersistentEntity

Description

Creates and spawns a persistent non-ped object (such as machines, props, or interactable objects) in the world.

function CreatePersistentEntity(modelname, x, y, z, rotation, area) --[[ ... ]] end

Parameters

  • modelname: string - The object’s modelname (e.g. "DPI_Fraffy").
  • x: integer - X coordinate for the spawn position.
  • y: integer - Y coordinate for the spawn position.
  • z: integer - Z coordinate for the spawn position.
  • rotation: integer - Rotation angle for the object.
  • area: integer - The area code in which to spawn the object.

Return Values

  • objectID: integer - The object ID.
  • objectPool: integer - The object pool index.

Example

-- Spawn a Beam Soda machine (plus its interactable entity) in front of the Boys' Dorm.
Soda1, Soda2 = CreatePersistentEntity("DPI_Fraffy", 270, -114, 6.15, 180, 0)
pxSoda1, pxSoda2 = CreatePersistentEntity("pxFraffy", 270, -114, 6.15, 180, 0)

See Also