SA-MP Forums Archive
[HELP] Textdraw above head - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP] Textdraw above head (/showthread.php?tid=207519)



[HELP] Textdraw above head - joeri55 - 06.01.2011

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.


Re: [HELP] Textdraw above head - veyron - 06.01.2011

CreatePlayer3DTextLabel
Attach3DTextLabelToPlayer


Re: [HELP] Textdraw above head - _rAped - 06.01.2011

That's a 3dtext.

CreatePlayer3DTextLabel()
Attach3DTextLabelToPlayer()

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


Re: [HELP] Textdraw above head - HyperZ - 06.01.2011

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;
}



Re: [HELP] Textdraw above head - joeri55 - 06.01.2011

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.


Re: [HELP] Textdraw above head - HyperZ - 06.01.2011

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.


Re: [HELP] Textdraw above head - joeri55 - 06.01.2011

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);



Re: [HELP] Textdraw above head - _rAped - 06.01.2011

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);



Re: [HELP] Textdraw above head - joeri55 - 06.01.2011

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


Re: [HELP] Textdraw above head - _rAped - 06.01.2011

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);