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

NPC_SetFacingAngle

எச்சரிக்கை

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

Description​

Sets an NPC's facing angle.

NameDescription
npcidThe ID of the NPC.
Float:angleThe facing angle in degrees (0-360).

Returns​

Returns true if the facing angle was set successfully, false otherwise.

Examples​

public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp(cmdtext, "/setfacingangle ", true, 16))
{
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:angle = floatstr(cmdtext[16]);
if (angle < 0.0 || angle > 360.0)
return SendClientMessage(playerid, 0xFF0000FF, "Angle must be between 0.0 and 360.0.");

NPC_SetFacingAngle(npcid, angle);
SendClientMessage(playerid, 0x00FF00FF, "NPC %d facing angle set to %.1f", npcid, angle);

return 1;
}
return 0;
}

Notes​

குறிப்பு
  • Angle is measured in degrees (0-360).
  • Instantly rotates NPC without animation.
உதவிக்குறிப்பு

Use NPC_GetFacingAngle to get current facing angle.