Passa al contenuto principale

NPC_SetSkin

warning

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

Description​

Sets an NPC's skin model to change their appearance.

NameDescription
npcidThe ID of the NPC
modelThe skin model ID to set

Returns​

Returns true if the skin was set successfully, false otherwise.

Examples​

public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp(cmdtext, "/setskin ", true, 9))
{
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 skinid = strval(cmdtext[9]);
if (skinid < 0 || skinid > 311)
return SendClientMessage(playerid, 0xFF0000FF, "Skin ID must be between 0 and 311.");

NPC_SetSkin(npcid, skinid);
SendClientMessage(playerid, 0x00FF00FF, "NPC %d skin set to %d", npcid, skinid);

return 1;
}
return 0;
}

Notes​

  • Invalid skin IDs may cause visual glitches