Проблемка с загрузкой домов
Загрузка домов вызывается в ongamemodeinit:
PHP код:
mysql_function_query(MYSQL_ARG, "SELECT * FROM `"TABLE_HOUSES"`", true, "OnHousesLoad","");
PHP код:
public OnHousesLoad() // Коллбэк загрузки
{
new time = GetTickCount();
new string[128],klass[2];
new temp[32],rows,fields, connectionHandle;
cache_get_data(rows,fields,connectionHandle);
if(rows)
{
for(new idx = 1; idx <= rows; idx++)
{
cache_get_field_content(idx-1,"hID",temp,connectionHandle), HouseInfo[idx][hID] = strval(temp);
cache_get_field_content(idx-1,"hOwned",temp,connectionHandle), HouseInfo[idx][hOwned] = strval(temp);
cache_get_field_content(idx-1,"hOwner",HouseInfo[idx][hOwner],connectionHandle,24);
cache_get_field_content(idx-1,"hEnterX",temp,connectionHandle), HouseInfo[idx][hEnterX] = floatstr(temp);
cache_get_field_content(idx-1,"hEnterY",temp,connectionHandle), HouseInfo[idx][hEnterY] = floatstr(temp);
cache_get_field_content(idx-1,"hEnterZ",temp,connectionHandle), HouseInfo[idx][hEnterZ] = floatstr(temp);
cache_get_field_content(idx-1,"hExitX",temp,connectionHandle), HouseInfo[idx][hExitX] = floatstr(temp);
cache_get_field_content(idx-1,"hExitY",temp,connectionHandle), HouseInfo[idx][hExitY] = floatstr(temp);
cache_get_field_content(idx-1,"hExitZ",temp,connectionHandle), HouseInfo[idx][hExitZ] = floatstr(temp);
cache_get_field_content(idx-1,"hLevel",temp,connectionHandle), HouseInfo[idx][hLevel] = strval(temp);
cache_get_field_content(idx-1,"hPrice",temp,connectionHandle), HouseInfo[idx][hPrice] = strval(temp);
cache_get_field_content(idx-1,"hLock",temp,connectionHandle), HouseInfo[idx][hLock] = strval(temp);
cache_get_field_content(idx-1,"hTakings",temp,connectionHandle), HouseInfo[idx][hTakings] = strval(temp);
cache_get_field_content(idx-1,"hInt",temp,connectionHandle), HouseInfo[idx][hInt] = strval(temp);
cache_get_field_content(idx-1,"hHel",temp,connectionHandle), HouseInfo[idx][hHel] = strval(temp);
cache_get_field_content(idx-1,"hClass",temp,connectionHandle), HouseInfo[idx][hClass] = strval(temp);
TOTALHOUSES++;
if(HouseInfo[idx][hOwned] == 0)
{
HouseInfo[idx][hPickupID] = CreatePickup(1273, 23, HouseInfo[idx][hEnterX], HouseInfo[idx][hEnterY], HouseInfo[idx][hEnterZ],-1);
HouseInfo[idx][hIconID] = CreateDynamicMapIcon(HouseInfo[idx][hEnterX], HouseInfo[idx][hEnterY], HouseInfo[idx][hEnterZ], 31, COLOR_WHITE, 0, -1, -1, 200.0);
switch(HouseInfo[idx][hClass])
{
case 0: klass = "E";
case 1: klass = "D";
case 2: klass = "C";
case 3: klass = "B";
case 4: klass = "A";
case 5: klass = "S";
}
format(string,256,"Номер дома: %i\nЦена: %i долларов\nКласс: %s",idx,HouseInfo[idx][hPrice],klass);
HouseInfo[idx][hTextID] = Create3DTextLabel(string,COLOR_SEND,HouseInfo[idx][hEnterX], HouseInfo[idx][hEnterY], HouseInfo[idx][hEnterZ],20.0,0,1);
}
else
{
HouseInfo[idx][hPickupID] = CreatePickup(1272, 23, HouseInfo[idx][hEnterX], HouseInfo[idx][hEnterY], HouseInfo[idx][hEnterZ],-1);
HouseInfo[idx][hIconID] = CreateDynamicMapIcon(HouseInfo[idx][hEnterX], HouseInfo[idx][hEnterY], HouseInfo[idx][hEnterZ], 32, COLOR_WHITE, 0, -1, -1, 200.0);
switch(HouseInfo[idx][hClass])
{
case 0: klass = "E";
case 1: klass = "D";
case 2: klass = "C";
case 3: klass = "B";
case 4: klass = "A";
case 5: klass = "S";
}
format(string,256,"Номер дома: %i\nВладелец: %s\nКласс: %s",idx,HouseInfo[idx][hOwner],klass);
HouseInfo[idx][hTextID] = Create3DTextLabel(string,COLOR_LIGHTRED,HouseInfo[idx][hEnterX], HouseInfo[idx][hEnterY], HouseInfo[idx][hEnterZ],20.0,0,1);
}
}
}
printf("[Загружено домов]: <%i>. Времени затрачено: <%i мс>",TOTALHOUSES,GetTickCount()-time);
return true;
}
Проблема в том, что всегда загружается 0 домов.
- - - Добавлено - - -
Версия MySQL R34