Problema al guardar.
#1

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.
Reply
#2

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;
}
Reply
#3

No, sigue sin funcionar.
Reply
#4

En verdad necesito ayuda, por favor.

P.D.: Perdуn por doble post.
Reply
#5

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.
Reply
#6

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

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
Reply
#8

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

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.
Reply
#10

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)