[HELP]Y_ini problem - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [HELP]Y_ini problem (
/showthread.php?tid=527637)
[HELP]Y_ini problem -
chusothe41 - 23.07.2014
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
Re: [HELP]Y_ini problem -
AMouldyLemon - 23.07.2014
Sorry, I'm not good in Y_INI but, don't you need to read the file before retrieving it to read in game?
Respuesta: Re: [HELP]Y_ini problem -
chusothe41 - 23.07.2014
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;
}
Re: [HELP]Y_ini problem -
LivingLikeYouDo - 23.07.2014
Where are you declaring UserPath?
Respuesta: Re: [HELP]Y_ini problem -
chusothe41 - 23.07.2014
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!!!
Respuesta: [HELP]Y_ini problem -
chusothe41 - 23.07.2014
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