File Not saving as ini
#1

pawn Код:
#define HPath "/Houses/%d.ini"
stock SaveHouse(houseid)
{
    new INI:ini = INI_Open(HousePath(houseid));
    INI_WriteFloat(ini,"EnterX",HouseInfo[houseid][hEnterX]);
    INI_WriteFloat(ini,"EnterY",HouseInfo[houseid][hEnterY]);
    INI_WriteFloat(ini,"EnterZ",HouseInfo[houseid][hEnterZ]);
    INI_WriteFloat(ini,"ExitX",HouseInfo[houseid][hExitX]);
    INI_WriteFloat(ini,"ExitY",HouseInfo[houseid][hExitY]);
    INI_WriteFloat(ini,"ExitZ",HouseInfo[houseid][hExitZ]);
    INI_WriteFloat(ini,"InX",HouseInfo[houseid][hInX]);
    INI_WriteFloat(ini,"InY",HouseInfo[houseid][hInY]);
    INI_WriteFloat(ini,"InZ",HouseInfo[houseid][hInZ]);
    INI_WriteFloat(ini,"OutX",HouseInfo[houseid][hOutX]);
    INI_WriteFloat(ini,"OutY",HouseInfo[houseid][hOutY]);
    INI_WriteFloat(ini,"OutZ",HouseInfo[houseid][hOutZ]);
    INI_WriteInt(ini,"InsideInt",HouseInfo[houseid][hInsideInt]);
    INI_WriteInt(ini,"InsideVir",HouseInfo[houseid][hInsideVir]);
    INI_WriteInt(ini,"OutsideInt",HouseInfo[houseid][hOutsideInt]);
    INI_WriteInt(ini,"OutsideVir",HouseInfo[houseid][hOutsideVir]);
    INI_WriteBool(ini,"Owned",HouseInfo[houseid][hOwned]);
    INI_WriteString(ini,"Owner",HouseInfo[houseid][hOwner]);
    INI_WriteInt(ini,"InCheckpoint",HouseInfo[houseid][hInCheckpoint]);
    INI_WriteInt(ini,"OutCheckpoint",HouseInfo[houseid][hOutCheckpoint]);
    INI_WriteFloat(ini,"InAngle",HouseInfo[houseid][hInAngle]);
    INI_WriteFloat(ini,"OutAngle",HouseInfo[houseid][hOutAngle]);
    INI_WriteInt(ini,"Price",HouseInfo[houseid][hPrice]);
    return 1;
}
stock HousePath(houseid)
{
    new str[10];

    format(str,sizeof(str),HPath,houseid);
    return str;
}
when i do this
result
Reply
#2

new str[10]; is too short.
It cuts off the rest of the thing
the thing you get when you format file path is:
"/Houses/0"
not "/Houses/0.ini"
increase str to 15 ( for good measure)
Reply
#3

every thing works fine just house not loading on game mode restart data get saves for
pawn Код:
(new i = 0; i < MAX_HOUSES; i++)
    {
        INI_ParseFile(HousePath(i),"loadhouse_%d", .bExtra = true, .extra = i);
    }
its under on gamemodeinit

and this is loading code
pawn Код:
{
    if(!fexist(HousePath(houseid))) return 0;
    INI_Float("EnterX",HouseInfo[houseid][hEnterX]);
    INI_Float("EnterY",HouseInfo[houseid][hEnterY]);
    INI_Float("EnterZ",HouseInfo[houseid][hEnterZ]);
    INI_Float("ExitX",HouseInfo[houseid][hExitX]);
    INI_Float("ExitY",HouseInfo[houseid][hExitY]);
    INI_Float("ExitZ",HouseInfo[houseid][hExitZ]);
    INI_Float("InX",HouseInfo[houseid][hInX]);
    INI_Float("InY",HouseInfo[houseid][hInY]);
    INI_Float("InZ",HouseInfo[houseid][hInZ]);
    INI_Float("OutX",HouseInfo[houseid][hOutX]);
    INI_Float("OutY",HouseInfo[houseid][hOutY]);
    INI_Float("OutZ",HouseInfo[houseid][hOutZ]);
    INI_Int("InsideInt",HouseInfo[houseid][hInsideInt]);
    INI_Int("InsideVir",HouseInfo[houseid][hInsideVir]);
    INI_Int("OutsideInt",HouseInfo[houseid][hOutsideInt]);
    INI_Int("OutsideVir",HouseInfo[houseid][hOutsideVir]);
    INI_Bool("Owned",HouseInfo[houseid][hOwned]);
    INI_String("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_Int("Price",HouseInfo[houseid][hPrice]);
    return 1;
}
Reply
#4

put printf("load code executedfor house id %i",houseid);
under loading code and see if it prints or not
Reply
#5

nothing printed
Reply
#6

show the public header of load house
Reply
#7

pawn Код:
public loadhouse_Data(houseid, name[], value[])
{
    if(!fexist(HousePath(houseid))) return 0;
    INI_Float("EnterX",HouseInfo[houseid][hEnterX]);
    INI_Float("EnterY",HouseInfo[houseid][hEnterY]);
    INI_Float("EnterZ",HouseInfo[houseid][hEnterZ]);
    INI_Float("ExitX",HouseInfo[houseid][hExitX]);
    INI_Float("ExitY",HouseInfo[houseid][hExitY]);
    INI_Float("ExitZ",HouseInfo[houseid][hExitZ]);
    INI_Float("InX",HouseInfo[houseid][hInX]);
    INI_Float("InY",HouseInfo[houseid][hInY]);
    INI_Float("InZ",HouseInfo[houseid][hInZ]);
    INI_Float("OutX",HouseInfo[houseid][hOutX]);
    INI_Float("OutY",HouseInfo[houseid][hOutY]);
    INI_Float("OutZ",HouseInfo[houseid][hOutZ]);
    INI_Int("InsideInt",HouseInfo[houseid][hInsideInt]);
    INI_Int("InsideVir",HouseInfo[houseid][hInsideVir]);
    INI_Int("OutsideInt",HouseInfo[houseid][hOutsideInt]);
    INI_Int("OutsideVir",HouseInfo[houseid][hOutsideVir]);
    INI_Bool("Owned",HouseInfo[houseid][hOwned]);
    INI_String("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_Int("Price",HouseInfo[houseid][hPrice]);
    printf("load code executedfor house id %i",houseid);
    return 1;
}
Reply
#8

add this line on save code at top after INI_Open Line
INI_SetTag(ini, "Data");
Reply
#9

i already added it long ago
Reply
#10

1. make sure the current save files have tags in them
2. make sure that public loadhouse_Data(houseid, name[], value[])
the bold text in above line and tag are same [ check for case diffrence too it should be Data not data in tag of file]
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)