Float problem, (or bug)? -
-Rebel Son- - 29.04.2010
Ok i got a stat bar, and it works fine till about 4-5 people come in, then it starts bugging out, your armour float drops to zero. your health float stays 100, and kills and deaths dont move or end up diffrent numbers. and cash is fake number Any ideas?
Re: Float problem, (or bug)? -
cessil - 29.04.2010
well I can't see where you've gone wrong, seems like its getting the data from another player maybe?
Re: Float problem, (or bug)? -
Pixels^ - 29.04.2010
It would help if you posted the code your using..
Re: Float problem, (or bug)? -
-Rebel Son- - 29.04.2010
Код:
public statspawn(playerid)
{
new Float:pHealth, string[128];
GetPlayerHealth(playerid, pHealth);
format(string, sizeof(string), "Health:%.0f", pHealth);
TextDrawSetString(Textdraw1, string);
new Float:pArmour;
GetPlayerArmour(playerid, pArmour);
format(string, sizeof(string), "Armour:%.0f", pArmour);
TextDrawSetString(Textdraw2, string);
format(string, sizeof(string), "kills:%d", GetPlayerScore(playerid));
TextDrawSetString(Textdraw3, string);
format(string, sizeof(string), "Deaths:%d", GetPVarInt(playerid,"Deaths"));
TextDrawSetString(Textdraw4, string);
new pCash = GetPlayerMoney(playerid);
format(string, sizeof(string), "Cash:%d", pCash);
TextDrawSetString(Textdraw5, string);
return 1;}
and a timer for the function with a interval of 500
Re: Float problem, (or bug)? -
cessil - 29.04.2010
so you have 1 textdraw that cycles through every player and gets the health and sets the string, for the 1 textdraw.
if you're meant to have it for every player I suggest having it Textdraw1[MAX_PLAYERS]; and Textdraw1[playerid], lessening the timer from 500ms to at least 1000ms and after you set the textdraw string use TextDrawShowForPlayer
Re: Float problem, (or bug)? -
Miguel - 29.04.2010
Why is the string size 128?
It should be
15.
128 -
15
___
113 (wasted cells and memory)
"Cash:999999999" has 14 characters + 1 == 15.
Re: Float problem, (or bug)? -
-Rebel Son- - 29.04.2010
ok i did everything, and it still bugs?
Re: Float problem, (or bug)? -
cessil - 29.04.2010
show the updated code then
Re: Float problem, (or bug)? -
-Rebel Son- - 29.04.2010
Already deleted it, all it did, was lagg the server to hell and back.