SA-MP Forums Archive
Putting NPC Name over their head - 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: Putting NPC Name over their head (/showthread.php?tid=317666)



Putting NPC Name over their head - Dr.Heinz - 12.02.2012

How to put NPC Name over their head? i need this please help me


Re: Putting NPC Name over their head - SampLoverNo123 - 12.02.2012

Just type in your gamemode
pawn Код:
public OnGameModeInit()
{
        ConnectNPC("Your NPC NAME HERE","pilot"); // Npc name there
    return 1;
}
Check it out too - https://sampwiki.blast.hk/wiki/ConnectNPC


Re: Putting NPC Name over their head - Dr.Heinz - 12.02.2012

thats not what i mean. i mean is how to put their name over there head.


Re: Putting NPC Name over their head - [MG]Dimi - 12.02.2012

pawn Код:
#include <a_samp>

new Text3D:BotName;

public OnGameModeInit()
{
    BotName = Create3DTextLabel("[bot name here]",0xFFFFFFFF,0.0,0.0,0.0,30.0,0,0);
    return 1;
}

public OnPlayerSpawn(playerid)
{
    if(IsPlayerNPC(playerid))
    {
        new name[24];
        GetPlayerName(playerid,name,24);
        if(!strcmp(name,"[bot name here]",true)) Attach3DTextLabelToPlayer(BotName,playerid,0.0,0.0,0.5);
    }
    return 1;
}
Should work. Also this is only if you have one NPC. If you have more of them make sure you create many more 3D Text Variables.


Re: Putting NPC Name over their head - fiki574 - 12.02.2012

pawn Код:
new Text3D:Your3DName = Create3DTextLabel("My Cool NPC", YOUR_COLOR_HERE, 30.0, 40.0, 50.0, 40.0, 0);
Attach3DTextLabelToPlayer(Your3DName, playerid, 0.0, 0.0, 0.7);
This is the best position (use it myself)!