PDA

View Full Version : Problems whit DINI


godoy32
08/12/2011, 04:11 PM
Hi, well I never knew how you use DINI... Generally the think what I do in 'dini' don't works perfectly

In this case, I've a folder called 'Recompensas'
And in the folder should save a file (*.in) with the name of the player. Ex: godoy32.ini
Here's the code


enum pInfo
{
ConHIT,
COMPLETADOS,
PUESTOS,
};
new aInfo[MAX_PLAYERS][pInfo];
#define SAVERECOMPENSAS "Recompensas/%s.ini"


---
OnPlayerConnect

new file[100],Name[MAX_PLAYER_NAME]; GetPlayerName(playerid,Name,sizeof(Name)); format(file,sizeof(file),SAVERECOMPENSAS,Name);
if(!dini_Exists(file)) {
dini_Create(file);
dini_IntSet(file,"ConHIT",aInfo[playerid][ConHIT]);
dini_IntSet(file,"COMPLETADOS",aInfo[playerid][COMPLETADOS]);
dini_IntSet(file,"PUESTOS",aInfo[playerid][PUESTOS]);
}
else if(dini_Exists(file))
{
aInfo[playerid][ConHIT] = dini_Int(file,"ConHIT");
aInfo[playerid][COMPLETADOS] = dini_Int(file,"COMPLETADOS");
aInfo[playerid][PUESTOS] = dini_Int(file,"PUESTOS");
}


----
OnPlayerDisconnect

GetPlayerName(playerid, pname, sizeof(pname)); //Guardamos el nombre del player en la variable pname
format(archivo, sizeof(archivo), SAVERECOMPENSAS, udb_encode(pname)); // Damos formato a "archivo"
new file[100],Name[MAX_PLAYER_NAME]; GetPlayerName(playerid,Name,sizeof(Name)); format(file,sizeof(file),SAVERECOMPENSAS,Name);
dini_IntSet(file,"ConHIT",aInfo[playerid][ConHIT]);
dini_IntSet(file,"COMPLETADOS",aInfo[playerid][COMPLETADOS]);
dini_IntSet(file,"PUESTOS",aInfo[playerid][PUESTOS]);


How I said, the problem is not created any file (*.ini)
Yes. I have created the folder.

Sorry for my english- I'm learning

AstonDA-G
08/12/2011, 04:38 PM
Change all your format(file...) lines to this

format(file,sizeof(file),"SAVERECOMPENSAS.%s.ini",Name);

I think that should fix it, hope I helped:)

godoy32
08/12/2011, 04:45 PM
Change all your format(file...) lines to this

format(file,sizeof(file),"SAVERECOMPENSAS.%s.ini",Name);

I think that should fix it, hope I helped:)
Don't works :S

AstonDA-G
08/12/2011, 05:06 PM
Crap, typo. Shoulda uysed a / not a .
format(file,sizeof(file),"SAVERECOMPENSAS/%s.ini",Name);
Or don't bother defining, and use Recompensas/%s,ini if the above doesnt work

godoy32
08/12/2011, 05:23 PM
Crap, typo. Shoulda uysed a / not a .
format(file,sizeof(file),"SAVERECOMPENSAS/%s.ini",Name);
Or don't bother defining, and use Recompensas/%s,ini if the above doesnt work

Don't works :S

AstonDA-G
08/12/2011, 05:28 PM
Last try, forget about the #define.

format(file,sizeof(file),"Recompensas/%s.ini",Name);

godoy32
08/12/2011, 05:36 PM
Last try, forget about the #define.

format(file,sizeof(file),"Recompensas/%s.ini",Name);

Don't works :cry: