20.10.2013, 08:38
Something like this is needed.
pawn Code:
forward CreateHouse(playerid, costs, sells, interior , virtualworld);
public CreateHouse(playerid, costs, sells, interior , virtualworld)
{
for(new h = 0; h < MAX_HOUSE; h++)
{
if(!fexist(HousePath(h)))
{
//new str[256];
//format(str, sizeof(str), "%d", h);
new Float:X, Float:Y, Float:Z;
new Float:X1, Float:Y1, Float:Z1;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerPos(playerid, X1, Y1, Z1);
GetPlayerVirtualWorld(virtualworld);
new INI:HouseFile = INI_Open(HousePath(h)); //make sure HousePath points to something like this: "/houses/%i.ini".
HouseCount++;
hInfo[playerid][hEnterX] = X;
hInfo[playerid][hEnterY] = Y;
hInfo[playerid][hEnterZ] = Z;
hInfo[playerid][hExitX] = X1;
hInfo[playerid][hExitY] = Y1;
hInfo[playerid][hExitZ] = Z1;
hInfo[playerid][hInterior] = interior;
hInfo[playerid][hCost] = costs;
hInfo[playerid][hSell] = sells;
hInfo[playerid][hVW] = virtualworld;
INI_WriteFloat(HouseFile, "EnterenceX", hInfo[playerid][hEnterX]);
INI_WriteFloat(HouseFile, "EnterenceY", hInfo[playerid][hEnterY]);
INI_WriteFloat(HouseFile, "EnterenceZ", hInfo[playerid][hEnterZ]);
INI_WriteFloat(HouseFile, "ExitX", hInfo[playerid][hExitX]);
INI_WriteFloat(HouseFile, "ExitY", hInfo[playerid][hExitY]);
INI_WriteFloat(HouseFile, "ExitZ", hInfo[playerid][hExitZ]);
INI_WriteInt(HouseFile, "Interior", hInfo[playerid][hInterior]);
INI_WriteInt(HouseFile, "VW", hInfo[playerid][hVW]);
INI_WriteInt(HouseFile, "Cost", hInfo[playerid][hCost]);
INI_WriteInt(HouseFile, "Sell", hInfo[playerid][hSell]);
INI_WriteString(HouseFile, "Phone", hInfo[playerid][hPhone]);
INI_WriteInt(HouseFile, "Garderobe", hInfo[playerid][hGarderobe]);
INI_WriteInt(HouseFile, "Garderobe1", hInfo[playerid][hGarderobe1]);
INI_WriteInt(HouseFile, "Storage", hInfo[playerid][hStorage]);
INI_WriteInt(HouseFile, "Storage1", hInfo[playerid][hStorage1]);
INI_WriteInt(HouseFile, "Storage2", hInfo[playerid][hStorage2]);
INI_WriteInt(HouseFile, "Storage3", hInfo[playerid][hStorage3]);
INI_WriteInt(HouseFile, "Storage4", hInfo[playerid][hStorage4]);
INI_WriteInt(HouseFile, "Storage5", hInfo[playerid][hStorage5]);
INI_WriteInt(HouseFile, "Storage6", hInfo[playerid][hStorage6]);
INI_WriteInt(HouseFile, "Storage7", hInfo[playerid][hStorage7]);
INI_WriteInt(HouseFile, "Storage8", hInfo[playerid][hStorage8]);
INI_WriteInt(HouseFile, "Storage9", hInfo[playerid][hStorage9]);
INI_WriteInt(HouseFile, "Storage10", hInfo[playerid][hStorage10]);
INI_WriteInt(HouseFile, "Money", hInfo[playerid][hMoney]);
INI_WriteInt(HouseFile, "Drugs", hInfo[playerid][hDrugs]);
INI_WriteInt(HouseFile, "Drugs1", hInfo[playerid][hDrugs1]);
INI_WriteInt(HouseFile, "Drugs2", hInfo[playerid][hDrugs2]);
INI_WriteInt(HouseFile, "Drugs3", hInfo[playerid][hDrugs3]);
INI_WriteInt(HouseFile, "Drugs4", hInfo[playerid][hDrugs4]);
INI_WriteInt(HouseFile, "Drugs5", hInfo[playerid][hDrugs5]);
INI_WriteInt(HouseFile, "Drugs6", hInfo[playerid][hDrugs6]);
INI_WriteInt(HouseFile, "Drugs7", hInfo[playerid][hDrugs7]);
INI_WriteInt(HouseFile, "Drugs8", hInfo[playerid][hDrugs8]);
INI_WriteInt(HouseFile, "Drugs9", hInfo[playerid][hDrugs9]);
INI_WriteInt(HouseFile, "Drugs10", hInfo[playerid][hDrugs10]);
INI_WriteInt(HouseFile, "Drugs11", hInfo[playerid][hDrugs11]);
INI_WriteInt(HouseFile, "Products", hInfo[playerid][hProducts]);
INI_WriteInt(HouseFile, "Products1", hInfo[playerid][hProducts1]);
INI_WriteInt(HouseFile, "Products2", hInfo[playerid][hProducts2]);
INI_WriteInt(HouseFile, "Products3", hInfo[playerid][hProducts3]);
INI_WriteInt(HouseFile, "Products4", hInfo[playerid][hProducts4]);
INI_WriteInt(HouseFile, "Products5", hInfo[playerid][hProducts5]);
INI_WriteInt(HouseFile, "Products6", hInfo[playerid][hProducts6]);
INI_WriteInt(HouseFile, "Products7", hInfo[playerid][hProducts7]);
INI_WriteInt(HouseFile, "Products8", hInfo[playerid][hProducts8]);
INI_WriteInt(HouseFile, "Products9", hInfo[playerid][hProducts9]);
INI_WriteInt(HouseFile, "Products10", hInfo[playerid][hProducts10]);
INI_WriteInt(HouseFile, "Products11", hInfo[playerid][hProducts11]);
}
}
return 1;
}