SA-MP Forums Archive
Problems whit DINI - 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: Problems whit DINI (/showthread.php?tid=302355)



Problems whit DINI - godoy32 - 08.12.2011

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


Re: Problems whit DINI - AstonDA-G - 08.12.2011

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


Respuesta: Re: Problems whit DINI - godoy32 - 08.12.2011

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


Re: Problems whit DINI - AstonDA-G - 08.12.2011

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


Respuesta: Re: Problems whit DINI - godoy32 - 08.12.2011

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


Re: Problems whit DINI - AstonDA-G - 08.12.2011

Last try, forget about the #define.

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



Respuesta: Re: Problems whit DINI - godoy32 - 08.12.2011

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

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