Problems whit DINI
#1

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

pawn Код:
enum pInfo
{
    ConHIT,
    COMPLETADOS,
    PUESTOS,
};
new aInfo[MAX_PLAYERS][pInfo];
#define SAVERECOMPENSAS "Recompensas/%s.ini"
---
OnPlayerConnect
pawn Код:
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
pawn Код:
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
Reply
#2

Change all your format(file...) lines to this

pawn Код:
format(file,sizeof(file),"SAVERECOMPENSAS.%s.ini",Name);
I think that should fix it, hope I helped
Reply
#3

Quote:
Originally Posted by AstonDA-G
Посмотреть сообщение
Change all your format(file...) lines to this

pawn Код:
format(file,sizeof(file),"SAVERECOMPENSAS.%s.ini",Name);
I think that should fix it, hope I helped
Don't works :S
Reply
#4

Crap, typo. Shoulda uysed a / not a .
pawn Код:
format(file,sizeof(file),"SAVERECOMPENSAS/%s.ini",Name);
Or don't bother defining, and use Recompensas/%s,ini if the above doesnt work
Reply
#5

Quote:
Originally Posted by AstonDA-G
Посмотреть сообщение
Crap, typo. Shoulda uysed a / not a .
pawn Код:
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
Reply
#6

Last try, forget about the #define.

pawn Код:
format(file,sizeof(file),"Recompensas/%s.ini",Name);
Reply
#7

Quote:
Originally Posted by AstonDA-G
Посмотреть сообщение
Last try, forget about the #define.

pawn Код:
format(file,sizeof(file),"Recompensas/%s.ini",Name);
Don't works
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)