SA-MP Forums Archive
How Can name NPC - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How Can name NPC (/showthread.php?tid=482449)



How Can name NPC - KingServerIRAN - 21.12.2013

How to put the name of the npc?? ??



Please example


Re: How Can name NPC - boomerboom - 21.12.2013

Attach Label to his head.


Re: How Can name NPC - KingServerIRAN - 21.12.2013

Please example


Re: How Can name NPC - KingServerIRAN - 21.12.2013

Up.....


Re: How Can name NPC - SilentSoul - 21.12.2013

Quote:
Originally Posted by KingServerIRAN
Посмотреть сообщение
Please example
https://sampwiki.blast.hk/wiki/Attach3DTextLabelToPlayer


Re: How Can name NPC - TheViking - 21.12.2013

Try this:

Quote:

if(IsPlayerNPC(playerid))
{
if(!strcmp(npcname, "Joey", true)) // if You have some more NPCs You'll need this, for an example if You called him " Joey ".
{
new string[50];
new name[MAX_PLAYER_NAME+1];

GetPlayerName(playerid, name, sizeof(name)); // It's gonna get NPC's name.

format(string,sizeof(string),"%s (%d)", name, playerid); // His name and ID.

new Text3D:MyNPC = Create3DTextLabel(string, 0xE60000FF, 30.0, 40.0, 50.0, 40.0, 0); // 0xE60000FF - Red colour.
Attach3DTextLabelToPlayer(MyNPC, playerid, 0.0, 0.0, 0.7); // This is going to attach 3DTextLabel to the NPC "Joey", above his head.
}
}

// TheViking
This is gonna work, but please let me know if something's wrong.
Thank You.