saving system
#1

Houses dont save
pawn Код:
public SaveHouses()
{
    new idx;
    new File: file2;
    while (idx < sizeof(HouseInfo))
    {
        new coordsstring[512];
        format(coordsstring, sizeof(coordsstring), "%d|%d|%s|%d|%d|%d|%d|%d|%d|%d|%d|%f|%f|%f|%f|%f|%f|%f|%f|%d|%d|%d|%d\r\n",
        HouseInfo[idx][hOwned],
        HouseInfo[idx][hPrice],
        HouseInfo[idx][hOwner],
        HouseInfo[idx][hLevel],
        HouseInfo[idx][hLocked],
        HouseInfo[idx][hRentable],
        HouseInfo[idx][hRentPrice],
        HouseInfo[idx][hGun1],
        HouseInfo[idx][hGun2],
        HouseInfo[idx][hGun3],
        HouseInfo[idx][hMoney],
        HouseInfo[idx][hEntranceX],
        HouseInfo[idx][hEntranceY],
        HouseInfo[idx][hEntranceZ],
        HouseInfo[idx][hEntranceA],
        HouseInfo[idx][hExitX],
        HouseInfo[idx][hExitY],
        HouseInfo[idx][hExitZ],
        HouseInfo[idx][hExitA],
        HouseInfo[idx][hInt],
        HouseInfo[idx][hWorld],
        HouseInfo[idx][hInsideInt],
        HouseInfo[idx][hInsideWorld]);
        if(idx == 0)
        {
            file2 = fopen("Houses.cfg", io_write);
        }
        else
        {
            file2 = fopen("Houses.cfg", io_append);
        }
        fwrite(file2, coordsstring);
        idx++;
        fclose(file2);
    }
    return 1;
}
This is saving system.

pawn Код:
YCMD:buyhouse(playerid, params[])
{
    if(gPlayerLoggedIn[playerid] == 0) return 1;

    new id = IsPlayerNearHouseEnt(playerid);
    new rentid = PlayerInfo[playerid][RentingID];

    if(id == -1 || id == 0) return SendClientMessage(playerid, COLOR_GREY, "You are not near a house.");

    if(HouseInfo[id][hOwned] != 0 || HouseInfo[id][hPrice] == 0) return SendClientMessage(playerid, COLOR_GREY, "This house is not for sale.");

    if(rentid != 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You are currently renting a house.");
    if(PlayerInfo[playerid][HouseID] != 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You already own a house.");

    if(PlayerInfo[playerid][Money] < HouseInfo[id][hPrice]) return SendClientMessage(playerid, COLOR_LIGHTRED, "Sorry, you can not afford this house.");

    PlayerInfo[playerid][HouseID] = id;
    PlayerInfo[playerid][Money] -= HouseInfo[id][hPrice];
    GivePlayerMoney(playerid, -HouseInfo[id][hPrice]);

    HouseInfo[id][hLocked] = 0;
    HouseInfo[id][hOwned] = 1;
    HouseInfo[id][hRentable] = 0;
    strmid(HouseInfo[id][hOwner], PlayerName(playerid), 0, strlen(PlayerName(playerid)), 255);

    SendClientMessage(playerid, COLOR_YELLOW, "Congratulations on your new home! Use /househelp to get help, or /ask!");
    return 1;
}
Housing dont save.
Reply


Messages In This Thread
saving system - by Dare Devil..... - 26.07.2012, 09:37
Re: saving system - by Devilxz97 - 26.07.2012, 09:47
Re: saving system - by Dare Devil..... - 26.07.2012, 10:07
Re: saving system - by Dare Devil..... - 26.07.2012, 12:06
Re: saving system - by Dare Devil..... - 26.07.2012, 20:13
Re: saving system - by Ranama - 26.07.2012, 20:20
Re: saving system - by Jeffry - 26.07.2012, 20:21
Re: saving system - by Dare Devil..... - 26.07.2012, 21:04
Re: saving system - by Dare Devil..... - 27.07.2012, 09:39

Forum Jump:


Users browsing this thread: 1 Guest(s)