跳到主要內容

NPC_SetSkin

注意

此函式於 omp v1.5.8.3079 版本中新增,在更早的版本中無法使用!

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