30.06.2014, 17:54
Hello guys!
i encounterd some problems with file saving.
House file should be like this:
But its like this:
After each save it writes same data.
Heres is my code:
i encounterd some problems with file saving.
House file should be like this:
Код:
Created = 1 Owned = 1 Owner = Interneto_Tiekejas Locked = 1 EnterX = -2642.044433 EnterY = 727.881530 EnterZ = 27.960937 ExitX = 328.493988 ExitY = 1480.589965 ExitZ = 1084.449951 Garage EnterX = 0.000000 Garage EnterY = 0.000000 Garage EnterZ = 0.000000 Garage ExitX = 0.000000 Garage ExitY = 0.000000 Garage ExitZ = 0.000000 Garage Occupied = 0 Garage Locked = 0 Has a Garage = 0 Address = Santa Flora Description = Medium/1 story/2 bedrooms Interior = 15 VirtualWorld = 1 Price = 95827 IsRentable = 1 RentPrice = 0 Renter = Nera IsRented = 0 Money = 0 Gun1 = 0 Ammo1 = 0 Gun2 = 0 Ammo2 = 0 Taxes = 24
Код:
Created = 1 Owned = 1 Owner = Interneto_Tiekejas Locked = 1 EnterX = -2642.044433 EnterY = 727.881530 EnterZ = 27.960937 ExitX = 328.493988 ExitY = 1480.589965 ExitZ = 1084.449951 Garage EnterX = 0.000000 Garage EnterY = 0.000000 Garage EnterZ = 0.000000 Garage ExitX = 0.000000 Garage ExitY = 0.000000 Garage ExitZ = 0.000000 Garage Occupied = 0 Garage Locked = 0 Has a Garage = 0 Address = Santa Flora Description = Medium/1 story/2 bedrooms Interior = 15 VirtualWorld = 1 Price = 95827 IsRentable = 1 RentPrice = 0 Renter = Nera IsRented = 0 Money = 0 Gun1 = 0 Ammo1 = 0 Gun2 = 0 Ammo2 = 0 Taxes = 24 Garage EnterX = 0.000000 Garage EnterY = 0.000000 Garage EnterZ = 0.000000 Garage ExitX = 0.000000 Garage ExitY = 0.000000 Garage ExitZ = 0.000000 Garage Occupied = 0 Garage Locked = 0 Has a Garage = 0 Garage EnterX = 0.000000 Garage EnterY = 0.000000 Garage EnterZ = 0.000000 Garage ExitX = 0.000000 Garage ExitY = 0.000000 Garage ExitZ = 0.000000 Garage Occupied = 0 Garage Locked = 0 Has a Garage = 0 Garage EnterX = -2645.104248 Garage EnterY = 725.416381 Garage EnterZ = 27.960937 Garage ExitX = 616.781982 Garage ExitY = -74.815101 Garage ExitZ = 997.635009 Garage Occupied = 0 Garage Locked = 1 Has a Garage = 1 Garage EnterX = -2645.104248 Garage EnterY = 725.416381 Garage EnterZ = 27.960937 Garage ExitX = 616.781982 Garage ExitY = -74.815101 Garage ExitZ = 997.635009 Garage Occupied = 0 Garage Locked = 0 Has a Garage = 1 Garage EnterX = -2645.020263 Garage EnterY = 724.621398 Garage EnterZ = 27.960937 Garage ExitX = 616.781982 Garage ExitY = -74.815101 Garage ExitZ = 997.635009 Garage Occupied = 0 Garage Locked = 1 Has a Garage = 1 Garage EnterX = -2645.020263 Garage EnterY = 724.621398 Garage EnterZ = 27.960937 Garage ExitX = 616.781982 Garage ExitY = -74.815101 Garage ExitZ = 997.635009 Garage Occupied = 0 Garage Locked = 0 Has a Garage = 1 Garage EnterX = -2645.020263 Garage EnterY = 724.621398 Garage EnterZ = 27.960937 Garage ExitX = 616.781982 Garage ExitY = -74.815101 Garage ExitZ = 997.635009 Garage Occupied = 0 Garage Locked = 1 Has a Garage = 1 Garage EnterX = -2645.020263 Garage EnterY = 724.621398 Garage EnterZ = 27.960937 Garage ExitX = 616.781982 Garage ExitY = -74.815101 Garage ExitZ = 997.635009 Garage Occupied = 0 Garage Locked = 0 Has a Garage = 1
Heres is my code:
pawn Код:
stock SaveHouseData(houseid)
{
new hFile[150];
format(hFile,sizeof(hFile),"Namai/%d.ini", houseid);
new INI:File = INI_Open(hFile);
INI_WriteInt(File,"Created",HouseInfo[houseid][hCreated]);
INI_WriteInt(File,"Owned",HouseInfo[houseid][hOwned]);
INI_WriteString(File,"Owner",HouseInfo[houseid][hOwnerName]);
INI_WriteInt(File,"Locked",HouseInfo[houseid][hLocked]);
INI_WriteFloat(File,"EnterX",HouseInfo[houseid][hEnterX]);
INI_WriteFloat(File,"EnterY",HouseInfo[houseid][hEnterY]);
INI_WriteFloat(File,"EnterZ",HouseInfo[houseid][hEnterZ]);
INI_WriteFloat(File,"ExitX",HouseInfo[houseid][hExitX]);
INI_WriteFloat(File,"ExitY",HouseInfo[houseid][hExitY]);
INI_WriteFloat(File,"ExitZ",HouseInfo[houseid][hExitZ]);
INI_WriteFloat(File,"Garage EnterX",HouseInfo[houseid][hGEnterX]);
INI_WriteFloat(File,"Garage EnterY",HouseInfo[houseid][hGEnterY]);
INI_WriteFloat(File,"Garage EnterZ",HouseInfo[houseid][hGEnterZ]);
INI_WriteFloat(File,"Garage ExitX",HouseInfo[houseid][hGExitX]);
INI_WriteFloat(File,"Garage ExitY",HouseInfo[houseid][hGExitY]);
INI_WriteFloat(File,"Garage ExitZ",HouseInfo[houseid][hGExitZ]);
INI_WriteInt(File,"Garage Occupied",HouseInfo[houseid][hGIsOccupied]);
INI_WriteInt(File,"Garage Locked",HouseInfo[houseid][hGIsLocked]);
INI_WriteInt(File,"Has a Garage",HouseInfo[houseid][hhasAGarage]);
INI_WriteString(File,"Address",HouseInfo[houseid][hAddress]);
INI_WriteString(File,"Description",HouseInfo[houseid][hDescription]);
INI_WriteInt(File,"Interior",HouseInfo[houseid][hInterior]);
INI_WriteInt(File,"VirtualWorld",HouseInfo[houseid][hVirtualWorld]);
INI_WriteInt(File,"Price",HouseInfo[houseid][hPrice]);
INI_WriteInt(File,"IsRentable",HouseInfo[houseid][hIsRentable]);
INI_WriteInt(File,"RentPrice",HouseInfo[houseid][hRentPrice]);
INI_WriteString(File,"Renter",HouseInfo[houseid][hRenter]);
INI_WriteInt(File,"IsRented",HouseInfo[houseid][hIsRented]);
INI_WriteInt(File,"Money",HouseInfo[houseid][hMoney]);
INI_WriteInt(File,"Gun1",HouseInfo[houseid][hGun1]);
INI_WriteInt(File,"Ammo1",HouseInfo[houseid][hAmmo1]);
INI_WriteInt(File,"Gun2",HouseInfo[houseid][hGun2]);
INI_WriteInt(File,"Ammo2",HouseInfo[houseid][hAmmo2]);
INI_WriteInt(File,"Taxes",HouseInfo[houseid][hTaxes]);
INI_Close(File);
return 1;
}
forward LoadHouseData(houseid, name[], value[]);
public LoadHouseData(houseid, name[], value[])
{
INI_Int("Created",HouseInfo[houseid][hCreated]);
INI_Int("Owned",HouseInfo[houseid][hOwned]);
INI_String("Owner",HouseInfo[houseid][hOwnerName],MAX_PLAYER_NAME);
INI_Int("Locked",HouseInfo[houseid][hLocked]);
INI_Float("EnterX",HouseInfo[houseid][hEnterX]);
INI_Float("EnterY",HouseInfo[houseid][hEnterY]);
INI_Float("EnterZ",HouseInfo[houseid][hEnterZ]);
INI_Float("ExitX",HouseInfo[houseid][hExitX]);
INI_Float("ExitY",HouseInfo[houseid][hExitY]);
INI_Float("ExitZ",HouseInfo[houseid][hExitZ]);
INI_Float("Garage EnterX",HouseInfo[houseid][hEnterX]);
INI_Float("Garage EnterY",HouseInfo[houseid][hEnterY]);
INI_Float("Garage EnterZ",HouseInfo[houseid][hEnterZ]);
INI_Float("Garage ExitX",HouseInfo[houseid][hGExitX]);
INI_Float("Garage ExitY",HouseInfo[houseid][hGExitY]);
INI_Float("Garage ExitZ",HouseInfo[houseid][hGExitZ]);
INI_Int("Garage Occupied",HouseInfo[houseid][hGIsOccupied]);
INI_Int("Garage Locked",HouseInfo[houseid][hGIsLocked]);
INI_Int("Has a Garage",HouseInfo[houseid][hhasAGarage]);
INI_String("Address",HouseInfo[houseid][hAddress],32);
INI_String("Description",HouseInfo[houseid][hDescription],32);
INI_Int("Interior",HouseInfo[houseid][hInterior]);
INI_Int("VirtualWorld",HouseInfo[houseid][hVirtualWorld]);
INI_Int("Price",HouseInfo[houseid][hPrice]);
INI_Int("IsRentable",HouseInfo[houseid][hIsRentable]);
INI_Int("RentPrice",HouseInfo[houseid][hRentPrice]);
INI_String("Renter",HouseInfo[houseid][hRenter],MAX_PLAYER_NAME);
INI_Int("IsRented",HouseInfo[houseid][hIsRented]);
INI_Int("Money",HouseInfo[houseid][hMoney]);
INI_Int("Gun1",HouseInfo[houseid][hGun1]);
INI_Int("Ammo1",HouseInfo[houseid][hAmmo1]);
INI_Int("Gun2",HouseInfo[houseid][hGun2]);
INI_Int("Ammo2",HouseInfo[houseid][hAmmo2]);
INI_Int("Taxes",HouseInfo[houseid][hTaxes]);
return 1;
}