Why will this only load one house? -
Dokins - 20.11.2011
pawn Код:
stock LoadHouses()
{
new QueryString[128];
mysql_query( "SELECT id, HouseName, HouseOwner, HouseEntX, HouseEntY, HouseEntZ, HouseIntX, HouseIntY, HouseIntZ, HouseInt, HouseWS1, HouseWA1, HouseWS2, HouseWA2, HouseWS3, HouseWA3, HouseMoney, HouseCS, HousePrice, HouseLock FROM Houses");
mysql_store_result();
new x;
if(mysql_num_rows() >= 1)
{
while(mysql_retrieve_row())
{
mysql_get_field("id", QueryString);
x = strval(QueryString);
mysql_get_field("HouseName", HouseName[x]);
mysql_get_field("HouseOwner", HouseOwner[x]);
mysql_get_field( "HouseEntX", QueryString);
HouseEntX[x] = floatstr( QueryString);
mysql_get_field( "HouseEntY", QueryString);
HouseEntY[x] = floatstr( QueryString);
mysql_get_field( "HouseEntZ", QueryString);
HouseEntZ[x] = floatstr( QueryString);
mysql_get_field( "HouseIntX", QueryString);
HouseIntX[x] = floatstr( QueryString);
mysql_get_field( "HouseIntY", QueryString);
HouseIntY[x] = floatstr( QueryString);
mysql_get_field( "HouseIntZ", QueryString);
HouseIntZ[x] = floatstr( QueryString);
mysql_get_field( "HouseInt", QueryString);
HouseInt[x] = strval( QueryString);
mysql_get_field( "HouseWS1", QueryString);
HouseWS1[x] = strval( QueryString);
mysql_get_field( "HouseWA1", QueryString);
HouseWA1[x] = strval( QueryString);
mysql_get_field( "HouseWS2", QueryString);
HouseWS2[x] = strval( QueryString);
mysql_get_field( "HouseWA2", QueryString);
HouseWA2[x] = strval( QueryString);
mysql_get_field( "HouseWS3", QueryString);
HouseWS3[x] = strval( QueryString);
mysql_get_field( "HouseWA3", QueryString);
HouseWA3[x] = strval( QueryString);
mysql_get_field( "HouseMoney", QueryString);
HouseMoney[x] = strval( QueryString);
mysql_get_field( "HouseCS", QueryString);
HouseCS[x] = strval( QueryString) ;
mysql_get_field( "HousePrice", QueryString);
HousePrice[x] = strval( QueryString);
mysql_get_field( "HouseLock", QueryString);
HouseLock[x] = strval( QueryString);
HousePickup[x] = CreateDynamicPickup(1273, 23, HouseEntX[x], HouseEntY[x], HouseEntZ[x], 0, -1, -1, 100.0);
CreateDynamic3DTextLabel(HouseName[x], COLOUR_LIGHTBLUE, HouseEntX[x],HouseEntY[x], HouseEntZ[x], 100.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, 0, -1, -1, 50.0);
}
}
mysql_free_result();
return 1;
}
Re: Why will this only load one house? -
[MG]Dimi - 20.11.2011
I don't know where your script finishes for one house:
1)I guess you need loop?
2)If it finishes at the end with return 1 that's why (It will return and won't continue)
But you need Loop
Re: Why will this only load one house? -
Dokins - 20.11.2011
Thank you, so how would I end it without return 1?
Re: Why will this only load one house? -
Dokins - 20.11.2011
How would I get loop btw?
Re: Why will this only load one house? -
[MG]Dimi - 20.11.2011
You have something like house ID instead of that x, right?
do it like this:
PHP код:
for(new x=0;x</*number of houses here*/;x++)
P.S. Use edit button
Re: Why will this only load one house? -
Dokins - 20.11.2011
Ahh! I see, thats actually what I did, I'll test it now, Thanks.
P.S Thanks!
Re: Why will this only load one house? -
[MG]Dimi - 20.11.2011
No Problem
Re: Why will this only load one house? -
Dokins - 20.11.2011
Alright: Tested it, Failed, It won't load the Text's but loads the pickups, also doesnt display and it seems weird. Like the first house is Not displaying "For Sale" but the second tells me it has an owner although it doesnt.
Re: Why will this only load one house? -
Dokins - 20.11.2011
I just can't do it, can you edit the code and explain?