Textdraw problem.
#1

I have made textdraw, which shows player Kills, Deaths, Level, EXP. Here is code:

pawn Код:
OnGameModeInt()

format(tstring, sizeof(tstring), "[Kills: %d]");
  Textdraw0 = TextDrawCreate(13.000000,435.000000, tstring);
  format(tstring, sizeof(tstring), "[Deaths: %d]");
  Textdraw1 = TextDrawCreate(137.000000,435.000000, tstring);
  format(tstring, sizeof(tstring), "[Level: %d]");
  Textdraw2 = TextDrawCreate(294.000000,435.000000, tstring);
  format(tstring, sizeof(tstring), "[EXP: %d]");
  Textdraw3 = TextDrawCreate(416.000000,435.000000, tstring);
  TextDrawUseBox(Textdraw0,1);
  TextDrawBoxColor(Textdraw0,0x000000ff);
  TextDrawTextSize(Textdraw0,629.000000,-3.000000);
  TextDrawAlignment(Textdraw0,0);
  TextDrawAlignment(Textdraw1,0);
  TextDrawAlignment(Textdraw2,0);
  TextDrawAlignment(Textdraw3,0);
  TextDrawBackgroundColor(Textdraw0,0x000000ff);
  TextDrawBackgroundColor(Textdraw1,0x000000ff);
  TextDrawBackgroundColor(Textdraw2,0x000000ff);
  TextDrawBackgroundColor(Textdraw3,0x000000ff);
  TextDrawFont(Textdraw0,1);
  TextDrawLetterSize(Textdraw0,0.499999,1.100000);
  TextDrawFont(Textdraw1,1);
  TextDrawLetterSize(Textdraw1,0.499999,1.100000);
  TextDrawFont(Textdraw2,1);
  TextDrawLetterSize(Textdraw2,0.499999,1.100000);
  TextDrawFont(Textdraw3,1);
  TextDrawLetterSize(Textdraw3,0.499999,1.100000);
  TextDrawColor(Textdraw0,0x00ff0099);
  TextDrawColor(Textdraw1,0xff0000cc);
  TextDrawColor(Textdraw2,0xffff0099);
  TextDrawColor(Textdraw3,0xffffffff);
  TextDrawSetOutline(Textdraw1,1);
  TextDrawSetOutline(Textdraw2,1);
  TextDrawSetOutline(Textdraw3,1);
  TextDrawSetProportional(Textdraw0,1);
  TextDrawSetProportional(Textdraw1,1);
  TextDrawSetProportional(Textdraw2,1);
  TextDrawSetProportional(Textdraw3,1);
  TextDrawSetShadow(Textdraw1,1);
  TextDrawSetShadow(Textdraw2,1);
  TextDrawSetShadow(Textdraw3,1);


//A timer which updates in 2 seconds

public TextDrawUpdate()
{
  for(new i; i<MAX_PLAYERS; i++)
    {
    format(tstring, sizeof(tstring), "[Kills: %d]", Kills[i]);
    TextDrawSetString(Textdraw0, tstring);
    format(tstring, sizeof(tstring), "[Deaths: %d]", Deaths[i]);
    TextDrawSetString(Textdraw1, tstring);
    format(tstring, sizeof(tstring), "[Level: %d]", Level[i]);
    TextDrawSetString(Textdraw2, tstring);
    format(tstring, sizeof(tstring), "[EXP: %d]", EXP[i]);
    TextDrawSetString(Textdraw3, tstring);
  }
}
But all I can see is Kills: 0, Deaths: 0..... But my kills, or deaths are for example 5 and 1. When i check it with stats command, it shows me my Kills, Deaths, but textdraw shows only 0.
Reply
#2

That's because you've forgotten something. Like, I will show you an example with the name of a player:

pawn Код:
new playername[MAX_PLAYER_NAME]; GetPlayerName(playerid, playername, sizeof(playername));
format(tstring, sizeof(tstring), "Name: %d", playername); // Did you notice the difference?
Reply
#3

I tried. Now i put OnGameModeInt() this:
pawn Код:
for(new i; i<MAX_PLAYERS; i++) {
  format(tstring, sizeof(tstring), "[Kills: %d]", Kills[i]);
  Textdraw0 = TextDrawCreate(13.000000,435.000000, tstring);
  format(tstring, sizeof(tstring), "[Deaths: %d]", Deaths[i]);
  Textdraw1 = TextDrawCreate(137.000000,435.000000, tstring);
  format(tstring, sizeof(tstring), "[Level: %d]", Level[i]);
  Textdraw2 = TextDrawCreate(294.000000,435.000000, tstring);
  format(tstring, sizeof(tstring), "[EXP: %d]", EXP[i]);
  Textdraw3 = TextDrawCreate(416.000000,435.000000, tstring); }
Its same. Not working
Reply
#4

Код:
Textdraw0[i] = TextDrawCreate(13.0,435.0, "_");
Textdraw1[i] = TextDrawCreate(137.0,435.0, "_");
Textdraw2[i] = TextDrawCreate(294.0,435.000000, "_");
Textdraw3[i] = TextDrawCreate(416.0,435.0, "_");
Reply
#5

Now I put my textdraw only in timer, but still it doesn't work.

pawn Код:
public TextDrawUpdate()
{
    TextDrawDestroy(Textdraw0);
    for(new i; i<MAX_PLAYERS; i++) {
    new tstring[60];
  format(tstring, sizeof(tstring), "[Kills: %d] [Deaths: %d] [Level: %d] [EXP: %d]", Kills[i], Deaths[i], Level[i], EXP[i]);
  Textdraw0 = TextDrawCreate(13.000000,435.000000, tstring);
  TextDrawUseBox(Textdraw0,1);
  TextDrawBoxColor(Textdraw0,0x000000ff);
  TextDrawTextSize(Textdraw0,629.000000,-3.000000);
  TextDrawBackgroundColor(Textdraw0,0x000000ff);
  TextDrawFont(Textdraw0,1);
  TextDrawLetterSize(Textdraw0,0.499999,1.100000);
  TextDrawColor(Textdraw0,0x00ff0099); }
}
Reply
#6

Why you dont use TextDrawSetString.....
Reply
#7

Quote:
Originally Posted by gytisx
Why you dont use TextDrawSetString.....
Because with TextDrawSetString it doesn't work too.
Reply
#8

Quote:
Originally Posted by Scott[LT
]
Quote:
Originally Posted by gytisx
Why you dont use TextDrawSetString.....
Because with TextDrawSetString it doesn't work too.
It is working to me
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)