Ana içeriğe geç

NPC_SetSpecialAction

uyarı

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

Description

Sets an NPC's special action state, such as sitting, smoking, drinking, etc.

NameDescription
npcidThe ID of the NPC
actionThe special action ID to set

Returns

Returns true if the operation was successful, false otherwise.

Examples

public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp(cmdtext, "/setspecialaction ", true, 18))
{
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 actionid = strval(cmdtext[18]);

NPC_SetSpecialAction(npcid, SPECIAL_ACTION:actionid);
SendClientMessage(playerid, 0x00FF00FF, "NPC %d special action set to %d", npcid, actionid);

return 1;
}
return 0;
}

Notes

  • Use SPECIAL_ACTION_NONE to clear the current action
  • Some actions may conflict with movement or other activities

No specific callbacks are triggered by this function.