跳到主要内容

NPC_IsStreamedIn

注意

This function was added in omp v1.5.8.3079 and will not work in earlier versions!

Description

Checks if an NPC is streamed in for a specific player.

NameDescription
npcidThe ID of the NPC
playeridThe ID of the player to check

Returns

Returns true if the NPC is streamed in for the player, false otherwise.

Examples

public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp(cmdtext, "/checkstreamedin", true))
{
new npcid = PlayerNPC[playerid];
if (npcid == INVALID_NPC_ID)
return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC.");

if (!NPC_IsValid(npcid))
return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC.");

new bool:isStreamedIn = NPC_IsStreamedIn(npcid, playerid);

SendClientMessage(playerid, 0x00FF00FF, "NPC %d is streamed in for you: %s", npcid, isStreamedIn ? "Yes" : "No");
return 1;
}
return 0;
}

Notes

  • NPCs are only streamed in when within the player's streaming distance
  • Streaming depends on distance and interior/virtual world matching

No specific callbacks are triggered by this function.