[HELP]Y_ini problem
#1

The problem is simple

pawn Код:
enum pInfo
{
    pHouseid
}

new PlayerInfo[MAX_PLAYERS][pInfo];
pawn Код:
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
    INI_Int("Houseid,",PlayerInfo[playerid][pHouseid]);
}
pawn Код:
public OnPlayerRequestClass(playerid,classid)
{
    if(fexist(UserPath(playerid)))
    {
        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
 
    }
    return 1;
}
pawn Код:
YCMD:save(playerid, params[], help)
{
    #pragma unused params
    #pragma unused help
    new INI:File = INI_Open(UserPath(playerid));
        INI_WriteInt(File, "Houseid", 1);
        INI_Close(File);
}
pawn Код:
YCMD:myhouse(playerid, params[], help)
{
    #pragma unused params
    #pragma unused help
    new string [128];
    format(string, sizeof(string), "%i", PlayerInfo[playerid][pHouseid]);
    return SendClientMessage(playerid, -1, string);
}
when I write /save the ini file write houseid = 1 but when i want to read the integer with the command myhouse it sends me 0 all time... whats wrong?

Im confused at all

Thanks
Reply
#2

Sorry, I'm not good in Y_INI but, don't you need to read the file before retrieving it to read in game?
Reply
#3

Quote:
Originally Posted by AMouldyLemon
Посмотреть сообщение
Sorry, I'm not good in Y_INI but, don't you need to read the file before retrieving it to read in game?
Yeah whit ini parse file

pawn Код:
public OnPlayerRequestClass(playerid,classid)
{
    if(fexist(UserPath(playerid)))
    {
        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
    }
    return 1;
}
Reply
#4

Where are you declaring UserPath?
Reply
#5

Quote:
Originally Posted by LivingLikeYouDo
Посмотреть сообщение
Where are you declaring UserPath?
Whit a stock

pawn Код:
stock UserPath(playerid)
{
    new string[128],playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid,playername,sizeof(playername));
    format(string,sizeof(string),PATH,playername);
    return string;
}
and a define on top

pawn Код:
#define PATH "/Users/%s.ini"
But anyway im reading and writing lots of files and i do it well but in this case it doesent func wtf!!!
Reply
#6

lol!!!! it could be this shitty error XD
pawn Код:
INI_Int("Houseid,",PlayerInfo[playerid][pHouseid]);
look at Houseid it has a coma, omg i will try without the coma
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)