Help with MySQL loading (cache) - 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)
+--- Thread: Help with MySQL loading (cache) (
/showthread.php?tid=410067)
Help with MySQL loading (cache) -
PaulDinam - 24.01.2013
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;
}
Re: Help with MySQL loading (cache) -
coakiddo - 24.01.2013
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.
Re: Help with MySQL loading (cache) -
PaulDinam - 24.01.2013
Yep
thanks, haven't seen this 0 lol..
so the "i" means row number right?
Re: Help with MySQL loading (cache) -
coakiddo - 24.01.2013
Yes. I'm glad that it works.