їGuardar y Leer textos?
#3

Quote:
Originally Posted by Harrinston
Посмотреть сообщение
pawn Код:
SaveDate(playerid)
{
    new File:handle = fopen("tuarchivo.txt", io_write);
    new string[TAMAСO DE LO QUE VAS A GUARDAR], name[MAX_PLAYER_NAME], Float:x, Float:y, Float:z;
    GetPlayerName(playerid, name, MAX_PLAYER_NAME);
    GetPlayerPos(playerid, x, y, z);
    format(string, sizeof(string), "%s, %s, %f, %f, %f, %d", name, variablepass, x, y, z, GetPlayerSkin(playerid));
    fwrite(handle, string);
    fclose(handle);
    return 1;
}

Eso es para guardar, aunque hay mбs mйtodos de hacerlo por otros sistemas y demбs.

Y esto es para cargar:

pawn Код:
LoadMapIcons()
{
    new File:handle = fopen("tuarchivo.txt", io_read);
    if(fexist("tuarchivo.txt"))
    {
        new Float:x, Float:y, Float:z, line[256], CountAccounts = 0; // y mбs variables
        while(fread(handle, line))
        {
            if(!unformat(line, "p<SEPARADO>tus variables", variables))
            {
                              //Aquн cargas las variables del jugador asignandole a cada uno la variable determinada que separу el unformat
                CountAccounts++;
            }
        }
        fclose(handle);
        printf("Fueron cargados %d cuentas desde el archivo 'tuarchivo.txt'.", CountAccounts);
        return 1;
    }
    else return 0;
}

Asн cargaba yo las cosas y las guardaba aunque hace mucho que ya no toco file, estoy usando mбs MySQL. Me duele un poco la cabeza ahora, disculpas si lo hice desordenado o hay algъn error de ortografнa. Me pareciу mбs efectivo ayudarte que no responder nada.

Gracias, pero al final.. їCуmo saco un texto?
Estбn los floatstr() strval() y demбs, pero del include string no se cual es para sacar textos :S
Reply


Messages In This Thread
їGuardar y Leer textos? - by The_Scripter_Zero - 01.03.2012, 16:26
Re: їGuardar y Leer textos? - by Harrinston - 01.03.2012, 17:40
Respuesta: Re: їGuardar y Leer textos? - by The_Scripter_Zero - 01.03.2012, 18:04
Re: їGuardar y Leer textos? - by LuisGraph - 01.03.2012, 18:24
Re: їGuardar y Leer textos? - by Harrinston - 01.03.2012, 19:37
Respuesta: їGuardar y Leer textos? - by The_Scripter_Zero - 01.03.2012, 20:17
Respuesta: їGuardar y Leer textos? - by Jovanny - 01.03.2012, 20:29
Re: їGuardar y Leer textos? - by Harrinston - 01.03.2012, 20:32
Re: їGuardar y Leer textos? - by LuisGraph - 01.03.2012, 20:40
Respuesta: їGuardar y Leer textos? - by [Nikk] - 01.03.2012, 20:42

Forum Jump:


Users browsing this thread: 2 Guest(s)