SA-MP Forums Archive
Putting players names above there heads ? - 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 players names above there heads ? (/showthread.php?tid=304358)



Putting players names above there heads ? - ninjahippie - 18.12.2011

Do I need a script to do this or is it already done its just I'm playing around with a lan server and my npc dont have there names above there heads :/


Re: Putting players names above there heads ? - Emmet_ - 18.12.2011

Here's a filterscript I made, either paste it into your gamemode or compile it & loadfs.

pawn Код:
#include <a_samp>

new Text3D:NPC_Label[MAX_PLAYERS];

public OnPlayerSpawn(playerid)
{
    if(IsPlayerNPC(playerid) && NPC_Label[playerid] == Text3D:INVALID_3DTEXT_ID)
    {
        new
            playername[24],
            Float:pos[3];

        GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
        GetPlayerName(playerid, playername, 24);

        NPC_Label[playerid] = Create3DTextLabel(playername, 0xFF6347FF, pos[0], pos[1], pos[2] + 0.9, 20.0, 0);
        return 1;
    }
    return 1;
}

public OnPlayerDisconnect(playerid)
{
    if(IsPlayerNPC(playerid) && _:NPC_Label[playerid] != INVALID_3DTEXT_ID)
    {
        Delete3DTextLabel(NPC_Label[playerid]);
        NPC_Label[playerid] = Text3D:INVALID_3DTEXT_ID;
        return 1;
    }
    return 1;
}



Re: Putting players names above there heads ? - ninjahippie - 18.12.2011

Didn't seem to work but thanks anyway