NPC names
#1

How to show a NPC name like normal players ingame?

Is there a function or a way to do it?

Thanks
Reply
#2

add this above OnGameModeInit
pawn Код:
new Text3D:NPC;//you can change "NPC" to whatever you want
Add this line under OnGameModeInit
pawn Код:
NPC = Create3DTextLabel("Bot_name_here",Color_here,0.0, 0.0,0.0,30.0,0);
Add this line under OnPlayerSpawn

pawn Код:
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(NPC, playerid, 0.0, 0.0, 0.0);
      return 1;
    }
If your NPC is in a vehicle it will look like this :

pawn Код:
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(NPC, playerid, 0.0, 0.0, 0.0);
      PutPlayerInVehicle(playerid, NRG500, 0); //you must have created a vehicle for it!
      return 1;
    }
here you go
Reply
#3

pawn Код:
if(IsPlayerNPC(playerid))
    {
        new npcname[MAX_PLAYER_NAME];
        GetPlayerName(playerid, npcname, sizeof(npcname));
        if(!strcmp(npcname, "YOURBOTNAME", true))
        {
            SetPlayerSkin(playerid, 45);
        }
Reply
#4

follow above two posts
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)