---
title: "OnPlayerSelectObject | open.mp"
description: "This callback is called when a player selects an object after SelectObject has been used."
canonical: https://omp.itsneufox.com/th/docs/scripting/callbacks/OnPlayerSelectObject
language: th
---

# OnPlayerSelectObject

## คำอธิบาย

This callback is called when a player selects an object after SelectObject has been used.

| Name | Description |
| --- | --- |
| playerid | The ID of the player that selected an object |
| type | The [type](https://omp.itsneufox.com/th/docs/scripting/resources/selectobjecttypes) of selection |
| objectid | The ID of the selected object |
| modelid | The model of the selected object |
| Float:fX | The X position of the selected object |
| Float:fY | The Y position of the selected object |
| Float:fZ | The Z position of the selected object |

## ส่งคืน

1 - Will prevent other scripts from receiving this callback.

0 - Indicates that this callback will be passed to the next script.

มันถูกเรียกในฟิลเตอร์สคริปต์ก่อนเสมอ

## ตัวอย่าง

```c
public OnPlayerSelectObject(playerid, type, objectid, modelid, Float:fX, Float:fY, Float:fZ)
{
    printf("Player %d selected object %d", playerid, objectid);
    if (type == SELECT_OBJECT_GLOBAL_OBJECT)
    {
        EditObject(playerid, objectid);
    }
    else
    {
        EditPlayerObject(playerid, objectid);
    }
    SendClientMessage(playerid, 0xFFFFFFFF, "You now are able to edit your object!");
    return 1;
}
```

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

-   [SelectObject](https://omp.itsneufox.com/th/docs/scripting/functions/SelectObject): Select an object.
