SA-MP Forums Archive
Textdraw Updating crash? - 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 Updating crash? (/showthread.php?tid=144769)



Textdraw Updating crash? - -Rebel Son- - 29.04.2010

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?


Re: Textdraw Updating crash? - Pixels^ - 29.04.2010

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



Re: Textdraw Updating crash? - -Rebel Son- - 29.04.2010

Thanks for the info! let me go test.


Re: Textdraw Updating crash? - -Rebel Son- - 29.04.2010

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