Help with MySQL loading (cache)
#1

I made 3dtext label system.. but when it loads.. it creates only 1 text draw from the first row, the rest no...

Code:
public LoadDynamicLabels()
{
    new rows, fields, Float:posx, Float:posy, Float:posz, LabelInfo[256], tt[256];
	new total = 0;
    cache_get_data(rows, fields);
    if(rows)
    {
		while(total < rows)
		{
			new temp[12];
			cache_get_row(0, 1, temp), posx = floatstr(temp);
			cache_get_row(0, 2, temp), posy = floatstr(temp);
			cache_get_row(0, 3, temp), posz = floatstr(temp);
			cache_get_row(0, 4, LabelInfo);
			CreateDynamic3DTextLabel(LabelInfo, COLOR_WHITE, posx, posy, posz, 15.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 100.0);
			total++;
		}
    }
	format(tt,sizeof(tt), "Loaded %d labels from MySQL.", total);
	printf(tt);
    return 1; 
}
Reply
#2

Code:
public LoadDynamicLabels()
{
    new rows, fields, Float:posx, Float:posy, Float:posz, LabelInfo[256], tt[256];
	new total = 0;
    cache_get_data(rows, fields);
    if(rows)
    { 
	           for(new i = 0; i < rows+1; i++)
		{
			new temp[12];
			cache_get_row(i, 1, temp), posx = floatstr(temp);
			cache_get_row(i, 2, temp), posy = floatstr(temp);
			cache_get_row(i, 3, temp), posz = floatstr(temp);
			cache_get_row(i, 4, LabelInfo);
			CreateDynamic3DTextLabel(LabelInfo, COLOR_WHITE, posx, posy, posz, 15.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 100.0);
			total++;
		}
    }
	format(tt,sizeof(tt), "Loaded %d labels from MySQL.", total);
	printf(tt);
    return 1; 
}
This should work.
Reply
#3

Yep

thanks, haven't seen this 0 lol..
so the "i" means row number right?
Reply
#4

Yes. I'm glad that it works.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)