[HELP] Dini Exists - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP] Dini Exists (
/showthread.php?tid=157997)
[HELP] Dini Exists -
sTreTcheD - 08.07.2010
See, I have a code:
Код:
format(file,sizeof(file),"CarSys/Users/%s.txt",PlayerName);
if(!dini_Exists(file))
{
dini_Create(file);
dini_IntSet(file,"CarID",0);
dini_IntSet(file,"OwnCar",0);
}
else if(dini_Exists(file))
{
PlayerInfo[playerid][CarID] = dini_Int(file,"CarID");
PlayerInfo[playerid][OwnCar] = dini_Int(file,"OwnCar");
}
The problem is that he sais that ALWAYS the file isnt exsits, and recreate it again, BUT THE FILE IS EXSISTS!!!
Re: [HELP] Dini Exists -
Miikkel - 08.07.2010
I don't understand why you use "else if" ? Why not just a simple "else" ?
Anyway try this:
pawn Код:
new
PlayerName[MAX_PLAYER_NAME],
File[256]
;
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
format(File, sizeof(File), "CarSys/Users/%s.ini", PlayerName);
if(dini_Exists(File))
{
PlayerInfo[playerid][CarID] = dini_Int(File,"CarID");
PlayerInfo[playerid][OwnCar] = dini_Int(File,"OwnCar");
}
else
{
dini_Create(File);
dini_IntSet(File,"CarID",0);
dini_IntSet(File,"OwnCar",0);
}
Re: [HELP] Dini Exists -
sTreTcheD - 08.07.2010
Works Fine. Thanks =)