pawn Код:
forward LoadHouses();
public LoadHouses()
{
for(new i =0; i <= MAX_HOUSES; i++)
{
new pt[128];
format(pt, sizeof(pt),"Casas/%d.ini", i);
if(DOF2_FileExists(pt))
{
nCasas++;
HouseInfo[i][Owner] = DOF2_GetString(pt, "Owner");
HouseInfo[i][EnterX] = DOF2_GetFloat(pt, "EnterX");
HouseInfo[i][EnterY] = DOF2_GetFloat(pt, "EnterY");
HouseInfo[i][EnterZ] = DOF2_GetFloat(pt, "EnterZ");
HouseInfo[i][Int] = DOF2_GetInt(pt, "Int");
HouseInfo[i][Buy] = DOF2_GetBool(pt, "Buy");
HouseInfo[i][Price] = DOF2_GetInt(pt, "Price");
HouseInfo[i][Nivel] = DOF2_GetInt(pt, "Nivel");
HouseInfo[i][Lock] = DOF2_GetBool(pt, "Lock");
HouseInfo[i][ExitX] = IntHouses[1][HouseInfo[i][Int]];
HouseInfo[i][ExitY] = IntHouses[2][HouseInfo[i][Int]];
HouseInfo[i][ExitZ] = IntHouses[3][HouseInfo[i][Int]];
HouseInfo[i][nInt] = HousesWorld[HouseInfo[i][Int]];
if(HouseInfo[i][Buy] == true)
{
HouseInfo[i][Pickup] = CreatePickup(CASA_BUY, 1, HouseInfo[i][EnterX], HouseInfo[i][EnterY], HouseInfo[i][EnterZ], 0);
format(String, sizeof(String), TEXT_BUY, i, HouseInfo[i][Owner], HouseInfo[i][Nivel], HouseInfo[i][Lock] == true ? ("{FF0000}Trancada"): ("{00FF00}Aberta"));
HouseInfo[i][CText] = Create3DTextLabel(String, -1, HouseInfo[i][EnterX], HouseInfo[i][EnterY], HouseInfo[i][EnterZ], 50.0, 0, 0);
}
else
{
HouseInfo[i][Pickup] = CreatePickup(CASA_SALE, 1, HouseInfo[i][EnterX], HouseInfo[i][EnterY], HouseInfo[i][EnterZ], -1);
format(String, sizeof(String), TEXT_SALE, i, HouseInfo[i][Price], HouseInfo[i][Nivel]);
HouseInfo[i][CText] = Create3DTextLabel(String, -1, HouseInfo[i][EnterX], HouseInfo[i][EnterY], HouseInfo[i][EnterZ], 50.0, 0, 0);
}
}
}
printf("Existem %i casas criadas!", nCasas);
}