08.12.2012, 20:52
could someone show me how to do this right please
pawn Code:
public SaveHouse()
{
for(new idx=1; idx<MAX_HOUSES; idx++)
{
new string[256];
format(string, sizeof(string), "/SARP/Houses/House:%d.ini", idx);
new INI:File = INI_Open(string);
INI_SetTag(File,"data");
INI_WriteString(File, "House Owner", House[idx][Houseowner]);
INI_WriteInt(File, "House Owned", House[idx][Houseowned]);
INI_WriteInt(File, "House Cash Price", House[idx][HouseCPrice]);
INI_WriteString(File, "House Location", House[idx][HouseLocation]);
INI_WriteFloat(File, "House Entry X", House[idx][HouseEnX]);
INI_WriteFloat(File, "House Entry Y", House[idx][HouseEnY]);
INI_WriteFloat(File, "House Entry Z", House[idx][HouseEnZ]);
INI_WriteInt(File, "House Interior", House[idx][HouseEnInterior]);
INI_WriteInt(File, "House Virtual World", House[idx][HouseEnVirtualWorld]);
}
print("Saved Houses.");
return 1;
}
public LoadHouse_data(name[],value[])
{
new idx = 1;
while(idx < MAX_HOUSES)
{
INI_String("House Owner", House[idx][Houseowner],32);
INI_Int("House Owned", House[idx][Houseowned]);
INI_Int("House Cash Price", House[idx][HouseCPrice]);
INI_String("House Location", House[idx][HouseLocation],64);
INI_Float("House Entry X", House[idx][HouseEnX]);
INI_Float("House Entry Y", House[idx][HouseEnY]);
INI_Float("House Entry Z", House[idx][HouseEnZ]);
INI_Int("House Interior", House[idx][HouseEnInterior]);
INI_Int("House Virtual World", House[idx][HouseEnVirtualWorld]);
if(House[idx][HLevel])
{
House[idx][HouseEnPickup] = CreateDynamicPickup(1273, 1, House[idx][HouseEnX], House[idx][HouseEnY], House[idx][HouseEnZ], 0);
}
idx++;
}
return 1;
}