Entity, Vehicle & Peds
Functions.CreatePed()
This function is used to create a ped (NPC character) in the game world. It requests the model with the specified modelHash
, waits for the model to load, and then creates the ped at the specified position. If isNetwork
is set to true
, it triggers a server event to register the entity. The created ped entity is added to the PMM Entities table.
Parameters:
pedType
: An integer representing the type of ped to create.modelHash
: A hash value representing the model of the ped.position
: A vector3 representing the position where the ped should be created.isNetwork
: A boolean indicating whether the ped is networked.cb
: A callback function to be executed, taking the ped entity as a parameter.
Returns:
The ped entity created.
Functions.CreateEntity()
This function is used to create an object entity in the game world. It requests the model with the specified model
name, waits for the model to load, and then creates the object at the specified position. The created object entity is added to the PMM Entities table.
Parameters:
model
: A string representing the model name of the object.position
: A vector3 representing the position where the object should be created.cb
: A callback function to be executed, taking the object entity as a parameter.
Returns:
The object entity created.
Functions.CreateVehicle()
This function is used to create a vehicle in the game world. It supports spawning vehicles at specific coordinates with optional randomization. The function checks for a clear spawn point and then calls the GM().Functions.SpawnVehicle
function to spawn the vehicle. The spawned vehicle is added to the appropriate vehicle list based on the vType
parameter.
Parameters:
vType
: A string representing the type of vehicle to be created ("MISSION" or any other value).modelName
: A string representing the model name of the vehicle.coords
: A vector3 or a table of vector4 representing the spawn coordinates or spawn point options.heading
: A number representing the heading (rotation) of the vehicle.cb
: A callback function to be executed, taking the vehicle entity and spawn coordinates as parameters.
Returns:
The vehicle entity created.
Functions.DeleteEntity()
This function is used to delete an entity from the game world. It removes the specified entity and performs additional cleanup tasks if necessary, such as removing the entity from the PMM Entities table or marking it as a mission entity. The function checks if the entity exists before deleting it.
Parameters:
entity
: The entity to be deleted.missionEntity
: A boolean indicating whether the entity is a mission entity.cb
: A callback function to be executed, taking a boolean parameter indicating whether the entity was successfully deleted.
Returns:
true
if the entity was successfully deleted,false
otherwise.
Functions.DeleteMissionEntities()
This function is used to delete all mission entities from the game world. It iterates through the PMM Entities table, deleting each entity. If there are still entities remaining in the table, the function recursively calls itself until all mission entities are deleted.
Parameters: None.
Returns: None.
Last updated
Was this helpful?