Files
netease-modsdk-wiki/docs/mcdocs/1-ModAPI/接口/通用/本地设备.md
2025-03-17 13:24:39 +08:00

153 lines
2.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
sidebarDepth: 1
---
# 本地设备
## GetIP
<span style="display:inline;color:#7575f9">客户端</span>
method in mod.client.extraClientApi
- 描述
获取本地玩家的ip地址
- 参数
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| str | 本地玩家的ip地址 |
- 示例
```python
import mod.client.extraClientApi as clientApi
clientApi.GetIP()
```
## GetPlatform
<span style="display:inline;color:#ff5555">服务端</span><span style="display:inline;color:#7575f9">客户端</span>
### 服务端接口
<span id="s0"></span>
method in mod.server.extraServerApi
- 描述
获取脚本运行的平台
- 参数
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| int | 0Window1IOS2Android-1其他例如联机大厅阿波罗等linux服务器 |
- 示例
```python
import mod.server.extraServerApi as serverApi
serverApi.GetPlatform()
```
### 客户端接口
<span id="c0"></span>
method in mod.client.extraClientApi
- 描述
获取脚本运行的平台
- 参数
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| int | 0Window1IOS2Android-1其他 |
- 示例
```python
import mod.client.extraClientApi as clientApi
clientApi.GetPlatform()
```
## IsInApollo
<span style="display:inline;color:#ff5555">服务端</span>
method in mod.server.extraServerApi
- 描述
返回当前游戏Mod是否运行在Apollo网络服
- 参数
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| bool | True当前Mod运行于Apollo网络服环境<br>False当前Mod运行于租赁服、联机大厅或者单机环境 |
- 示例
```python
import mod.server.extraServerApi as serverApi
IsInApollo = serverApi.IsInApollo()
```
## IsInServer
<span style="display:inline;color:#ff5555">服务端</span>
method in mod.server.extraServerApi
- 描述
获取当前游戏是否跑在服务器环境下
- 参数
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| bool | True:在服务器环境下<br>False:不在服务器环境下 |
- 示例
```python
import mod.server.extraServerApi as serverApi
isInServer = serverApi.IsInServer()
```