[Ajuda]Algo errado
#10

pawn Код:
stock SaveWeapons(playerid)
{
    new pharrel[128], string_[29], weapon, ammo;
    for(new i=0; i<13; i++)
    {
        GetPlayerWeaponData(playerid, i, weapon, ammo);
        format(string_, 5,"%d%d",weapon,ammo);
        strcat(pharrel, string_);
    }
    GetPlayerName(playerid, string_, 24);
    format(string_, 29, "%s.ini", string_);
    new File:arquivo = fopen(string_, io_read);
    fwrite(arquivo, pharrel);
    fclose(arquivo);
    return 1;
}

stock LoadWeapons(playerid)
{
    new string_[29], pharrel[128], weapon[13], ammo[13];
    format(string_, 29, "%s.ini", string_);
    new File:arquivo = fopen(string_, io_read);
    fread(arquivo, pharrel, 128);
    fclose(arquivo);
    fremove(arquivo);
    unformat(pharrel, "dddddddddddddddddddddddd",
    weapon[0],ammo[0],weapon[1],ammo[1],weapon[2],ammo[2],weapon[3],ammo[3],weapon[4],ammo[4],weapon[5],ammo[5],weapon[6],
    ammo[6],weapon[7],ammo[7],weapon[8],ammo[8],weapon[9],ammo[9],weapon[10],ammo[10],weapon[11],ammo[11],weapon[12],ammo[12]);
    for(new i=0; i<13; i++)
    {
        if(ammo[i] > 0);
            GivePlayerWeapon(playerid, weapon[i], ammo[i]);
    }
    return 1;
}
Refiz o codigo pra vc pq seu codigo tava muito blйch...

vc vai precisar do plugin sscanf2

Se vc quiser salvar as armas de todos os players em 1 sу file eu aconselho a usar SII, se vc quiser eu faзo pra vc.
Reply


Messages In This Thread
[Ajuda]Algo errado - by DrTHE - 14.11.2011, 15:55
Re: [Ajuda]Algo errado - by rjjj - 14.11.2011, 16:04
Re: [Ajuda]Algo errado - by DrTHE - 14.11.2011, 16:06
Re: [Ajuda]Algo errado - by Lуs - 14.11.2011, 16:07
Re: [Ajuda]Algo errado - by DrTHE - 14.11.2011, 16:48
Re: [Ajuda]Algo errado - by Lуs - 14.11.2011, 16:56
Re: [Ajuda]Algo errado - by ViniBorn - 14.11.2011, 17:02
Re: [Ajuda]Algo errado - by DrTHE - 14.11.2011, 17:15
Re: [Ajuda]Algo errado - by DrTHE - 15.11.2011, 10:41
Re: [Ajuda]Algo errado - by Pharrel - 15.11.2011, 11:09

Forum Jump:


Users browsing this thread: 1 Guest(s)