04.09.2013, 06:43
Try this maybe?
You should also free the result afterwards.
pawn Код:
stock LoadServerGarages()
{
new row[512], strig[100], TypeString[8], idx;
mysql_query("SELECT * FROM `garageinformation`");
mysql_store_result();
while (mysql_retrieve_row())
{
mysql_fetch_field_row(row,"ID");
GarageInfo[idx][gID] = strval(row);
mysql_fetch_field_row(row,"Type");
GarageInfo[idx][Type] = strval(row);
mysql_fetch_field_row(row,"Price");
GarageInfo[idx][Price] = strval(row);
mysql_fetch_field_row(row,"IsOwned");
GarageInfo[idx][IsOwned] = strval(row);
mysql_fetch_field_row(GarageInfo[idx][Owner],"Owner");
mysql_fetch_field_row(row,"Gar_X");
GarageInfo[idx][Gar_X] = floatstr(row);
mysql_fetch_field_row(row,"Gar_Y");
GarageInfo[idx][Gar_Y] = floatstr(row);
mysql_fetch_field_row(row,"Gar_Z");
GarageInfo[idx][Gar_Z] = floatstr(row);
if(GarageInfo[idx][IsOwned] == 0)
{
switch(GarageInfo[idx][Type])
{
case 1: { TypeString = "Small"; }
case 2: { TypeString = "Medium"; }
case 3: { TypeString = "Large"; }
}
print("Garaged Not Owned");
format(string,sizeof(string),"{33AA33}[{FFFF82}GARAGE{33AA33}]\nType:{FFFF82}%s\n{33AA33}Buy Price:{FFFF82}%d",TypeString,GarageInfo[idx][Price]);
GarageInfo[idx][g3DText] = CreateDynamic3DTextLabel(string, COLOR_WHITE, GarageInfo[idx][Gar_X], GarageInfo[idx][Gar_Y], GarageInfo[idx][Gar_Z], 10);
GarageInfo[idx][gPickup] = CreateDynamicPickup(1318, 23, GarageInfo[idx][Gar_X], GarageInfo[idx][Gar_Y], GarageInfo[idx][Gar_Z], -1, -1, -1, 10);
}
else if(GarageInfo[idx][IsOwned] == 1)
{
switch(GarageInfo[idx][Type])
{
case 1: { TypeString = "Small"; }
case 2: { TypeString = "Medium"; }
case 3: { TypeString = "Large"; }
}
print("Garaged Owned");
format(string,sizeof(string),"{33AA33}[{FFFF82}GARAGE{33AA33}]\nType:{FFFF82}%s\n{33AA33}Owner:{FFFF82}%s\n",TypeString,GarageInfo[idx][Owner]);
GarageInfo[idx][g3DText] = CreateDynamic3DTextLabel(string, COLOR_WHITE, GarageInfo[idx][Gar_X], GarageInfo[idx][Gar_Y], GarageInfo[idx][Gar_Z], 10);
GarageInfo[idx][gPickup] = CreateDynamicPickup(1318, 23, GarageInfo[idx][Gar_X], GarageInfo[idx][Gar_Y], GarageInfo[idx][Gar_Z], -1, -1, -1, 10);
}
idx++;
printf("Loaded Garage: %d",GarageInfo[idx][gID]);
}
mysql_free_result();
return 1;
}