SA-MP Forums Archive
Problema al guardar. - 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 al guardar. (/showthread.php?tid=269318)



Problema al guardar. - arturo clark - 16.07.2011

Estoy guardando informaciуn usando las funciones viejas y lentas. Y aquн esta el codigo:
pawn Код:
Function SavingVehicle(playerid)
{
    new Float:Pos[4], str[80], File: file = fopen("Server.INI", io_write);
    GetVehiclePos(GetPlayerVehicleID(playerid), Pos[0], Pos[1], Pos[2]);
    GetVehicleZAngle(GetPlayerVehicleID(playerid), Pos[3]);
    format(str, 100, "%d,%f,%f,%f,%f,1,1 ;\r\n", GetVehicleModel(GetPlayerVehicleID(playerid)), Pos[0], Pos[1], Pos[2], Pos[3]);
    fwrite(file, str);
    fclose(file);
    return 1;
}
Pero cada vez que guarda sustituye la primera linea por otra, o sea nunca pasa de la linea 1.


Respuesta: Problema al guardar. - Ari3l - 16.07.2011

Prueba haci quizas ande xD
pawn Код:
Function SavingVehicle(playerid)
{
    new Float:Pos[4], str[80], File: file = fopen("Server.INI", io_write);
    GetVehiclePos(GetPlayerVehicleID(playerid), Pos[0], Pos[1], Pos[2]);
    GetVehicleZAngle(GetPlayerVehicleID(playerid), Pos[3]);
    format(str, 100, "\r\n%d,%f,%f,%f,%f,1,1 ;", GetVehicleModel(GetPlayerVehicleID(playerid)), Pos[0], Pos[1], Pos[2], Pos[3]);
    fwrite(file, str);
    fclose(file);
    return 1;
}



Re: Problema al guardar. - arturo clark - 16.07.2011

No, sigue sin funcionar.


Re: Problema al guardar. - arturo clark - 16.07.2011

En verdad necesito ayuda, por favor.

P.D.: Perdуn por doble post.


Respuesta: Problema al guardar. - TheChaoz - 16.07.2011

pawn Код:
Function SavingVehicle(playerid)
{
    new Float:Pos[4], str[80], File:file;
    if(!fexist("Server.INI")file= fopen("Server.INI", io_write);
    else file = fopen("Server.INI", io_append);
    GetVehiclePos(GetPlayerVehicleID(playerid), Pos[0], Pos[1], Pos[2]);
    GetVehicleZAngle(GetPlayerVehicleID(playerid), Pos[3]);
    format(str, 100, "%d,%f,%f,%f,%f,1,1 ;\r\n", GetVehicleModel(GetPlayerVehicleID(playerid)), Pos[0], Pos[1], Pos[2], Pos[3]);
    fwrite(file, str);
    return fclose(file);
}
suponiendo que el codigo esta bien, no lo mire.


Respuesta: Problema al guardar. - Ari3l - 16.07.2011

creo que es necesario usar "io_append" creo que una ves me habia pasado algo parecido


Re: Problema al guardar. - arturo clark - 16.07.2011

Jaja, encontrй algo en wiki:
Код:
io_write = Writes in a file, clears all earlier written text
io_append = Appending to a file, writing only
Creo que tienes razуn Ariel, gracias.
Y aquн esta el link por si tienen una duda:
https://sampwiki.blast.hk/wiki/File_Functions


Respuesta: Problema al guardar. - TheChaoz - 16.07.2011

LOL si miras el codigo te lo deje con io_append y tendria q funcionar


Re: Respuesta: Problema al guardar. - arturo clark - 16.07.2011

Quote:
Originally Posted by the_chaoz
Посмотреть сообщение
LOL si miras el codigo te lo deje con io_append y tendria q funcionar
Creo que puse mi comentario antes que tu lo hicieras, gracias tambiйn sirve.


Respuesta: Re: Respuesta: Problema al guardar. - TheChaoz - 16.07.2011

Quote:
Originally Posted by arturo clark
Посмотреть сообщение
Creo que puse mi comentario antes que tu lo hicieras, gracias tambiйn sirve.
de hecho no xD pero no viene al caso, espero q te sirva. si no avisa