put 3D Text Labels overhead to npc
#1

What lines should I add to my npc has a name in her head


Код:
#include <a_samp>

new mesera;

public OnGameModeInit()
{
	ConnectNPC("Jenny_Laurent","mesera");
	mesera =	AddStaticVehicle(420,2044.8854,1473.2106,10.4494,181.3339,6,1); // van
	return 1;
}

public OnGameModeExit()
{
	return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
	return 1;
}

public OnPlayerRequestSpawn(playerid)
{
	return 1;
}

public OnPlayerConnect(playerid)
{
	return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
	return 1;
}

public OnPlayerSpawn(playerid)
{
    if(IsPlayerNPC(playerid)) //Checks if the player is an NPC.
    {
        new npcname[MAX_PLAYER_NAME];
        GetPlayerName(playerid, npcname, sizeof(npcname)); //Gets the NPC's name
        if(!strcmp(npcname, "Jenny_Laurent", true)) //Checks if the NPC's name is Driver
        {
            PutPlayerInVehicle(playerid, mesera, 0); //Puts the NPC into the van.
        }
    }
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
	return 1;
}

public OnVehicleSpawn(vehicleid)
{
	return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
	return 1;
}

public OnPlayerText(playerid, text[])
{
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/mycommand", cmdtext, true, 10) == 0)
	{
		// Do something here
		return 1;
	}
	return 0;
}
Reply
#2

If you want to make the 3d text label appear above when admin is on aduty you must find your /aduty CMD line. But otherwise I'm not sure. I'll try to find out, then come back and help you.
Reply
#3

pawn Код:
public OnPlayerConnect(playerid)
{
    if(IsPlayerNPC(playerid))
    {
        new string[32], NPCName[MAX_PLAYER_NAME];
        GetPlayerName(playerid, NPCName, sizeof NPCName);
        format(string, sizeof string, "%s (%d)", NPCName, playerid);
        TestBotLabel[playerid] = Create3DTextLabel(string, COLOR_WHITE, 0, 0, 0, 40, 0, true);
        Attach3DTextLabelToPlayer(Jenny_Laurent[playerid], playerid, 0, 0, 0.4);
        SetPlayerColor(playerid, COLOR_WHITE);
    }
}
Reply
#4

Quote:
Originally Posted by [..MonTaNa..]
Посмотреть сообщение
pawn Код:
public OnPlayerConnect(playerid)
{
    if(IsPlayerNPC(playerid))
    {
        new string[32], NPCName[MAX_PLAYER_NAME];
        GetPlayerName(playerid, NPCName, sizeof NPCName);
        format(string, sizeof string, "%s (%d)", NPCName, playerid);
        TestBotLabel[playerid] = Create3DTextLabel(string, COLOR_WHITE, 0, 0, 0, 40, 0, true);
        Attach3DTextLabelToPlayer(Jenny_Laurent[playerid], playerid, 0, 0, 0.4);
        SetPlayerColor(playerid, COLOR_WHITE);
    }
}
C:\Users\NTVbeleza\Desktop\mESE.pwn(34) : error 017: undefined symbol "TestBotLabel"
C:\Users\NTVbeleza\Desktop\mESE.pwn(34) : warning 215: expression has no effect
C:\Users\NTVbeleza\Desktop\mESE.pwn(34) : error 001: expected token: ";", but found "]"
C:\Users\NTVbeleza\Desktop\mESE.pwn(34) : error 029: invalid expression, assumed zero
C:\Users\NTVbeleza\Desktop\mESE.pwn(34) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#5

pawn Код:
public OnPlayerConnect(playerid)
{
    if(IsPlayerNPC(playerid))
    {
        new string[32], NPCName[MAX_PLAYER_NAME], TestBotLabel[MAX_PLAYERS];

        GetPlayerName(playerid, NPCName, sizeof NPCName);
        format(string, sizeof string, "%s (%d)", NPCName, playerid);
        TestBotLabel[playerid] = Create3DTextLabel(string, COLOR_WHITE, 0, 0, 0, 40, 0, true);
        Attach3DTextLabelToPlayer(Jenny_Laurent[playerid], playerid, 0, 0, 0.4);
        SetPlayerColor(playerid, COLOR_WHITE);
    }
}
You got to define TestBotLabel..
Reply
#6

as I define it?
Reply
#7

Oh well, sorry, my bad..

pawn Код:
new Text3D:TestBotLabel[MAX_PLAYERS];
Reply
#8

I leave my npc so I put that because it gives me many errors help


Код:
#include <a_samp>

new mesera;

public OnGameModeInit()
{
	ConnectNPC("Jenny_Laurent","mesera");
	mesera =	AddStaticVehicle(420,2044.8854,1473.2106,10.4494,181.3339,6,1); // van
	return 1;
}

public OnGameModeExit()
{
	return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
	return 1;
}

public OnPlayerRequestSpawn(playerid)
{
	return 1;
}

public OnPlayerConnect(playerid)
{
	return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
	return 1;
}

public OnPlayerSpawn(playerid)
{
    if(IsPlayerNPC(playerid)) //Checks if the player is an NPC.
    {
        new npcname[MAX_PLAYER_NAME];
        GetPlayerName(playerid, npcname, sizeof(npcname)); //Gets the NPC's name
        if(!strcmp(npcname, "Jenny_Laurent", true)) //Checks if the NPC's name is Driver
        {
            PutPlayerInVehicle(playerid, mesera, 0); //Puts the NPC into the van.
        }
    }
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
	return 1;
}

public OnVehicleSpawn(vehicleid)
{
	return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
	return 1;
}

public OnPlayerText(playerid, text[])
{
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/mycommand", cmdtext, true, 10) == 0)
	{
		// Do something here
		return 1;
	}
	return 0;
}
Reply
#9

pawn Код:
new mesera;
new Text3D:BotLabel[MAX_PLAYERS];

public OnGameModeInit()
{
    ConnectNPC("Jenny_Laurent","mesera");
    mesera =    AddStaticVehicle(420,2044.8854,1473.2106,10.4494,181.3339,6,1); // van
    return 1;
}

public OnGameModeExit()
{
    return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
    return 1;
}

public OnPlayerRequestSpawn(playerid)
{
    return 1;
}

public OnPlayerConnect(playerid)
{
    if(IsPlayerNPC(playerid))
    {
        new string[32], NPCName[MAX_PLAYER_NAME];

        GetPlayerName(playerid, NPCName, sizeof NPCName);
        format(string, sizeof string, "%s (%d)", NPCName, playerid);
        BotLabel[playerid] = Create3DTextLabel(string, COLOR_WHITE, 0, 0, 0, 40, 0, true);
        Attach3DTextLabelToPlayer(BotLabel[playerid], playerid, 0, 0, 0.4);
        SetPlayerColor(playerid, COLOR_WHITE);
    }
}

public OnPlayerDisconnect(playerid, reason)
{
    return 1;
}

public OnPlayerSpawn(playerid)
{
    if(IsPlayerNPC(playerid)) //Checks if the player is an NPC.
    {
        new npcname[MAX_PLAYER_NAME];
        GetPlayerName(playerid, npcname, sizeof(npcname)); //Gets the NPC's name
        if(!strcmp(npcname, "Jenny_Laurent", true)) //Checks if the NPC's name is Driver
        {
            PutPlayerInVehicle(playerid, mesera, 0); //Puts the NPC into the van.
        }
    }
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    return 1;
}

public OnVehicleSpawn(vehicleid)
{
    return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
    return 1;
}

public OnPlayerText(playerid, text[])
{
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/mycommand", cmdtext, true, 10) == 0)
    {
        // Do something here
        return 1;
    }
    return 0;
}
Reply
#10

C:\Users\NTVbeleza\Desktop\messe.pwn(6) : error 001: expected token: ";", but found "public"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)