28.09.2012, 22:41
hi,
I use a function to load all my houses from a mysql database.
As long as i have defined MAX_HOUSES as 23 its ok but as soon as i increase the number the server doesnt work probperly. Commands dont work etc.
I dont know why.
Can it be due to the loop?
Could it be a kind of overflow?
I hope someone can tell me
Hope someone has a clue on where to start searching...
thanks
I use a function to load all my houses from a mysql database.
As long as i have defined MAX_HOUSES as 23 its ok but as soon as i increase the number the server doesnt work probperly. Commands dont work etc.
I dont know why.
Can it be due to the loop?
Could it be a kind of overflow?
I hope someone can tell me
pawn Код:
//defining
#define MAX_HOUSES 23
#pragma dynamic 50000
//OnGameModeInit
LoadHouses();
//Outside a callback
stock LoadHouses()
{
new row[820],labeltext[256],ceph[820];
for(new h = 0; h < MAX_HOUSES; h++)
{
format(ceph, sizeof(ceph),"SELECT * FROM House WHERE CurrentID=%d",h);
mysql_query(ceph);
mysql_store_result();
mysql_fetch_row(row);
sscanf(row, "p<|>ddds[24]s[35]s[35]ds[45]fffffffddffffddddddddfffffffd",
QuitInHouse__[h],LastVisited__[h],HouseValue__[h],HouseOwner__[h],HousePassword__[h],HouseName__[h],
HouseStorage__[h],HouseLocation__[h],CPOutX__[h],CPOutY__[h],CPOutZ__[h],SpawnOutX__[h],SpawnOutY__[h],
SpawnOutZ__[h],SpawnOutAngle__[h],SpawnWorld__[h],SpawnInterior__[h],HCarPosX__[h],HCarPosY__[h],HCarPosZ__[h],
HCarAngle__[h],HCar__[h],HCarWorld__[h],HCarInt__[h],HCarModel__[h],ForSale__[h],ForSalePrice__[h],HousePrivacy__[h],
CurrentID__[h],INSpawnX__[h],INSpawnY__[h],INSpawnZ__[h],INAngle__[h],INCPX__[h],INCPY__[h],INCPZ__[h],INInterior__[h]);
HousePickupOut[h] = CreateDynamicPickup(PICKUP_MODEL_OUT, PICKUP_TYPE, CPOutX__[h], CPOutY__[h], CPOutZ__[h], SpawnWorld__[h], SpawnInterior__[h], -1, 15.0);
HousePickupInt[h] = CreateDynamicPickup(PICKUP_MODEL_INT, PICKUP_TYPE, INCPX__[h],INCPY__[h],INCPZ__[h], (h + 1000),INInterior__[h], -1, 15.0);
if(!strcmp(HouseOwner__[h], INVALID_HOWNER_NAME, CASE_SENSETIVE))//no owner
{
format(labeltext, sizeof(labeltext), LABELTEXT1, HouseOwner__[h], HouseValue__[h], h);
HouseMIcon[h] = CreateDynamicMapIcon(CPOutX__[h], CPOutY__[h], CPOutZ__[h], 31, -1, SpawnWorld__[h], SpawnInterior__[h], -1, MICON_VD);
}
if(strcmp(HouseOwner__[h], INVALID_HOWNER_NAME, CASE_SENSETIVE))//owned
{
format(labeltext, sizeof(labeltext), LABELTEXT2, HouseName__[h], HouseOwner__[h], HouseValue__[h], YesNo(ForSale__[h]), Answer(HousePrivacy__[h], "Opened", "Closed"), h);
HouseMIcon[h] = CreateDynamicMapIcon(CPOutX__[h], CPOutY__[h], CPOutZ__[h], 32, -1, SpawnWorld__[h], SpawnInterior__[h], -1, MICON_VD);
}
HouseLabel[h] = CreateDynamic3DTextLabel(labeltext, COLOUR_GREEN, CPOutX__[h], CPOutY__[h], CPOutZ__[h]+0.7, TEXTLABEL_DISTANCE, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, TEXTLABEL_TESTLOS, SpawnWorld__[h], SpawnInterior__[h], -1, TEXTLABEL_DISTANCE);
}
mysql_free_result();
return 1;
}
thanks