How to add a name tag over a NPC -
[MNC]Azz - 27.07.2010
You must have a ready NPC(to make go to the link below)
https://sampforum.blast.hk/showthread.php?tid=95034
1st:
You must add this above OnGameModeInit
Code:
new Text3D:Botinfo;//you can change "Botinfo" to whatever you want
2nd:
Add this line under OnGameModeInit
Quote:
Botinfo = Create3DTextLabel("Bot_name_here",Colour_here,0.0, 0.0,0.0,30.0,0);
|
3rd
Add this line under OnPlayerSpawn
Code:
if(IsPlayerNPC(playerid)) //Checks if the player that just spawned is an NPC.
{
new npcname[MAX_PLAYER_NAME];
GetPlayerName(playerid, npcname, sizeof(npcname)); //Getting the NPC's name.
if(!strcmp(npcname, "NPC_connect_name", true))
{
Attach3DTextLabelToPlayer(Botinfo, playerid, 0.0, 0.0, 0.0);
return 1;
}
If your NPC is in a vehicle it will look like this :
Code:
if(IsPlayerNPC(playerid)) //Checks if the player that just spawned is an NPC.
{
new npcname[MAX_PLAYER_NAME];
GetPlayerName(playerid, npcname, sizeof(npcname)); //Getting the NPC's name.
if(!strcmp(npcname, "NPC_connect_name", true))
{
Attach3DTextLabelToPlayer(Botinfo, playerid, 0.0, 0.0, 0.0);
PutPlayerInVehicle(playerid, NRG500, 0); //you must have created a vehicle for it!
return 1;
}
And thats it! Hope it helped!
Reply if you have any questions...
Re: How to add a name tag over a NPC -
Kar - 27.07.2010
dont npc's already have themm.. but nice
Re: How to add a name tag over a NPC -
[MNC]Azz - 27.07.2010
Quote:
Originally Posted by Kar
dont npc's already have themm.. but nice
|
nop. they dont
Re: How to add a name tag over a NPC -
Kar - 27.07.2010
isnt the nametag a thing which shows the id and the name
Re: How to add a name tag over a NPC -
Hiddos - 27.07.2010
pawn Code:
//you must have created a vehicle for it!
Don't post variables and other unknown things into tutorials when the reader doesn't knows them.
Some more explanation would be nice.
Re: How to add a name tag over a NPC -
[MNC]Azz - 27.07.2010
Quote:
Originally Posted by Kar
isnt the nametag a thing which shows the id and the name
|
yes it is, but id does not work for bots!
Quote:
Originally Posted by Hiddos
pawn Code:
//you must have created a vehicle for it!
Don't post variables and other unknown things into tutorials when the reader doesn't knows them.
Some more explanation would be nice.
|
that info is in other tutorial Creating a new NPC(
https://sampforum.blast.hk/showthread.php?tid=95034)
Re: How to add a name tag over a NPC -
Kar - 28.07.2010
the id works for me..
ShowNameTags(1) idk but i see them all
Re: How to add a name tag over a NPC -
Armin_Avdic - 28.07.2010
This seems useles i mean npc`s already have names why do you need more info over them :/ but ...
Re: How to add a name tag over a NPC -
matthewdriftking - 28.07.2010
Nice azz.
Re: How to add a name tag over a NPC -
Bramblez - 16.09.2011
Thanks! found what i was looking for