08.07.2011, 20:13
Hi, i've spent this afternoon creating a dynamic housing system for my server.
All worked fine, i could create, edit, delete etc. This was on my windows machine.
I uploaded it to my vps which runs ubuntu 10.10 x86 and tried to run it, and i received the segmentation error.
So i just tried commenting out the line that calls the function that loads my houses.
Then the server loaded up fine.
I could save houses and all that, and they'd show up but without being able to load them on startup it's a bit useless.
Un-commented the line and it wouldn't start again.
This is the code that gets called at startup, can anyone see whats wrong with it?
When i looked into the server log when i uncommented it, it loads the houses, prints those 3 lines then the server stops.
All worked fine, i could create, edit, delete etc. This was on my windows machine.
I uploaded it to my vps which runs ubuntu 10.10 x86 and tried to run it, and i received the segmentation error.
So i just tried commenting out the line that calls the function that loads my houses.
Then the server loaded up fine.
I could save houses and all that, and they'd show up but without being able to load them on startup it's a bit useless.
Un-commented the line and it wouldn't start again.
This is the code that gets called at startup, can anyone see whats wrong with it?
pawn Код:
stock AddHousesFromFile()
{
new Str[67],hid, hprice, howned, huserid, Float:HX, Float:HY, Float:HZ, intid, Float:intX, Float:intY, Float:intZ, houseTotal, Float:vX, Float:vY, Float:vZ, Float:vA;
mysql_query("SELECT * FROM `houses`");
mysql_store_result();
if(mysql_num_rows() > 0)
{
while(mysql_fetch_row(Str))
{
sscanf(Str, "p<|>ddddfffdfffffff", hid, hprice, howned, huserid, HX, HY, HZ, intid, intX, intY, intZ, vX, vY, vZ, vA);
houses[hid][houseid] = hid;
houses[hid][owned] = howned;
houses[hid][price] = hprice;
houses[hid][propx] = HX;
houses[hid][propy] = HY;
houses[hid][propz] = HZ;
houses[hid][propintx] = intX;
houses[hid][propinty] = intY;
houses[hid][propintz] = intZ;
houses[hid][propint] = intid;
houses[hid][vehpropx] = vX;
houses[hid][vehpropy] = vY;
houses[hid][vehpropz] = vZ;
houses[hid][vehpropangle] = vA;
SetHouseOwned(hid, 0, 0);
houseTotal++;
}
}
mysql_free_result();
print("\n------------------------------Houses From Database-----------------------------");
printf(" %i houses loaded.", houseTotal);
print("-------------------------------------------------------------------------------");
}
stock SetHouseOwned(propid, toggle, owner)
{
if(toggle == 1)
{
DestroyDynamicPickup(housepickups[propid]);
DestroyDynamicMapIcon(houseicons[propid]);
housepickups[propid] = CreateDynamicPickup(1272, 1, houses[propid][propx], houses[propid][propy], houses[propid][propz], -1, -1, -1, 200.0);
houseicons[propid] = CreateDynamicMapIcon(houses[propid][propx], houses[propid][propy], houses[propid][propz], 32, 0, -1, -1, -1, 500.0);
houses[propid][ownerid] = owner;
houses[propid][owned] = 1;
}
else if(toggle == 0)
{
DestroyDynamicPickup(housepickups[propid]);
DestroyDynamicMapIcon(houseicons[propid]);
housepickups[propid] = CreateDynamicPickup(1273, 1, houses[propid][propx], houses[propid][propy], houses[propid][propz], -1, -1, -1, 200.0);
houseicons[propid] = CreateDynamicMapIcon(houses[propid][propx], houses[propid][propy], houses[propid][propz], 31, 0, -1, -1, -1, 500.0);
houses[propid][ownerid] = 0;
houses[propid][owned] = 0;
}
return 1;
}