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

NPC_SetRot

எச்சரிக்கை

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

Description​

Sets an NPC's rotation on all three axes (X, Y, Z).

NameDescription
npcidThe ID of the NPC.
Float:xX-axis rotation in degrees.
Float:yY-axis rotation in degrees.
Float:zZ-axis rotation in degrees.

Returns​

Returns true if the operation was successful, false otherwise.

Examples​

public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp(cmdtext, "/setrandomrot", 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(random(360));
new Float:y = float(random(360));
new Float:z = float(random(360));

NPC_SetRot(npcid, x, y, z);
SendClientMessage(playerid, 0x00FF00FF, "NPC %d rotation randomized", npcid);

return 1;
}
return 0;
}

Notes​

குறிப்பு
  • Rotation values are in degrees (0-360).
  • Z-axis rotation affects facing direction (same as NPC_SetFacingAngle).
  • X and Y rotations can create tilted or upside-down NPCs.
உதவிக்குறிப்பு

Use NPC_GetRot to retrieve current rotation values.