---
title: "EditAttachedObject | open.mp"
description: "进入附加物体的编辑模式。"
canonical: https://omp.itsneufox.com/zh-CN/docs/scripting/functions/EditAttachedObject
language: zh-CN
---

# EditAttachedObject

## 描述

进入附加物体的编辑模式。

| 参数 | 说明 |
| --- | --- |
| playerid | 要进入编辑模式的玩家 ID |
| index | 要编辑的附加物体索引（槽位） |

## 返回值

**1** - 操作成功

**0** - 操作失败

## 示例

```c
public OnPlayerSpawn(playerid)
{
    SetPlayerAttachedObject(playerid, 0, 1337, 2);
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (!strcmp(cmdtext, "/edit", true))
    {
        EditAttachedObject(playerid, 0);
        SendClientMessage(playerid, 0xFFFFFFFF, "服务器：你正在编辑槽位0的附加物体！");
        return 1;
    }
    return 0;
}
```

## 注意事项

技巧

编辑过程中按住空格键（车内按 W 键）并移动鼠标可调整视角

注意

玩家可缩放物体至极大或负值尺寸，应通过 [OnPlayerEditAttachedObject](https://omp.itsneufox.com/zh-CN/docs/scripting/callbacks/OnPlayerEditAttachedObject) 回调设置缩放值限制或中止非法操作

## 相关函数

-   [SetPlayerAttachedObject](https://omp.itsneufox.com/zh-CN/docs/scripting/functions/SetPlayerAttachedObject): 为玩家附加物体
-   [RemovePlayerAttachedObject](https://omp.itsneufox.com/zh-CN/docs/scripting/functions/RemovePlayerAttachedObject): 移除玩家附加物体
-   [IsPlayerAttachedObjectSlotUsed](https://omp.itsneufox.com/zh-CN/docs/scripting/functions/IsPlayerAttachedObjectSlotUsed): 检查指定槽位是否已被占用
-   [EditObject](https://omp.itsneufox.com/zh-CN/docs/scripting/functions/EditObject): 编辑全局物体
-   [EditPlayerObject](https://omp.itsneufox.com/zh-CN/docs/scripting/functions/EditPlayerObject): 编辑玩家专属物体
-   [SelectObject](https://omp.itsneufox.com/zh-CN/docs/scripting/functions/SelectObject): 选择物体
-   [CancelEdit](https://omp.itsneufox.com/zh-CN/docs/scripting/functions/CancelEdit): 取消编辑操作

## 相关回调

-   [OnPlayerEditAttachedObject](https://omp.itsneufox.com/zh-CN/docs/scripting/callbacks/OnPlayerEditAttachedObject): 当玩家完成附加物体编辑时触发
