[Help] Textdraw...
#1

Hello. I'm trying to make a textdraw stats... So, the code looks like this :
Код:
	Textdraw3 = TextDrawCreate(2.000000, 144.000000, "Name:");
	TextDrawBackgroundColor(Textdraw3, 255);
	TextDrawFont(Textdraw3, 1);
	TextDrawLetterSize(Textdraw3, 0.299998, 1.000000);
	TextDrawColor(Textdraw3, 16777215);
	TextDrawSetOutline(Textdraw3, 0);
	TextDrawSetProportional(Textdraw3, 1);
	TextDrawSetShadow(Textdraw3, 1);
and I've tried to do something like this

Код:
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));

	Textdraw3 = TextDrawCreate(2.000000, 144.000000, "Name: %s", name);
	TextDrawBackgroundColor(Textdraw3, 255);
	TextDrawFont(Textdraw3, 1);
	TextDrawLetterSize(Textdraw3, 0.299998, 1.000000);
	TextDrawColor(Textdraw3, 16777215);
	TextDrawSetOutline(Textdraw3, 0);
	TextDrawSetProportional(Textdraw3, 1);
	TextDrawSetShadow(Textdraw3, 1);
btw it's in a filterscript... Anyways, I've got an error :
Код:
error 017: undefined symbol "playerid"
and an warrning :

Код:
 warning 202: number of arguments does not match definition
...so I'm pretty sure I can't do that like that, so please tell me how can I make this : (

( I've tried to make it understandable, if you don't understand something, just ask... )


Thanks.
Reply
#2

It's because playerid isn't defined where you put it. You would need something like that under OnPlayerConnect. But for that, you would also need to create one of those textdraws for every player that joins. So an array would be needed. I haven't looked at PVars a whole lot. Maybe it's possible with those?
Reply
#3

I'm a beginner, so I didn't quite catch all you said.... I know I need to define playerid ( don't know exactly how, but... )... Anyways, I don't know how to create a textdraw like this
Reply
#4

pawn Код:
new Textdraw3[MAX_PLAYERS];

Textdraw3[playerid] = TextDrawCreate(2.000000, 144.000000, "Name:");
TextDrawBackgroundColor(Textdraw3[playerid], 255);
TextDrawFont(Textdraw3[playerid], 1);
TextDrawLetterSize(Textdraw3[playerid], 0.299998, 1.000000);
TextDrawColor(Textdraw3[playerid], 16777215);
TextDrawSetOutline(Textdraw3[playerid], 0);
TextDrawSetProportional(Textdraw3[playerid], 1);
TextDrawSetShadow(Textdraw3[playerid], 1);
Reply
#5

^^ use the retardedwolf's one and then @ onplayerconnect format the name and then use it in TextDrawSetString or something
Reply
#6

umm... "Format the name, and then use it in TextDrawSetString".... That's like you said something in English, to a Chinese person ! I'm a beginner, so... If you're gonna help me, you need to tell me how exactly :/ I'm still learning...

So... I used this :
Quote:

new Textdraw3[MAX_PLAYERS];

Textdraw3[playerid] = TextDrawCreate(2.000000, 144.000000, "Name:");
TextDrawBackgroundColor(Textdraw3[playerid], 255);
TextDrawFont(Textdraw3[playerid], 1);
TextDrawLetterSize(Textdraw3[playerid], 0.299998, 1.000000);
TextDrawColor(Textdraw3[playerid], 16777215);
TextDrawSetOutline(Textdraw3[playerid], 0);
TextDrawSetProportional(Textdraw3[playerid], 1);
TextDrawSetShadow(Textdraw3[playerid], 1);

Now I need to define playerid, how exactly can I do that ? and where... And when I do that, how can I do the next step ( adding for example GetPlayerName, and then using it... So it woul'd work as 'stats' )
Reply
#7

Under the OnPlayerConnect callback there is a playerid parameter. So it would be like this.

pawn Код:
new Textdraw3[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    new
         name[24],
         string[30];

    GetPlayerName(playerid,name,24);
    format(string,30,"Name:%s",name);
    Textdraw3[playerid] = TextDrawCreate(2.000000, 144.000000, string);
    TextDrawBackgroundColor(Textdraw3[playerid], 255);
    TextDrawFont(Textdraw3[playerid], 1);
    TextDrawLetterSize(Textdraw3[playerid], 0.299998, 1.000000);
    TextDrawColor(Textdraw3[playerid], 16777215);
    TextDrawSetOutline(Textdraw3[playerid], 0);
    TextDrawSetProportional(Textdraw3[playerid], 1);
    TextDrawSetShadow(Textdraw3[playerid], 1);
    return 1;
}
Reply
#8

Ok, this is what you want need:


at the top, put
Код:
NewTextdraw3[playerid];
Then as stated by Backwardsman,
Код:
    Textdraw3[playerid] = TextDrawCreate(2.000000, 144.000000, string);    TextDrawBackgroundColor(Textdraw3[playerid], 255);    TextDrawFont(Textdraw3[playerid], 1);    TextDrawLetterSize(Textdraw3[playerid], 0.299998, 1.000000);    TextDrawColor(Textdraw3[playerid], 16777215);    TextDrawSetOutline(Textdraw3[playerid], 0);    TextDrawSetProportional(Textdraw3[playerid], 1);    TextDrawSetShadow(Textdraw3[playerid], 1);
but put TextDrawSetString(Textdraw3[playerid], string); at the bottom of all this.


then make a new function, and put your formatting text in there.
Reply
#9

Same Thing Im looking for But Did not work
Reply
#10

Make sure u are using
pawn Код:
TextDrawShowForPlayer(playerid,textdrawname);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)