Float problem, (or bug)?
#1

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?
Reply
#2

well I can't see where you've gone wrong, seems like its getting the data from another player maybe?
Reply
#3

It would help if you posted the code your using..
Reply
#4

Код:
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
Reply
#5

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
Reply
#6

Why is the string size 128?

It should be 15.

128 -
15
___
113 (wasted cells and memory)

"Cash:999999999" has 14 characters + 1 == 15.
Reply
#7

ok i did everything, and it still bugs?
Reply
#8

show the updated code then
Reply
#9

Already deleted it, all it did, was lagg the server to hell and back.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)