File saving help
#1

Hello, i have this command i made for my house system. It basicly makes a pickup and saves its location etc to a file. But i have a problem, when making a house then making another house (2 houses) the file get overwritten I dont want that i want for every house it has its own file.

pawn Код:
CMD:chouse(playerid, params[])
{
    if(PlayerInfo[playerid][Padmin] >=4)
    {
        new id = HouseCount, interior;
        if(sscanf(params,"i",interior)) return SendClientMessage(playerid, COLOR_GREEN, "USAGE: /chouse <interior>");
        new Float:X, Float:Y, Float:Z;
        GetPlayerPos(playerid, X, Y, Z);
        HouseInfo[id][Interior] = interior;
        HouseInfo[id][Owned] = 0;
        HouseInfo[id][XPos] = X;
        HouseInfo[id][YPos] = Y;
        HouseInfo[id][ZPos] = Z;
        SCM(playerid, COLOR_GREEN, "You have created a house!");
        HouseEnterPickup[id]  = CreatePickup(1273,23,X,Y,Z,-1);
        new path[200];
        format(path, sizeof(path), "/Sfcnr/Users/Houses/%s.ini", id);
        dini_Create(path);
        dini_IntSet(path,"interior", interior);
        dini_IntSet(path, "Owned", 0);
        dini_FloatSet(path, "XPos", X);
        dini_FloatSet(path, "YPos", Y);
        dini_FloatSet(path, "ZPos", Z);
        dini_Set(path,"Owner",HouseInfo[id][Owner]);
        HouseCount++;
        return 1;
    }
    else if(PlayerInfo[playerid][Padmin] < 4)
    {
        SendClientMessage(playerid, COLOR_RED, "You are not admin.");
        return 1;
    }
    return 1;
}
Reply
#2

anyone
Reply
#3

remove it
pawn Код:
id = HouseCount,
and change id to HouseCount. Test and write the result here
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)