---
title: "CreateObject | open.mp"
description: "Creates an object at specified coordinates in the game world."
canonical: https://omp.itsneufox.com/th/docs/scripting/functions/CreateObject
language: th
---

# CreateObject

## คำอธิบาย

Creates an object at specified coordinates in the game world.

| Name | Description |
| --- | --- |
| modelid | The model to create. |
| Float:X | The X coordinate to create the object at. |
| Float:Y | The Y coordinate to create the object at. |
| Float:Z | The Z coordinate to create the object at. |
| Float:rX | The X rotation of the object. |
| Float:rY | The Y rotation of the object. |
| Float:rZ | The Z rotation of the object. |
| Float:DrawDistance | (optional) The distance that San Andreas renders objects at. 0.0 will cause objects to render at their default distances. |

## ตัวอย่าง

```c
public OnGameModeInit()
{
    CreateObject(2587, 2001.195679, 1547.113892, 14.283400, 0.0, 0.0, 96.0); // Object will render at its default distance.
    CreateObject(2587, 2001.195679, 1547.113892, 14.283400, 0.0, 0.0, 96.0, 300.0); // Object will render at 300.0 units.
    return 1;
}
```

## บันทึก

หมายเหตุ

There is a limit of 1000 objects (MAX\_OBJECTS). To circumvent this limit, you can use a streamer.

## ฟังก์ชั่นที่เกี่ยวข้องกัน

-   [DestroyObject](https://omp.itsneufox.com/th/docs/scripting/functions/DestroyObject): Destroy an object.
-   [IsValidObject](https://omp.itsneufox.com/th/docs/scripting/functions/IsValidObject): Checks if a certain object is vaild.
-   [MoveObject](https://omp.itsneufox.com/th/docs/scripting/functions/MoveObject): Move an object.
-   [StopObject](https://omp.itsneufox.com/th/docs/scripting/functions/StopObject): Stop an object from moving.
-   [SetObjectPos](https://omp.itsneufox.com/th/docs/scripting/functions/SetObjectPos): Set the position of an object.
-   [SetObjectRot](https://omp.itsneufox.com/th/docs/scripting/functions/SetObjectRot): Set the rotation of an object.
-   [GetObjectPos](https://omp.itsneufox.com/th/docs/scripting/functions/GetObjectPos): Locate an object.
-   [GetObjectRot](https://omp.itsneufox.com/th/docs/scripting/functions/GetObjectRot): Check the rotation of an object.
-   [AttachObjectToPlayer](https://omp.itsneufox.com/th/docs/scripting/functions/AttachObjectToPlayer): Attach an object to a player.
-   [SetObjectMaterialText](https://omp.itsneufox.com/th/docs/scripting/functions/SetObjectMaterialText): Replace the texture of an object with text.
-   [SetObjectMaterial](https://omp.itsneufox.com/th/docs/scripting/functions/SetObjectMaterial): Replace the texture of an object with the texture from another model in the game.
-   [CreatePlayerObject](https://omp.itsneufox.com/th/docs/scripting/functions/CreatePlayerObject): Create an object for only one player.
-   [DestroyPlayerObject](https://omp.itsneufox.com/th/docs/scripting/functions/DestroyPlayerObject): Destroy a player object.
-   [IsValidPlayerObject](https://omp.itsneufox.com/th/docs/scripting/functions/IsValidPlayerObject): Checks if a certain player object is vaild.
-   [MovePlayerObject](https://omp.itsneufox.com/th/docs/scripting/functions/MovePlayerObject): Move a player object.
-   [StopPlayerObject](https://omp.itsneufox.com/th/docs/scripting/functions/StopPlayerObject): Stop a player object from moving.
-   [SetPlayerObjectPos](https://omp.itsneufox.com/th/docs/scripting/functions/SetPlayerObjectPos): Set the position of a player object.
-   [SetPlayerObjectRot](https://omp.itsneufox.com/th/docs/scripting/functions/SetPlayerObjectRot): Set the rotation of a player object.
-   [GetPlayerObjectPos](https://omp.itsneufox.com/th/docs/scripting/functions/GetPlayerObjectPos): Locate a player object.
-   [GetPlayerObjectRot](https://omp.itsneufox.com/th/docs/scripting/functions/GetPlayerObjectRot): Check the rotation of a player object.
-   [AttachPlayerObjectToPlayer](https://omp.itsneufox.com/th/docs/scripting/functions/AttachPlayerObjectToPlayer): Attach a player object to a player.
-   [SetPlayerObjectMaterialText](https://omp.itsneufox.com/th/docs/scripting/functions/SetPlayerObjectMaterialText): Replace the texture of a player object with text.
-   [SetPlayerObjectMaterial](https://omp.itsneufox.com/th/docs/scripting/functions/SetPlayerObjectMaterial): Replace the texture of a player object with the texture from another model in the game.
