[AJUDA]Nгo estб a guardar
#1

Boas



Alguem me sabe dizer porque isto nao estб a guardar


Jб ai dei voltas e voltas, e nao consigo encontrar o motivo de ele nao estar a guardar/salvar as contas.... :S




pawn Код:
public SavingFiles()
{

    for(new i = 0; i < MAX_PLAYERS; i++)
        {
        new iname[MAX_PLAYER_NAME], pfile[52];
        GetPlayerName(i, iname, sizeof(iname));
        format(pfile, sizeof(pfile), "/Players/%s.ini", iname);
       
        if(dini_Exists(pfile))
            {
            PlayerInfo[i][pSkin] = GetPlayerSkin(i);
            PlayerInfo[i][pCash] = GetPlayerMoney(i);
            PlayerInfo[i][pLevel] = GetPlayerScore(i);
           
            dini_IntSet(pfile, "AdminLevel",    PlayerInfo[i][pAdmin]);
            dini_IntSet(pfile, "Score",         PlayerInfo[i][pLevel]);
            dini_IntSet(pfile, "Dinheiro",      PlayerInfo[i][pCash]);
            dini_IntSet(pfile, "Kills",         PlayerInfo[i][pKills]);
            dini_IntSet(pfile, "Deaths",        PlayerInfo[i][pDeaths]);
            dini_IntSet(pfile, "Skin",          PlayerInfo[i][pSkin]);
            SendAdminMessage(AMARELO, "Salvamento das contas efetuado com sucesso");
            AdminLog("Salvamento das contas efetuado com sucesso)");
           
            return 1;
            }
           
        return 1;
        }

return 1;
}


Obrigado
Reply
#2

Tenta assim

PHP код:
public SavingFiles()
{
    for(new 
0MAX_PLAYERSi++)
    {
        new 
iname[MAX_PLAYER_NAME], pfile[52];
        
GetPlayerName(iinamesizeof(iname));
        
format(pfilesizeof(pfile), "Players/%s.ini"iname);
        
        if(
dini_Exists(pfile))
        {
            
PlayerInfo[i][pSkin] = GetPlayerSkin(i);
            
PlayerInfo[i][pCash] = GetPlayerMoney(i);
            
PlayerInfo[i][pLevel] = GetPlayerScore(i);
          
            
dini_IntSet(pfile"AdminLevel",    PlayerInfo[i][pAdmin]);
            
dini_IntSet(pfile"Score",         PlayerInfo[i][pLevel]);
            
dini_IntSet(pfile"Dinheiro",      PlayerInfo[i][pCash]);
            
dini_IntSet(pfile"Kills",         PlayerInfo[i][pKills]);
            
dini_IntSet(pfile"Deaths",        PlayerInfo[i][pDeaths]);
            
dini_IntSet(pfile"Skin",          PlayerInfo[i][pSkin]);
            
SendAdminMessage(AMARELO"Salvamento das contas efetuado com sucesso");
            
AdminLog("Salvamento das contas efetuado com sucesso)");
        }
        return 
1;
    }
    return 
1;

Reply
#3

funcionou...

oq vc alterou??
Reply
#4

Os return's no fim. e a ''}''
Reply
#5

Qual a funзгo e como funcionam o return

Nunca entedi
Reply
#6

Quote:
Originally Posted by andmeida10
Посмотреть сообщение
Qual a funзгo e como funcionam o return

Nunca entedi
Alн se nгo me engano , ele retorna a parte do salvamento do arquivo, logo apуs ele retorna o loop e logo depois disso fecha a public.
Reply
#7

Eu retirei o return true; e arrumei o format de:
PHP код:
format(pfilesizeof(pfile), "/Players/%s.ini"iname); 
Para:

PHP код:
format(pfilesizeof(pfile), "Players/%s.ini"iname); 
Nгo precisa usar / no comeзo
O return fazeria com que nгo fosse mais executado loop, somente com o 1є
Reply
#8

Nesse caso, sу retirar o "return 1", ja resolvia..

a barra "/" nгo faz diferenзa usa-la..

mais o q acontecia era exatamente o q ele falou acima, o return 1 fazia com que o loop fosse interrompido. return em loop == dor de cabeзa hehe
Reply
#9

Й sobre a barra nгo tinha certeza, retirei por que sempre uso sem barra mas o problema era realmente no return true;
Reply
#10

pawn Код:
public SavingFiles()
{
    for(new i = 0, MaxP = GetMaxPlayers(); MaxP != i; ++i)
    {
        if(IsPlayerConnected(i))
        {
            static
                iname[MAX_PLAYER_NAME],
                pfile[37] // 13 + 24 = 37 xD
            ;

            GetPlayerName(i, iname, sizeof(iname));
            format(pfile, sizeof(pfile), "Players/%s.ini", iname);

            if(dini_Exists(pfile))
            {
                PlayerInfo[i][pSkin] = GetPlayerSkin(i);
                PlayerInfo[i][pCash] = GetPlayerMoney(i);
                PlayerInfo[i][pLevel] = GetPlayerScore(i);

                dini_IntSet(pfile, "AdminLevel",    PlayerInfo[i][pAdmin]);
                dini_IntSet(pfile, "Score",         PlayerInfo[i][pLevel]);
                dini_IntSet(pfile, "Dinheiro",      PlayerInfo[i][pCash]);
                dini_IntSet(pfile, "Kills",         PlayerInfo[i][pKills]);
                dini_IntSet(pfile, "Deaths",        PlayerInfo[i][pDeaths]);
                dini_IntSet(pfile, "Skin",          PlayerInfo[i][pSkin]);
               
                SendAdminMessage(AMARELO, "Salvamento das contas efetuado com sucesso");
                AdminLog("Salvamento das contas efetuado com sucesso)");
            }
        }
    }
    return 1;
}
Admeida, tente isto, pouco mais otimizado
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)