SQL house problem -
TheDarkBlade - 30.09.2016
I am working at an house system and i have a small problem.
well , in the database i have 3 houses which have id 1,2,3
when the server loads the index loads them like 0,1,2
if i increase the index the server loads only 1,2
is there any way of making id 1 ingame to be id 1 in database ?
Codes:
PHP код:
forward OnHousesLoaded();
public OnHousesLoaded()
{
if(!cache_get_row_count()) return print("No houses were loaded.");
else
{
new houses = cache_get_row_count();
printf("%d houses Loaded!",houses);
new PropertyString[250];
for(new i = 0 ; i < houses; i++)
{
HouseInfo[i][hID] = cache_get_field_content_int(i,"ID");
cache_get_field_content(i,"Owner",HouseInfo[i][hOwner],sql,129);
HouseInfo[i][hPrice] = cache_get_field_content_int(i,"Price");
cache_get_field_content(i,"Name",HouseInfo[i][hDiscription],sql,129);
HouseInfo[i][hInteriorX] = cache_get_field_content_float(i,"InteriorX");
HouseInfo[i][hInteriorY] = cache_get_field_content_float(i,"InteriorY");
HouseInfo[i][hInteriorZ] = cache_get_field_content_float(i,"InteriorZ");
HouseInfo[i][hExteriorX] = cache_get_field_content_float(i,"ExteriorX");
HouseInfo[i][hExteriorY] = cache_get_field_content_float(i,"ExteriorY");
HouseInfo[i][hExteriorZ] = cache_get_field_content_float(i,"ExteriorZ");
HouseInfo[i][hOwned] = cache_get_field_content_int(i,"Owned");
HouseInfo[i][hRentabil] = cache_get_field_content_int(i,"Rentabil");
HouseInfo[i][hRentPrice] = cache_get_field_content_int(i,"RentPrice");
HouseInfo[i][hLevel] = cache_get_field_content_int(i,"Level");
if(HouseInfo[i][hOwned] == 0)
{
format(PropertyString, sizeof(PropertyString),"{347235}House {FFFFFF}%d \n{347235}Aceasta casa este de vanzare ! \nDescriere: {FFFFFF}%s \n{347235}Pret: {FFFFFF}$%d \n{347235}Level: {FFFFFF}%d \n{347235}to buy this house type /buyhouse",HouseInfo[i][hID],HouseInfo[i][hDiscription],HouseInfo[i][hPrice],HouseInfo[i][hLevel]);
HouseLabel[i] = Create3DTextLabel(PropertyString ,0x09FF00FF,HouseInfo[i][hExteriorX], HouseInfo[i][hExteriorY], HouseInfo[i][hExteriorZ],40,0);
printf("%d loaded ",HouseInfo[i][hID]);
}
else if(HouseInfo[i][hOwned] == 1)
{
if(HouseInfo[i][hRentabil] == 1)
{
format(PropertyString, sizeof(PropertyString),"{FFFFFF}%s\n {347235}House {FFFFFF}%d \n{347235}Aceasta casa ii apartine lui {FFFFFF}%s \n{347235}Rent: {FFFFFF}$%d \n{347235}Level: {FFFFFF}%d \n{347235}to rent a room type /rentroom",HouseInfo[i][hDiscription],HouseInfo[i][hID],HouseInfo[i][hOwner],HouseInfo[i][hRentPrice],HouseInfo[i][hLevel]);
HouseLabel[i] = Create3DTextLabel(PropertyString ,0x09FF00FF,HouseInfo[i][hExteriorX], HouseInfo[i][hExteriorY], HouseInfo[i][hExteriorZ],40,0);
}
else
{
format(PropertyString, sizeof(PropertyString),"{FFFFFF}Descriere :%s\n {347235}House {FFFFFF}%d \n{347235}Aceasta casa ii apartine lui {FFFFFF}%s \n{347235}Level: {FFFFFF}%d",HouseInfo[i][hDiscription],HouseInfo[i][hID],HouseInfo[i][hOwner], HouseInfo[i][hLevel]);
HouseLabel[i] = Create3DTextLabel(PropertyString ,0x09FF00FF,HouseInfo[i][hExteriorX], HouseInfo[i][hExteriorY], HouseInfo[i][hExteriorZ],40,0);
}
}
}
}
return 1;
}
Re: SQL house problem -
MEW273 - 30.09.2016
Edit: This won't work, sorry, am writing another response.
Re: SQL house problem -
TheDarkBlade - 30.09.2016
Anyone ?
Re: SQL house problem -
TheDarkBlade - 01.10.2016
BUMP
Re: SQL house problem -
TheDarkBlade - 01.10.2016
Someone ? please i really need some help with this .
Re: SQL house problem -
Mencent - 01.10.2016
Hello.
I think this is what you want.
PHP код:
forward OnHousesLoaded();
public OnHousesLoaded()
{
if(!cache_get_row_count()) returnprint("No houses were loaded.");
else
{
new houses = cache_get_row_count();
printf("%d houses Loaded!",houses);
new PropertyString[250];
for(new i = 0 ; i < houses; i++)
{
HouseInfo[i+1][hID] = cache_get_field_content_int(i,"ID");
cache_get_field_content(i,"Owner",HouseInfo[i+1][hOwner],sql,129);
HouseInfo[i+1][hPrice]=cache_get_field_content_int(i,"Price");
cache_get_field_content(i,"Name",HouseInfo[i+1][hDiscription],sql,129);
HouseInfo[i+1][hInteriorX]=cache_get_field_content_float(i,"InteriorX");
HouseInfo[i+1][hInteriorY]=cache_get_field_content_float(i,"InteriorY");
HouseInfo[i+1][hInteriorZ]=cache_get_field_content_float(i,"InteriorZ");
HouseInfo[i+1][hExteriorX]=cache_get_field_content_float(i,"ExteriorX");
HouseInfo[i+1][hExteriorY]=cache_get_field_content_float(i,"ExteriorY");
HouseInfo[i+1][hExteriorZ]=cache_get_field_content_float(i,"ExteriorZ");
HouseInfo[i+1][hOwned]=cache_get_field_content_int(i,"Owned");
HouseInfo[i+1][hRentabil]=cache_get_field_content_int(i,"Rentabil");
HouseInfo[i+1][hRentPrice]=cache_get_field_content_int(i,"RentPrice");
HouseInfo[i+1][hLevel]=cache_get_field_content_int(i,"Level");
if(HouseInfo[i+1][hOwned]==0)
{
format(PropertyString, sizeof(PropertyString),"{347235}House {FFFFFF}%d \n{347235}Aceasta casa este de vanzare ! \nDescriere: {FFFFFF}%s \n{347235}Pret: {FFFFFF}$%d \n{347235}Level: {FFFFFF}%d \n{347235}to buy this house type /buyhouse",HouseInfo[i+1][hID],HouseInfo[i+1][hDiscription],HouseInfo[i+1][hPrice],HouseInfo[i+1][hLevel]);
HouseLabel[i+1] = Create3DTextLabel(PropertyString ,0x09FF00FF,HouseInfo[i+1][hExteriorX], HouseInfo[i+1][hExteriorY], HouseInfo[i+1][hExteriorZ],40,0);
printf("%d loaded ",HouseInfo[i+1][hID]);
}
else if(HouseInfo[i+1][hOwned] == 1)
{
if(HouseInfo[i+1][hRentabil] == 1)
{
format(PropertyString, sizeof(PropertyString),"{FFFFFF}%s\n {347235}House {FFFFFF}%d \n{347235}Aceasta casa ii apartine lui {FFFFFF}%s \n{347235}Rent: {FFFFFF}$%d \n{347235}Level: {FFFFFF}%d \n{347235}to rent a room type /rentroom",HouseInfo[i+1][hDiscription],HouseInfo[i+1][hID],HouseInfo[i+1][hOwner],HouseInfo[i+1][hRentPrice],HouseInfo[i+1][hLevel]);
HouseLabel[i+1] = Create3DTextLabel(PropertyString ,0x09FF00FF,HouseInfo[i+1][hExteriorX], HouseInfo[i+1][hExteriorY], HouseInfo[i+1][hExteriorZ],40,0);
}
else
{
format(PropertyString, sizeof(PropertyString),"{FFFFFF}Descriere :%s\n {347235}House {FFFFFF}%d \n{347235}Aceasta casa ii apartine lui {FFFFFF}%s \n{347235}Level: {FFFFFF}%d",HouseInfo[i+1][hDiscription],HouseInfo[i+1][hID],HouseInfo[i+1][hOwner], HouseInfo[i+1][hLevel]);
HouseLabel[i+1] = Create3DTextLabel(PropertyString ,0x09FF00FF,HouseInfo[i+1][hExteriorX], HouseInfo[i+1][hExteriorY], HouseInfo[i+1][hExteriorZ],40,0);
}
}
}
}
return 1;
}*
Re: SQL house problem -
TheDarkBlade - 01.10.2016
it does not work
it's the same thing as increasing the index
Re: SQL house problem -
TheDarkBlade - 01.10.2016
Bump
Re: SQL house problem -
Ner0x96 - 01.10.2016
Show me your create house system, maybe I can help you with that, have you got any function for it?