SA-MP Forums Archive
TextDraw problems - 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: TextDraw problems (/showthread.php?tid=189109)



TextDraw problems - Doom8890 - 10.11.2010

Hello, recently I involved in making game mode...Basically it is TDM on RC Battle field map(interior 10).

I was thinking how to show current score, and i figured out you can do it with TextDraws.

Since me and TextDraw don't get along well...i need help.

I want to place TextDraw on left(like in screen shot below), and want it to display current points for both team(USA and Vietnam).

Screen shot

So far i got to this:

These are score variables.
pawn Code:
new USAscore = 0;
new VIETNAMscore = 0;
And this is OnPlayerConnect()
pawn Code:
new Text:textDraw;
textDraw = TextDrawCreate(i dont know, the co-ordinates,"nor what to put here");
TextDrawShowForPlayer(playerid,textDraw);
If you can help me to make something like this, i would be really grateful.


Re: TextDraw problems - iJumbo - 10.11.2010

you need to create a textdraw then show for all..

make a timer thath update every time the textdraw and score

use some textdraw ingame editors for do the textdraw and u are done ^^


Re: TextDraw problems - Doom8890 - 10.11.2010

Alright, i made this now:

pawn Code:
Textdraw0 = TextDrawCreate(2.000000,249.000000,"USA:");
Textdraw1 = TextDrawCreate(1.000000,271.000000,"Vietnam:");
Textdraw2 = TextDrawCreate(62.000000,249.000000, USAscore);
Textdraw3 = TextDrawCreate(62.000000,271.000000, VIETNAMscore);
And when i compile it i got these 2 errors on both lines(textdraw3 and textdraw2):

Code:
error 035: argument type mismatch (argument 3)
Also, i need help with "updating" scores. Example:

Image that USA team have score 23, and Vietnam have 24. Now when player1(USA) kills player2(Vietnam), TextDraw2 shows 24 instead of 23.


Re: TextDraw problems - Finn - 10.11.2010

Third parameter in TextDrawCreate has to be a string.

pawn Code:
new string[4];
format(string, sizeof(string), "%d", USAscore);
Textdraw2 = TextDrawCreate(62.000000, 249.000000, string);
For updating the textdraw, you might want to check TextDrawSetString.


Re: TextDraw problems - Doom8890 - 10.11.2010

Now i got the first part, now if somebody can explain me TextDrawSetString.

Correct me If I'm wrong in this:
pawn Code:
if(gTeam[killerid] == TEAM_USA)
{
USAscore++;
TextDrawSetString(Textdraw2, string);
}
This is OnPlayerDeath()


Re: TextDraw problems - Finn - 10.11.2010

You have to format the string (just like you did when creating the draw).


Re: TextDraw problems - Doom8890 - 10.11.2010

Alright, thanks, i Think I'll handle it.


Re: TextDraw problems - dark_clown - 10.11.2010

do you mean this? << clicky clicky