INI_Open Errors
#1

pawn Код:
stock SaveHouse(houseid)
{
    new INI:File2 = INI_Open("/Houses/%d.ini"(houseid)); //line 1970
    INI_SetTag(File2, "Main");
    INI_Float("EnterX", HouseInfo[houseid][hEnterX]);
    INI_Float("EnterY", HouseInfo[houseid][hEnterY]);
    INI_Float("EnterZ", HouseInfo[houseid][hEnterY]);
    INI_Float("ExitX", HouseInfo[houseid][hExitX]);
    INI_Float("ExitY", HouseInfo[houseid][hExitY]);
    INI_Float("ExitZ", HouseInfo[houseid][hExitY]);
    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_Int("Price", HouseInfo[houseid][hPrice]);
    INI_Int("HV_Model", HouseInfo[houseid][hVecModel]);
    INI_Float("HV_PosX", HouseInfo[houseid][hVecX]);
    INI_Float("HV_PosY", HouseInfo[houseid][hVecY]);
    INI_Float("HV_PosZ", HouseInfo[houseid][hVecZ]);
    INI_Float("HV_PosA", HouseInfo[houseid][hVecA]);
    INI_Bool("Owned", HouseInfo[houseid][hOwned]);
    INI_String("Owner",HouseInfo[houseid][hOwner],40);
    INI_Close(File2);
    return 1;
}
Код:
Current directory: C:\Users\Dorian\Desktop\sa-mp\gamemodes
bhaulers.pwn(1970) : error 001: expected token: "-string end-", but found "-identifier-"
bhaulers.pwn(1970) : warning 215: expression has no effect
bhaulers.pwn(1970) : error 001: expected token: ";", but found ")"
bhaulers.pwn(1970) : error 029: invalid expression, assumed zero
bhaulers.pwn(1970) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
================ READY ================
Reply
#2

You have to create a string and format the house ID into the string like with SendClientMessage.

Код:
new file[64];
format(file, sizeof(file), "/Houses/%d.ini", houseid);
new INI:File2 = INI_Open(file);
Reply
#3

Now I'm getting a bunch of weird errors:
pawn Код:
stock SaveHouse(houseid)
{
    new file[64];
    format(file, sizeof(file), "/Houses/%d.ini", houseid);
    new INI:File2 = INI_Open(file);
    INI_SetTag(File2, "Main");
    INI_Float("EnterX", HouseInfo[houseid][hEnterX]); //line 1981
    INI_Float("EnterY", HouseInfo[houseid][hEnterY]);
    INI_Float("EnterZ", HouseInfo[houseid][hEnterY]);
    INI_Float("ExitX", HouseInfo[houseid][hExitX]);
    INI_Float("ExitY", HouseInfo[houseid][hExitY]);
    INI_Float("ExitZ", HouseInfo[houseid][hExitY]);
    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_Int("Price", HouseInfo[houseid][hPrice]);
    INI_Int("HV_Model", HouseInfo[houseid][hVecModel]);
    INI_Float("HV_PosX", HouseInfo[houseid][hVecX]);
    INI_Float("HV_PosY", HouseInfo[houseid][hVecY]);
    INI_Float("HV_PosZ", HouseInfo[houseid][hVecZ]);
    INI_Float("HV_PosA", HouseInfo[houseid][hVecA]);
    INI_Bool("Owned", HouseInfo[houseid][hOwned]);
    INI_String("Owner",HouseInfo[houseid][hOwner],40);
    INI_Close(File2);
}
pawn Код:
bhaulers.pwn(1981) : error 017: undefined symbol "name"
bhaulers.pwn(1981) : error 017: undefined symbol "value"
bhaulers.pwn(1982) : error 017: undefined symbol "name"
bhaulers.pwn(1982) : error 017: undefined symbol "value"
bhaulers.pwn(1983) : error 017: undefined symbol "name"
bhaulers.pwn(1983) : error 017: undefined symbol "value"
bhaulers.pwn(1984) : error 017: undefined symbol "name"
bhaulers.pwn(1984) : error 017: undefined symbol "value"
bhaulers.pwn(1985) : error 017: undefined symbol "name"
bhaulers.pwn(1985) : error 017: undefined symbol "value"
bhaulers.pwn(1986) : error 017: undefined symbol "name"
bhaulers.pwn(1986) : error 017: undefined symbol "value"
bhaulers.pwn(1987) : error 017: undefined symbol "name"
bhaulers.pwn(1987) : error 017: undefined symbol "value"
bhaulers.pwn(1988) : error 017: undefined symbol "name"
bhaulers.pwn(1988) : error 017: undefined symbol "value"
bhaulers.pwn(1989) : error 017: undefined symbol "name"
bhaulers.pwn(1989) : error 017: undefined symbol "value"
bhaulers.pwn(1990) : error 017: undefined symbol "name"
bhaulers.pwn(1990) : error 017: undefined symbol "value"
bhaulers.pwn(1991) : error 017: undefined symbol "name"
bhaulers.pwn(1991) : error 017: undefined symbol "value"
bhaulers.pwn(1992) : error 017: undefined symbol "name"
bhaulers.pwn(1992) : error 017: undefined symbol "value"
bhaulers.pwn(1993) : error 017: undefined symbol "name"
bhaulers.pwn(1993) : error 017: undefined symbol "value"

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


26 Errors.
Reply
#4

pawn Код:
stock SaveHouse(houseid)
{
    new file[64];
    format(file, sizeof(file), "/Houses/%d.ini", houseid);
    new INI:File2 = INI_Open(file);
    INI_SetTag(File2, "Main");
    INI_WriteFloat(File2, "EnterX", HouseInfo[houseid][hEnterX]); //line 1981
    INI_WriteFloat(File2, "EnterY", HouseInfo[houseid][hEnterY]);
    INI_WriteFloat(File2, "EnterZ", HouseInfo[houseid][hEnterY]);
    INI_WriteFloat(File2, "ExitX", HouseInfo[houseid][hExitX]);
    INI_WriteFloat(File2, "ExitY", HouseInfo[houseid][hExitY]);
    INI_WriteFloat(File2, "ExitZ", HouseInfo[houseid][hExitY]);
    INI_WriteInt(File2, "InsideInt", HouseInfo[houseid][hInsideInt]);
    INI_WriteInt(File2, "InsideVir", HouseInfo[houseid][hInsideVir]);
    INI_WriteInt(File2, "OutsideInt", HouseInfo[houseid][hOutsideInt]);
    INI_WriteInt(File2, "OutsideVir", HouseInfo[houseid][hOutsideVir]);
    INI_WriteInt(File2, "Price", HouseInfo[houseid][hPrice]);
    INI_WriteInt(File2, "HV_Model", HouseInfo[houseid][hVecModel]);
    INI_WriteFloat(File2, "HV_PosX", HouseInfo[houseid][hVecX]);
    INI_WriteFloat(File2, "HV_PosY", HouseInfo[houseid][hVecY]);
    INI_WriteFloat(File2, "HV_PosZ", HouseInfo[houseid][hVecZ]);
    INI_WriteFloat(File2, "HV_PosA", HouseInfo[houseid][hVecA]);
    INI_WriteBool(File2, "Owned", HouseInfo[houseid][hOwned]);
    INI_WriteString(File2, "Owner",HouseInfo[houseid][hOwner],40);
    INI_Close(File2);
    return 1;
}
because you are using the wrong format

refer to here to learn how to properly use it...... yes it is irrelevant from what you are doing but it shows u exactly how to do it

https://sampforum.blast.hk/showthread.php?tid=352703
Reply
#5

Dude you should use an stock

Код:
stock Path(houseid)
{
    new string[64];
    format(string,sizeof(string),"/Houses/%d.ini", houseid);
    return string;
}

then 

new INI:File = INI_Open(Path(houseid));
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)