Help With 3D Text
#1

Hello Guys Please Help Me I Am Not Able To Put A 3D Text Over The Head Of NPC
Code
Код:
new AnuragVehicle; //Global variable!
new Text3D:Botinfo;//you can change "Botinfo" to whatever you want

public OnGameModeInit()
{
Botinfo = Create3DTextLabel("CrazyDriver",COLOR_GREEN,0.0, 0.0,0.0,30.0,0);
 print("my gamemode");
  ConnectNPC("CrazyDriver","bus123");
  AnuragVehicle = CreateVehicle(437, 0.0, 0.0, 5.0, 0.0, 1, 1, 5000);
return 1;
}

public OnPlayerConnect(playerid)
{
Attach3DTextLabelToPlayer(Botinfo, playerid, 0.0, 0.0, 0.0);
return 1;
}

public OnPlayerSpawn(playerid)
{
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, "CrazyDriver", true)) //Checking if the NPC's name is MyFirstNPC
    {
      PutPlayerInVehicle(playerid, AnuragVehicle, 0); //Putting the NPC into the vehicle we created for it.
    }}
}
Is This Correct If Correct Why The 3DText Is Not Comming
Reply
#2

Hello!

Can you try this code?
PHP код:
public OnPlayerConnect(playerid)
{
    if(
IsPlayerNPC(playerid))
    {
        
Attach3DTextLabelToPlayer(Botinfoplayerid0.00.00.0);
    }
    return 
1;

But I think you want to set the text label about the head of the npc when it's the CrazyDriver.
Then you should do it like this:
PHP код:
public OnPlayerConnect(playerid)
{
    if(
IsPlayerNPC(playerid))
    {
            new 
npcname[MAX_PLAYER_NAME];
        
GetPlayerName(playerid,npcname,sizeof(npcname));
        if(!
strcmp(npcname,"CrazyDriver",true))
        {
            
Attach3DTextLabelToPlayer(Botinfoplayerid0.00.00.0);
        }
    }
    return 
1;

Reply
#3

NOPE
Reply
#4

ok let try both
Reply
#5

I Have Added
Quote:

{
if(IsPlayerNPC(playerid))
{
new npcname[MAX_PLAYER_NAME];
GetPlayerName(playerid,npcname,sizeof(npcname));
if(!strcmp(npcname,"CrazyDriver",true))
{

UnderOnPlayerSpawn So Does I Need To Add It UnderOnplayerconnect
Reply
#6

In OnPlayerConnect and OnPlayerSpawn, like this:
PHP код:
public OnPlayerConnect(playerid

    if(
IsPlayerNPC(playerid)) 
    { 
            new 
npcname[MAX_PLAYER_NAME]; 
        
GetPlayerName(playerid,npcname,sizeof(npcname)); 
        if(!
strcmp(npcname,"CrazyDriver",true)) 
        { 
            
Attach3DTextLabelToPlayer(Botinfoplayerid0.00.00.0); 
        } 
    } 
    return 
1

PHP код:
public OnPlayerSpawn(playerid)
{
if(
IsPlayerNPC(playerid)) //Checks if the player that just spawned is an NPC.
  
{
    new 
npcname[MAX_PLAYER_NAME];
    
GetPlayerName(playeridnpcnamesizeof(npcname)); //Getting the NPC's name.
    
if(!strcmp(npcname"CrazyDriver"true)) //Checking if the NPC's name is MyFirstNPC
    
{
      
PutPlayerInVehicle(playeridAnuragVehicle0); //Putting the NPC into the vehicle we created for it.
    
}}

Reply
#7

Ok Both i have To Add it under both
Reply
#8

Yes. So does it work?
Reply
#9

Tell ME One Think Also I Want To Set The NPC To Be Shown On The Map With Green Colour How I Can Do That
Reply
#10

PHP код:
SetPlayerMapIcon(playerid69xyz0COLOR1
x, y, z are NPC Position
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)