12.03.2014, 16:51
Hello I have house created in database and know I try everything to load houses but no sucess
so this on ongamemodeinit
and this is LoadHouses public
so this on ongamemodeinit
pawn Код:
new rows,fields;
cache_get_data(rows,fields,mysql);
for(new i = 1; i <= rows; i++)
{
mysql_format(mysql,query,sizeof(query),"SELECT * FROM houses WHERE ID = '%d' LIMIT 1",i);
mysql_tquery(mysql,query,"LoadHouses","i");
}
pawn Код:
LoadHouses(extraid,type);
public LoadHouses(extraid,type)
{
new rows,fields;
cache_get_data(rows,fields,mysql);
switch(type)
{
case THREAD_UCITAJKUCU:
{
if(IsPlayerConnected(extraid))
{
new i = 0;
while( i < rows)
{
if(i >= MAX_KUCA)
break;
new result[128];
cache_get_field_content(i,"ID",result,mysql); KucaInfo[extraid][KucaID] = strval(result);
cache_get_field_content(i,"UlazX",result,mysql); KucaInfo[extraid][hUlazX] = floatstr(result);
cache_get_field_content(i,"UlazY",result,mysql); KucaInfo[extraid][hUlazY] = floatstr(result);
cache_get_field_content(i,"UlazZ",result,mysql); KucaInfo[extraid][hUlazZ] = floatstr(result);
cache_get_field_content(i,"IzlazX",result,mysql); KucaInfo[extraid][hIzlazX] = floatstr(result);
cache_get_field_content(i,"IzlazY",result,mysql); KucaInfo[extraid][hIzlazY] = floatstr(result);
cache_get_field_content(i,"IzlazZ",result,mysql); KucaInfo[extraid][hIzlazZ] = floatstr(result);
cache_get_field_content(i,"Tip",result,mysql); KucaInfo[extraid][hTip] = strval(result);
cache_get_field_content(i,"Level",result,mysql); KucaInfo[extraid][hLevel] = strval(result);
cache_get_field_content(i,"BrojSoba",result,mysql); KucaInfo[extraid][hRooms] = strval(result);
cache_get_field_content(i,"Interior",result,mysql); KucaInfo[extraid][hInt] = strval(result);
cache_get_field_content(i,"hHel",result,mysql); KucaInfo[extraid][hHel] = strval(result);
cache_get_field_content(i,"hArm",result,mysql); KucaInfo[extraid][hArm] = strval(result);
cache_get_field_content(i,"ImaVlasnika",result,mysql); KucaInfo[extraid][hImaVlasnika] = strval(result);
cache_get_field_content(i,"hWorld",result,mysql); KucaInfo[extraid][hWorld] = strval(result);
cache_get_field_content(i,"Cijena",result,mysql); KucaInfo[extraid][hCijena] = strval(result);
cache_get_field_content(i,"Opis",KucaInfo[extraid][hOpis],mysql,128);
cache_get_field_content(i,"Vlasnik",KucaInfo[extraid][hVlasnik],mysql,128);
cache_get_field_content(i,"DostupnoZaRent",result,mysql); KucaInfo[extraid][hRentabil] = strval(result);
cache_get_field_content(i,"Rent",result,mysql); KucaInfo[extraid][hRent] = strval(result);
cache_get_field_content(i,"Zakljucano",result,mysql); KucaInfo[extraid][hLock] = strval(result);
cache_get_field_content(i,"Adresa",KucaInfo[extraid][hAdresa],mysql,128);
cache_get_field_content(i,"hSef",result,mysql); KucaInfo[extraid][hSef] = strval(result);
cache_get_field_content(i,"hDroga",result,mysql); KucaInfo[extraid][hDroga] = strval(result);
cache_get_field_content(i,"hMats",result,mysql); KucaInfo[extraid][hMats] = strval(result);
cache_get_field_content(i,"Oruzje1",result,mysql); KucaInfo[extraid][Oruzje1] = strval(result);
cache_get_field_content(i,"Municija1",result,mysql); KucaInfo[extraid][Municija1] = strval(result);
cache_get_field_content(i,"Oruzje2",result,mysql); KucaInfo[extraid][Oruzje2] = strval(result);
cache_get_field_content(i,"Municija2",result,mysql); KucaInfo[extraid][Municija2] = strval(result);
cache_get_field_content(i,"Oruzje3",result,mysql); KucaInfo[extraid][Oruzje3] = strval(result);
cache_get_field_content(i,"Municija3",result,mysql); KucaInfo[extraid][Municija3] = strval(result);
new str[800];
if(KucaInfo[extraid][hImaVlasnika] == 0)
{
format(str,sizeof(str),"{0ed400}Na Prodaju\n{0ed400}Opis: {FFFFFF}%s\n{0ed400}Level: {FFFFFF}%d\n{0ed400}Adresa: {FFFFFF}%s\n{0ed400}Cijena: {FFFFFF}%d$",KucaInfo[extraid][hOpis],KucaInfo[extraid][hLevel],KucaInfo[extraid][hAdresa],KucaInfo[extraid][hCijena]);
UpdateDynamic3DTextLabelText(KucaLabel[extraid],0x00FFFFFF,str);
DestroyDynamicPickup(KucaPickup[extraid]);
KucaPickup[extraid] = CreateDynamicPickup(1273,1,KucaInfo[extraid][hUlazX],KucaInfo[extraid][hUlazY],KucaInfo[extraid][hUlazZ]);
}
if(KucaInfo[extraid][hImaVlasnika] == 1)
{
if(KucaInfo[extraid][hRentabil] == 0)
{
format(str,800,"{0ed400}Vlasnik Kuce: {FFFFFF}%s\n{0ed400}Opis: {FFFFFF}%s\n{0ed400}Level: {FFFFFF}%d\n{0ed400}Adresa: {FFFFFF}%s",KucaInfo[extraid][hVlasnik],KucaInfo[extraid][hOpis],KucaInfo[extraid][hLevel],KucaInfo[extraid][hAdresa]);
}
else if(KucaInfo[extraid][hRentabil] == 1)
{
format(str,800,"{0ed400}Vlasnik Kuce: {FFFFFF}%s\n{0ed400}Opis: {FFFFFF}%s\n{0ed400}Level: {FFFFFF}%d\n{0ed400}Adresa: {FFFFFF}%s\n{0ed400}Rent: {FFFFFF}%d$\n{0ed400}Najam: {FFFFFF}/rentroom",KucaInfo[extraid][hVlasnik],KucaInfo[extraid][hOpis],KucaInfo[extraid][hLevel],KucaInfo[extraid][hAdresa],KucaInfo[extraid][hRent]);
}
UpdateDynamic3DTextLabelText(KucaLabel[extraid],0x00FF00AA,str);
DestroyDynamicPickup(KucaPickup[extraid]);
KucaPickup[extraid] = CreateDynamicPickup(1239,1,KucaInfo[extraid][hUlazX],KucaInfo[extraid][hUlazY],KucaInfo[extraid][hUlazZ]);
}
}
}
}
}
return 1;
}