[Question] Show Score with Textdraw
#1

Hi all,
I Wanted to show the core of tho Teams with Textdraw. Here is a part of the Script:
pawn Код:
#include <a_samp>

new DNBScore;
new WScore;
new Text:Textdraw0;
new Text:Textdraw1;
new Text:Textdraw2;
new Text:Textdraw3;
new Text:Textdraw4;

forward UpdateScoreText();

public OnGameModeInit()
{
  SetTimer("UpdateScoreText",5000,1);
  DNBScore = 0;
    WScore = 0;
  Textdraw0 = TextDrawCreate(499.000000,103.000000,"Punktestand:");
    Textdraw1 = TextDrawCreate(499.000000,127.000000,"Arbeiter:");
    Textdraw3 = TextDrawCreate(499.000000,149.000000,"Da Nang Boys:");
    TextDrawTextSize(Textdraw0,607.000000,12.000000);
    TextDrawTextSize(Textdraw1,607.000000,0.000000);
    TextDrawTextSize(Textdraw3,607.000000,0.000000);
    TextDrawLetterSize(Textdraw0,0.499999,2.100000);
    TextDrawLetterSize(Textdraw1,0.399999,2.000000);
    TextDrawLetterSize(Textdraw2,0.399999,1.999999);
    TextDrawLetterSize(Textdraw3,0.299999,1.800000);
    TextDrawLetterSize(Textdraw4,0.399999,2.000000);
    TextDrawColor(Textdraw0,0xffffffff);
    TextDrawColor(Textdraw1,0x0000ffcc);
    TextDrawColor(Textdraw2,0x0000ffcc);
    TextDrawColor(Textdraw3,0xff0000cc);
    TextDrawColor(Textdraw4,0xff0000cc);
    return 1;
}

public UpdateScoreText()
{
    new score1[32];
    format(score1,sizeof(score1),"%d",WScore);
    TextDrawSetString(Textdraw2,score1);
    TextDrawShowForAll(Textdraw2);
    new score2[32];
    format(score2,sizeof(score2),"%d",DNBScore);
    TextDrawSetString(Textdraw4,score2);
    TextDrawShowForAll(Textdraw4);
    return 1;
}

public OnPlayerConnect(playerid)
{
        TextDrawShowForPlayer(playerid,Text:Textdraw0);
        TextDrawShowForPlayer(playerid,Text:Textdraw1);
        TextDrawShowForPlayer(playerid,Text:Textdraw3);
  return 1;
}
Almost everythink works well, but the Score, I want to show, is in the corner of the screen.
Can you help me?
Reply
#2

Set the code in
Reply
#3

Then whats the problem?
Quote:
Originally Posted by Danand
Set the code in
And dont spam
Reply
#4

Change the locations.

Now you will think how can i do that?

Just simply make a new textdraw for test with Zamarohts Textdraw Editor.
Save it and use those locations.
Reply
#5

But when I add "Textdraw2 = TextDrawCreate(578.000000,128.000000,score1);" and "Textdraw4 = TextDrawCreate(578.000000,148.000000,score2);" under public OnGameModeInit(), pawn finds two errors:
error 017: undefined symbol "score1"
error 017: undefined symbol "score2"
Reply
#6

Use " in front of the text and behind.
So:

pawn Код:
Textdraw2 = TextDrawCreate(578.000000, 128.000000, "score1");
Textdraw4 = TextDrawCreate(578.000000, 148.000000, "score2");
Reply
#7

Thanks, now it works perfecly.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)