---
title: "GetPlayerInterior | open.mp"
description: "获取玩家当前所在的室内场景"
canonical: https://omp.itsneufox.com/zh-CN/docs/scripting/functions/GetPlayerInterior
language: zh-CN
---

# GetPlayerInterior

## 描述

获取玩家当前所在的室内编号。已知室内编号及对应坐标位置可参考[室内位置列表](https://omp.itsneufox.com/zh-CN/docs/scripting/resources/interiorids)

| 参数名 | 说明 |
| --- | --- |
| playerid | 需要获取室内场景的玩家 ID |

## 返回值

玩家当前所在的室内场景（整数类型）

## 示例代码

```c
public OnPlayerCommandText(playerid, text[])
{
    if (strcmp(cmdtext, "/int", true) == 0)
    {
        new string[64];
        format(string, sizeof(string), "你当前所在的室内场景是 %i", GetPlayerInterior(playerid));
        SendClientMessage(playerid, 0xFF8000FF, string);
        return 1;
    }
    return 0;
}
```

## 注意事项

备注

NPC 玩家将始终返回室内场景 0

## 相关函数

-   [SetPlayerInterior](https://omp.itsneufox.com/zh-CN/docs/scripting/functions/SetPlayerInterior): 设置玩家的室内场景
-   [GetPlayerVirtualWorld](https://omp.itsneufox.com/zh-CN/docs/scripting/functions/GetPlayerVirtualWorld): 获取玩家所在的虚拟世界
