objects.destroy
Removes one of your objects for every player. Its ID is not used again until the server restarts.
Signature
Section titled “Signature”objects.destroy(id: number): Promise<ActionResult>Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
id |
number |
The ID returned by objects.create. |
Returns
Section titled “Returns”A promise of an ActionResult. applied means the object was removed.
Invalid IDs return invalid-object-id; an unknown or already removed ID returns object-not-found.
Example
Section titled “Example”import { objects, server } from "nativemp";
const objectId = 0; // the ID objects.create returnedconst result = await objects.destroy(objectId);if (result.status === "applied") server.log("The object was removed");scriptObjectDestroyed follows; by then the object is no longer in
objects.listAll.
Related
Section titled “Related”objects.create: create an objectobjects.listAll: list your objectsscriptObjectDestroyed: an object was removed