[HELP] Dini Exists
#1

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!!!
Reply
#2

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);
}
Reply
#3

Works Fine. Thanks =)
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)