Help With INI
#1

pawn Код:
stock SaveHouse(houseid)
{
    new INI:ini = INI_Open(HPath(houseid));
    INI_Float("EnterX",HouseInfo[houseid][hEnterX]);
    INI_WriteFloat("EnterY",HouseInfo[houseid][hEnterY]);
    INI_WriteFloat("EnterZ",HouseInfo[houseid][hEnterZ]);
    INI_WriteFloat("ExitX",HouseInfo[houseid][hExitX]);
    INI_WriteFloat("ExitY",HouseInfo[houseid][hExitY]);
    INI_WriteFloat("ExitZ",HouseInfo[houseid][hExitZ]);
    INI_WriteFloat("InX",HouseInfo[houseid][hInX]);
    INI_WriteFloat("InY",HouseInfo[houseid][hInY]);
    INI_WriteFloat("InZ",HouseInfo[houseid][hInZ]);
    INI_WriteFloat("OutX",HouseInfo[houseid][hOutX]);
    INI_WriteFloat("OutY",HouseInfo[houseid][hOutY]);
    INI_WriteFloat("OutZ",HouseInfo[houseid][hOutZ]);
    INI_WriteInt("InsideInt",HouseInfo[houseid][hInsideInt]);
    INI_WriteInt("InsideVir",HouseInfo[houseid][hInsideVir]);
    INI_WriteInt("OutsideInt",HouseInfo[houseid][hOutsideInt]);
    INI_WriteInt("OutsideVir",HouseInfo[houseid][hOUtsideVir]);
    INI_WriteBool("Owned",HouseInfo[houseid][hOwned]);
    INI_WriteString("Owner",HouseInfo[houseid][hOwner],MAX_PLAYER_NAME);
    INI_Int("InCheckpoint",HouseInfo[houseid][hInCheckpoint]);
    INI_Int("OutCheckpoint",HouseInfo[houseid][hOutCheckpoint]);
    INI_Float("InAngle",HouseInfo[houseid][hInAngle]);
    INI_Float("OutAngle",HouseInfo[houseid][hOutAngle]);
    INI_WriteInt("hPrice",HouseInfo[houseid][Price]);
    return 1;
}
pawn Код:
#define HPath "Houses/%d.ini"
errors
pawn Код:
(1762) : error 001: expected token: "-string end-", but found "-identifier-"
(1762) : warning 215: expression has no effect
(1762) : error 001: expected token: ";", but found ")"
(1762) : error 029: invalid expression, assumed zero
(1762) : fatal error 107: too many error messages on one line
Reply
#2

Which line is 1762
Reply
#3

new INI:ini = INI_Open(HPath(houseid));
Reply
#4

Can you show what HPath(houseid) is? is it a define or function?
Reply
#5

#define HPath "Houses/%d.ini" i posted it above
Reply
#6

#define HPath "Houses/%d.ini"

so how system(HPath) know what's houseid ??
Reply
#7

Try:
pawn Код:
new string[12];
format(string, 12,  "Houses/%d.ini", houseid);
new INI:ini = INI_Open(string);
Reply
#8

Here mate, remembered I had the same method in one of my scripts, it works fine:

pawn Код:
stock SaveHouses()
{
    new string[126];
    for(new i = 1; i < sizeof(HouseData); i++)
    {
        format(string, sizeof(string), housepath, i);
        new INI:File = INI_Open(string);
        INI_SetTag(File, "Property Information");
        INI_WriteInt(File, "Created", HouseData[i][Created]);
        INI_Close(File);
    }
    print("SaveHouses finished");
    return 1;
}
pawn Код:
#define housepath "/houses/%i.ini"
Reply
#9

now error 035: argument type mismatch (argument 1) this error for all lines

Quote:
Originally Posted by rickisme
Посмотреть сообщение
#define HPath "Houses/%d.ini"

so how system(HPath) know what's houseid ??
i have defined max_houses and while creating the house i will enter the id for house to create well it worked fine before i added
SaveHouse(Houseid)
oh it should be SaveHouse(Houseid);




sorry i founded the bugs

thanks for the help
Reply
#10

@Jack_Leslie, AroseKhanNaizi: please look at the code

Quote:

new INI:ini = INI_Open(HPath(houseid));

not
Quote:
format(string, sizeof(string), HPath, i);
it's different =.=
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)