[MYSQL]sBizz loaded but isn't showing. -
Metharon - 20.11.2014
Ok well look.
OnGameModeInit i called the function IncarcaSBizz();
Код:
stock IncarcaSBIZZ()
{
new Cache: Result = mysql_query( SQL, "SELECT * FROM `sBusiness`" ), Get[ 2 ];
cache_get_data( Get[ 0 ], Get[ 1 ], SQL ); // Get[ 0 ] - Rows || Get[ 1 ] - Fields || SQL - connectionHandle
new string[256];
for(new i = 0; i < Get[ 0 ]; i++)
{
new IDSB = cache_get_field_content_int( i, "ID", SQL );
sBizz[IDSB][sBOwnable] = cache_get_field_content_int( i, "Ownable", SQL );
sBizz[IDSB][sBDeposit] = cache_get_field_content_int( i, "sBDeposit", SQL );
sBizz[IDSB][sBPret] = cache_get_field_content_int( i, "sBPrice", SQL );
sBizz[IDSB][sBX] = cache_get_field_content_float( i, "sBX", SQL );
sBizz[IDSB][sBY] = cache_get_field_content_float( i, "sBY", SQL );
sBizz[IDSB][sBZ] = cache_get_field_content_float( i, "sBY", SQL );
cache_get_field_content( 0, "Titlu", sBizz[IDSB][sBTitlu], SQL, 80 );
cache_get_field_content( 0, "Detinator", sBizz[IDSB][sBDetinator], SQL, 50 );
sBizz[IDSB][sBPickup] = CreateDynamicPickup(1239, 1, sBizz[IDSB][sBX], sBizz[IDSB][sBY], sBizz[IDSB][sBZ], -1, -1, -1, 250.0);
if(sBizz[IDSB][sBOwnable] == 0)
{
format(string, sizeof(string), "{FFCC00}[ %s ]\n\n( Pret de cumparare: {00cc33}%s${FFCC00} )\n{FFCC00}( Tasteaza {CC0033}/buysbizz{FFCC00} )", sBizz[IDSB][sBTitlu], FormatMoney(sBizz[IDSB][sBPret]));
sbizz[IDSB] = CreateDynamic3DTextLabel(string, COLOR_DCHAT, sBizz[IDSB][sBX], sBizz[IDSB][sBY], sBizz[IDSB][sBZ]+0.75,10.0,INVALID_PLAYER_ID,INVALID_VEHICLE_ID,1,0,-1,-1, 100.0);
}
sSBizz++;
}
cache_delete( Result );
printf("[X] sBusiness Loaded - %d",sSBizz);
}
Код:
enum sBusinessInfo
{
sBPickup,
sBTitlu[80],
Float:sBX,
Float:sBY,
Float:sBZ,
sBPret,
sBOwnable,
sBDeposit,
sBDetinator[50]
}
new sBizz[MAX_SBIZZ][sBusinessInfo];
Yes i have new for Text3d , MAX_SBIZZ defined ,sBizz = 0;
On console is looks he load
1 sbizz.
My DB:
http://i.imgur.com/MVPbkLl.png
http://i.imgur.com/FNm3aGG.png
The problem is , on game isn't showing for example there should be the pickup + text 3d
http://i.imgur.com/STlVjLd.png
Can somebody help me please?
Re : [MYSQL]sBizz loaded but isn't showing. -
Dutheil - 20.11.2014
For the number of rows, use that function
cache_get_row_count
Re: [MYSQL]sBizz loaded but isn't showing. -
Metharon - 20.11.2014
UP PLEASE?
Re : [MYSQL]sBizz loaded but isn't showing. -
Dutheil - 20.11.2014
Код:
new rows = cache_get_row_count();
for(new i = 0; i <= rows; i++)
------------------------------------------------------
cache_get_field_content( i, "Titlu", sBizz[IDSB][sBTitlu], SQL, 80 );
cache_get_field_content( i, "Detinator", sBizz[IDSB][sBDetinator], SQL, 50 );
Edit : Aaaaaaaaaah I understood, this is your cache_delete in your loop, there is only one way, after the cache is delete.
Put it after your loop
Re: [MYSQL]sBizz loaded but isn't showing. -
Metharon - 20.11.2014
Stil not working guys... why the hell my 3D text + pickup don't appear?...
Need help! UP
Re : [MYSQL]sBizz loaded but isn't showing. -
Dutheil - 20.11.2014
How many biz are loaded ? (your printf at the end)
Re: [MYSQL]sBizz loaded but isn't showing. -
Metharon - 20.11.2014
Console print :
http://i.imgur.com/TFBYwa9.png
Re : [MYSQL]sBizz loaded but isn't showing. -
Dutheil - 20.11.2014
Compared to this screen :
You has only 1 row ? If yes, it's normal you have only 1 biz loaded...
Otherwise, try this... but i'm not sure. :/
pawn Код:
stock IncarcaSBIZZ()
{
new Cache: Result = mysql_query( SQL, "SELECT * FROM `sBusiness`" );
new IDSB, string[256], rows = cache_get_row_count();
for(new i = 0; i <= rows; i++)
{
IDSB = cache_get_field_content_int( i, "ID");
sBizz[IDSB][sBOwnable] = cache_get_field_content_int( i, "Ownable");
sBizz[IDSB][sBDeposit] = cache_get_field_content_int( i, "sBDeposit");
sBizz[IDSB][sBPret] = cache_get_field_content_int( i, "sBPrice");
sBizz[IDSB][sBX] = cache_get_field_content_float( i, "sBX");
sBizz[IDSB][sBY] = cache_get_field_content_float( i, "sBY");
sBizz[IDSB][sBZ] = cache_get_field_content_float( i, "sBY");
cache_get_field_content( i, "Titlu", sBizz[IDSB][sBTitlu]);
cache_get_field_content( i, "Detinator", sBizz[IDSB][sBDetinator]);
sBizz[IDSB][sBPickup] = CreateDynamicPickup(1239, 1, sBizz[IDSB][sBX], sBizz[IDSB][sBY], sBizz[IDSB][sBZ], -1, -1, -1, 250.0);
if(sBizz[IDSB][sBOwnable] == 0)
{
format(string, sizeof(string), "{FFCC00}[ %s ]\n\n( Pret de cumparare: {00cc33}%s${FFCC00} )\n{FFCC00}( Tasteaza {CC0033}/buysbizz{FFCC00} )", sBizz[IDSB][sBTitlu], FormatMoney(sBizz[IDSB][sBPret]));
sbizz[IDSB] = CreateDynamic3DTextLabel(string, COLOR_DCHAT, sBizz[IDSB][sBX], sBizz[IDSB][sBY], sBizz[IDSB][sBZ]+0.75,10.0,INVALID_PLAYER_ID,INVALID_VEHICLE_ID,1,0,-1,-1, 100.0);
}
sSBizz++;
}
cache_delete( Result );
printf("[X] sBusiness Loaded - %d",sSBizz);
}
Re: [MYSQL]sBizz loaded but isn't showing. -
Metharon - 21.11.2014
UP! Still not working.
Guys i think i found something .
Код:
[03:51:38] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('1')
[03:51:39] [ERROR] cache_get_field_content_int - invalid datatype
[03:51:39] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('1')
[03:51:39] [ERROR] cache_get_field_content_int - invalid datatype
[03:51:39] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('1')
[03:51:39] [ERROR] cache_get_field_content_int - invalid datatype
[03:51:39] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('1')
[03:51:39] [ERROR] cache_get_field_content_int - invalid datatype
[03:51:39] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('1')
[03:51:39] [ERROR] cache_get_field_content_float - invalid datatype
[03:51:39] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('1')
[03:51:39] [ERROR] cache_get_field_content_float - invalid datatype
[03:51:39] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('1')
[03:51:39] [ERROR] cache_get_field_content_float - invalid datatype
[03:51:39] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('1')
[03:51:39] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('1')
From what it could be?
Код:
enum sBusinessInfo
{
sBPickup,
sBTitlu[80],
Float:sBX,
Float:sBY,
Float:sBZ,
sBPret,
sBOwnable,
sBDeposit,
sBDetinator[50]
}
new sBizz[MAX_SBIZZ][sBusinessInfo];
The enum.
Re : [MYSQL]sBizz loaded but isn't showing. -
Dutheil - 21.11.2014
pawn Код:
for(new i = 0; i < rows; i++)