SA-MP Forums Archive
Problema con DINI - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Español/Spanish (https://sampforum.blast.hk/forumdisplay.php?fid=29)
+---- Thread: Problema con DINI (/showthread.php?tid=302333)



Problema con DINI - godoy32 - 08.12.2011

Hola, bueno nunca supe como usar dini de la forma correcta... Generalmente las cosas que ago con dini no resultan como quiero.

Bueno en este caso, tengo una carpeta en scriptfiles llamada 'Recompensas'
Y se deberia guardar un archivo *.ini con el nombre del jugador, pero no sucede nada.
Acб el codigo

---
Definiciones
pawn Код:
enum pInfo //Array donde se guardara la info del jugador!
{
    ConHIT,
    COMPLETADOS,
    PUESTOS,
};
new aInfo[MAX_PLAYERS][pInfo];
#define SAVERECOMPENSAS "Recompensas/%s.ini"
---
Cuando se conecta
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");
    }
----
Cuando se desconecta
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]);
Como dije anteriormente, el problema es que no se crea ningъn archivo *.ini

Espero que me pueden decir que estб mal.
Saludos


Re: Problema con DINI - GaBO! - 09.12.2011

no te guarda el archivo .ini porque no especificas el lugar en donde quedara guardado


Re: Problema con DINI - Daniel-92 - 09.12.2011

Primero debes crear la carpeta "Recompensas" en scriptfiles para que se puedan crear los archivos


Respuesta: Problema con DINI - jurgen - 09.12.2011

#define SAVERECOMPENSAS "/Recompensas/%s.ini"


Respuesta: Problema con DINI - godoy32 - 09.12.2011

Quote:
Originally Posted by GaBO!
Посмотреть сообщение
no te guarda el archivo .ini porque no especificas el lugar en donde quedara guardado
Si estб definida
pawn Код:
#define SAVERECOMPENSAS "/Recompensas/%s.ini"
Quote:
Originally Posted by Daniel-92
Посмотреть сообщение
Primero debes crear la carpeta "Recompensas" en scriptfiles para que se puedan crear los archivos
Si la tengo creada ¬¬
Quote:
Originally Posted by jurgen
Посмотреть сообщение
#define SAVERECOMPENSAS "/Recompensas/%s.ini"
?