SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 24/01/2013, 07:46 AM   #1
PaulDinam
Gangsta
 
Join Date: Jun 2011
Posts: 887
Reputation: 45
Default Help with MySQL loading (cache)

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; 
}
PaulDinam is offline   Reply With Quote
Old 24/01/2013, 07:52 AM   #2
coakiddo
Big Clucker
 
coakiddo's Avatar
 
Join Date: Nov 2012
Posts: 56
Reputation: 32
Default Re: Help with MySQL loading (cache)

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.
coakiddo is offline   Reply With Quote
Old 24/01/2013, 07:59 AM   #3
PaulDinam
Gangsta
 
Join Date: Jun 2011
Posts: 887
Reputation: 45
Default Re: Help with MySQL loading (cache)

Yep

thanks, haven't seen this 0 lol..
so the "i" means row number right?
PaulDinam is offline   Reply With Quote
Old 24/01/2013, 08:01 AM   #4
coakiddo
Big Clucker
 
coakiddo's Avatar
 
Join Date: Nov 2012
Posts: 56
Reputation: 32
Default Re: Help with MySQL loading (cache)

Yes. I'm glad that it works.
coakiddo is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[GameMode] Basic MySQL Account Script [MySQL R7, cache functions, easydialog, Whirlpool, salted passwords] ReneG Gamemode Scripts 70 02/03/2014 11:48 AM
[GameMode] MySQL CLEAN GAMEMODE [Whirlpool, MySQL BlueG R7, Cache, Ready Package (Windows)] GiamPy. Gamemode Scripts 13 13/09/2013 04:31 PM
Example for MySQL R7 Cache AphexCCFC Scripting Help 5 26/01/2013 11:50 AM
MYSQL Cache get row PaulDinam Scripting Help 3 18/01/2013 10:29 AM


All times are GMT. The time now is 04:39 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.