01.06.2015, 06:07
My code is:
This prints the right amount of houses in my database but doesnt spawn pickups and when i use my command /gotohouse whatever id of house i type it teleports me to one position, so it loads all houses on the same position.
Код:
//This is under OnGameModeInit
mysql_function_query(Connection,"SELECT * FROM houses",false,"LoadHouses","i",playerid);
//The public
public LoadHouses()
{
new string[128];
static rows,fields;
cache_get_data(rows, fields, Connection);
for(new i = 0; i < rows; i++)
{
Houses++;
cache_get_field_content(0,"Owner",hInfo[i][hOwner],Connection,64);
hInfo[i][hIndex] = cache_get_field_content_int(0,"ID");
hInfo[i][hPrice] = cache_get_field_content_int(0,"Price");
hInfo[i][hPos][0] = cache_get_field_content_float(0,"X");
hInfo[i][hPos][1] = cache_get_field_content_float(0,"Y");
hInfo[i][hPos][2] = cache_get_field_content_float(0,"Z");
}
format(string,sizeof(string),"Loaded %d houses",Houses);
print(string);
Housess = Houses;
SpawnHouses();
return 1;
}
//SpawnHouses
stock SpawnHouses()
{
new string[128];
while(Housess >= 1)
{
hInfo[Housess][hOne] = CreateDynamicPickup(1273, 1, hInfo[Housess][hPos][0], hInfo[Housess][hPos][1], hInfo[Housess][hPos][2], 0);
format(string, sizeof(string), "House owner:%s", hInfo[Housess][hOwner]);
hInfo[Housess][hTwo] = CreateDynamic3DTextLabel(string, COLOR_WHITE, hInfo[Housess][hPos][0], hInfo[Housess][hPos][1], hInfo[Housess][hPos][2], 0, 0, 0);
Housess--;
}
}


