[HELP] Textdraw above head
#1

Dear users,

I'm working on some new features for my script. Now I'm making something special. I'm trying to create a kinda textdraw above a player's head that everyone can see. Just like the healthbar, armorbar and player name. But then I just want something above it, their phonenumber. ( I manually will change things to the thing I actually want to make but I need the phonenumber. )

Something like this;


It's like the pickup message that's inside the icon like "[Property]". Does anyone knows how to create this? Because I need help with it.
Reply
#2

CreatePlayer3DTextLabel
Attach3DTextLabelToPlayer
Reply
#3

That's a 3dtext.

CreatePlayer3DTextLabel()
Attach3DTextLabelToPlayer()

If you want to do it to a pickup just set the location.
Reply
#4

You can use it onplayerspawn or with a command.
pawn Код:
public OnPlayerSpawn(playerid)
{
    new Text3D:blabla[MAX_PLAYERS];
    blabla[playerid] = Create3DTextLabel("Your text here.",0xFFFFFFAA, 30.0, 40.0, 50.0, 40.0, 0);
    Attach3DTextLabelToPlayer(blabla[playerid],playerid,0.0, 0.0, 0.7);
    return 1;
}
Command:
pawn Код:
if (strcmp("/mycommand", cmdtext, true, 10) == 0)
{
    new Text3D:blabla[MAX_PLAYERS];
    blabla[playerid] = Create3DTextLabel("Your text here.",0xFFFFFFAA, 30.0, 40.0, 50.0, 40.0, 0);
    Attach3DTextLabelToPlayer(blabla[playerid],playerid,0.0, 0.0, 0.7);
    return 1;
}
Reply
#5

Alright, so this cmd above here is the one above his head.. right? If it is, thank you verry much for your help. I will test it soon.
Reply
#6

Quote:
Originally Posted by joeri55
Посмотреть сообщение
Alright, so this cmd above here is the one above his head.. right? If it is, thank you verry much for your help. I will test it soon.
Yes, n you're welcome.
Reply
#7

I tried to add the phonenumber that I'm using as a prison number but I ended up with this warning;
C:\Users\mma\Desktop\Los Santos Prison Roleplay\gamemodes\lspr.pwn(9709) : warning 213: tag mismatch

This is the function;

Код:
    new Text3D:PrisonNum[MAX_PLAYERS];
    PrisonNum[playerid] = Create3DTextLabel("Prison Number %d",Player[playerid][PhoneN],0xFFFFFFAA, 30.0, 40.0, 50.0, 40.0, 0);
    Attach3DTextLabelToPlayer(PrisonNum[playerid],playerid,0.0, 0.0, 0.7);
Reply
#8

Quote:
Originally Posted by joeri55
Посмотреть сообщение
I tried to add the phonenumber that I'm using as a prison number but I ended up with this warning;
C:\Users\mma\Desktop\Los Santos Prison Roleplay\gamemodes\lspr.pwn(9709) : warning 213: tag mismatch

This is the function;

Код:
        new Text3D:PrisonNum[MAX_PLAYERS];
    PrisonNum[playerid] = Create3DTextLabel("Prison Number %d",Player[playerid][PhoneN],0xFFFFFFAA, 30.0, 40.0, 50.0, 40.0, 0);
    Attach3DTextLabelToPlayer(PrisonNum[playerid],playerid,0.0, 0.0, 0.7);
Pawn doesn't work like that, you need to format a string first
pawn Код:
new
        Text3D:PrisonNum[MAX_PLAYERS];
        string[32];
    format(string, sizoef(string), "Prison number: %d", Player[playerid][PhoneN]);
    PrisonNum[playerid] = Create3DTextLabel(string, 0xFFFFFFAA, 30.0, 40.0, 50.0, 40.0, 0);
    Attach3DTextLabelToPlayer(PrisonNum[playerid], playerid, 0.0, 0.0, 0.7);
Reply
#9

Got this code now;

Код:
    new Text3D:PrisonNum[MAX_PLAYERS];
    new string[32];
    format(string, sizoef(string), "Prison Number: %d", Player[playerid][PhoneN]);
    PrisonNum[playerid] = Create3DTextLabel(string, 0xFFFFFFAA, 30.0, 40.0, 50.0, 40.0, 0);
    Attach3DTextLabelToPlayer(PrisonNum[playerid], playerid, 0.0, 0.0, 0.7);
And it's giving this error,

C:\Users\mma\Desktop\Los Santos Prison Roleplay\gamemodes\lspr.pwn(9710) : error 017: undefined symbol "sizoef"
C:\Users\mma\Desktop\Los Santos Prison Roleplay\gamemodes\lspr.pwn(9779) : warning 219: local variable "string" shadows a variable at a preceding level
Reply
#10

My bad lol, typo:
pawn Код:
new
        Text3D:PrisonNum[MAX_PLAYERS];
        string[32];
    format(string, sizeof(string), "Prison number: %d", Player[playerid][PhoneN]);
    PrisonNum[playerid] = Create3DTextLabel(string, 0xFFFFFFAA, 30.0, 40.0, 50.0, 40.0, 0);
    Attach3DTextLabelToPlayer(PrisonNum[playerid], playerid, 0.0, 0.0, 0.7);
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)