08.08.2009, 10:19
Hey, I created a function to load all the houses added in by AddHouses (which I made earlier)
is something wrong:
Now Under GameModeInit, I put LoadHouses(2) so it loads house number two (yes the file name is 2.cer) and when I launch the server I get a don't send error, I did a DEBUG and I traced it to LoadHouses(2); that is the only LoadHouses code in OnGameModeInit .. or in the whole script at the matter.
is something wrong:
Код:
public LoadHouses(houseid)
{
new string2[64];
format(string2, sizeof(string2), "accounts/%d.cer", houseid);
new File: HouseFile = fopen(string2, io_read);
new key[128],val[128];
new Data[128];
while(fread(HouseFile,Data,sizeof(Data)))
{
key = ini_GetKey(Data);
if( strcmp( key , "HouseOwner" , true ) == 0 ) { val = ini_GetValue( Data ); HouseInfo[houseid][hHouseOwnerName] = strval( val ); }
if( strcmp( key , "HouseOwnerId" , true ) == 0 ) { val = ini_GetValue( Data ); HouseInfo[houseid][hHouseOwnerId] = strval( val ); }
if( strcmp( key , "HouseInterior" , true ) == 0 ) { val = ini_GetValue( Data ); HouseInfo[houseid][hHouseInterior] = strval( val ); }
if( strcmp( key , "HouseId" , true ) == 0 ) { val = ini_GetValue( Data ); HouseInfo[houseid][hHouseId] = strval( val ); }
if( strcmp( key , "Cost" , true ) == 0 ) { val = ini_GetValue( Data ); HouseInfo[houseid][hHouseCost] = strval( val ); }
if( strcmp( key , "Locked" , true ) == 0 ) { val = ini_GetValue( Data ); HouseInfo[houseid][hHouseLocked] = strval( val ); }
if( strcmp( key , "Housex" , true ) == 0 ) { val = ini_GetValue( Data ); HouseInfo[houseid][hHousex] = strval( val ); }
if( strcmp( key , "Housey" , true ) == 0 ) { val = ini_GetValue( Data ); HouseInfo[houseid][hHousey] = strval( val ); }
if( strcmp( key , "Housez" , true ) == 0 ) { val = ini_GetValue( Data ); HouseInfo[houseid][hHousez] = strval( val ); }
}
fclose(HouseFile);
HousePickup[houseid] = CreatePickup(1273,1,HouseInfo[houseid][hHousex], HouseInfo[houseid][hHousey], HouseInfo[houseid][hHousez]);
print("Houses Loaded");
return 1;
}

