SA-MP Forums Archive
[Help] Textdraw... - 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... (/showthread.php?tid=188710)



[Help] Textdraw... - .sparkY - 08.11.2010

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.


Re: [Help] Textdraw... - Backwardsman97 - 08.11.2010

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?


Re: [Help] Textdraw... - .sparkY - 08.11.2010

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


Re: [Help] Textdraw... - Retardedwolf - 08.11.2010

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



Re: [Help] Textdraw... - Mike_Peterson - 08.11.2010

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


Re: [Help] Textdraw... - .sparkY - 08.11.2010

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


Re: [Help] Textdraw... - Backwardsman97 - 09.11.2010

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



Re: [Help] Textdraw... - -Rebel Son- - 09.11.2010

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.


Re: [Help] Textdraw... - Buzzbomb - 09.11.2010

Same Thing Im looking for But Did not work


Re: [Help] Textdraw... - Kitten - 09.11.2010

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