跳到主要内容

IsPlayerAttachedObjectSlotUsed

描述

检测玩家是否在指定索引槽位附加了物体。

参数说明
playerid需要检查的玩家 ID
index需要检查的槽位索引

返回值

true - 该槽位已被附加物体占用
false - 该槽位未被使用

示例

stock CountAttachedObjects(playerid)
{
new count;
for (new i = 0; i < MAX_PLAYER_ATTACHED_OBJECTS; i++)
{
if (IsPlayerAttachedObjectSlotUsed(playerid, i))
{
count++;
}
}
return count;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp(cmdtext, "/count", true))
{
new string[32];
format(string, sizeof(string), "附加物体数量: %d", CountAttachedObjects(playerid));
SendClientMessage(playerid, -1, string);
return 1;
}
return 0;
}

相关函数