Textdraw Updating crash?
#1

Ok, i got a Textdraw Stat bar. It works all up to the point when theres about three people, then everything goes to zero.

pawn Код:
public statspawn(playerid)
{
new Float:pHealth, string[128];
GetPlayerHealth(playerid, pHealth);
format(string, sizeof(string), "Health %.0f", pHealth);
TextDrawSetString(Textdraw0, string);

new Float:pArmour;
GetPlayerArmour(playerid, pArmour);
format(string, sizeof(string), "Armour %.0f", pArmour);
TextDrawSetString(Textdraw1, string);

format(string, sizeof(string), "Cash %d", GetPlayerMoney(playerid));
TextDrawSetString(Textdraw2, string);

format(string, sizeof(string), "Ammo %d", GetPlayerAmmo(playerid));
TextDrawSetString(Textdraw3, string);


format(string, sizeof(string), "kills %d", GetPlayerScore(playerid));
TextDrawSetString(Textdraw5, string);
return 1;}

pawn Код:
SetTimer("statspawn",500,1);
Ideas of why it crashs?
Reply
#2

You can't just throw in playerid and expect it to loop through every player online.

pawn Код:
public statspawn()
{
  new Float:pHealth, string[128], Float:pArmour;;
  for(new playerid; playerid < MAX_PLAYERS; playerid++)
  {
    GetPlayerHealth(playerid, pHealth);
    format(string, sizeof(string), "Health %.0f", pHealth);
    TextDrawSetString(Textdraw0, string);

    GetPlayerArmour(playerid, pArmour);
    format(string, sizeof(string), "Armour %.0f", pArmour);
    TextDrawSetString(Textdraw1, string);

    format(string, sizeof(string), "Cash %d", GetPlayerMoney(playerid));
    TextDrawSetString(Textdraw2, string);

    format(string, sizeof(string), "Ammo %d", GetPlayerAmmo(playerid));
    TextDrawSetString(Textdraw3, string);

    format(string, sizeof(string), "kills %d", GetPlayerScore(playerid));
    TextDrawSetString(Textdraw5, string);
  }
  return 1;
}
Reply
#3

Thanks for the info! let me go test.
Reply
#4

This doesnt work, nothing is updating, and theres MAJOR lag.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)