முதன்மை உள்ளடக்கத்துக்குச் செல்லவும்

NPC_SetAngleToPos

எச்சரிக்கை

செயல்பாடு என்பது omp v1.5.8.3079 பதிப்பில் சேர்க்கப்பட்டது. இது முந்தைய பதிப்புகளில் இயங்காது!

Description​

Rotates an NPC so it faces a specific world position.

NameDescription
npcidThe ID of the NPC.
Float:xX coordinate of the target position.
Float:yY coordinate of the target position.
Float:zZ coordinate of the target position.

Returns​

Returns true if the NPC was rotated successfully, false otherwise.

Examples​

public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp(cmdtext, "/lookatpos", 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 Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);

NPC_SetAngleToPos(npcid, x + 3.0, y, z);
SendClientMessage(playerid, 0x00FF00FF, "NPC %d now faces %.2f, %.2f, %.2f", npcid, x + 3.0, y, z);
return 1;
}
return 0;
}

Notes​

குறிப்பு
  • Only the horizontal plane (X/Y) is considered when calculating the facing angle.
  • The NPC will not move; it only rotates to face the position.