[AJUDA]Nгo estб a guardar -
andmeida10 - 23.06.2012
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
Re: [AJUDA]Nгo estб a guardar -
Bruno Pereira - 23.06.2012
Tenta assim
PHP код:
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;
}
Re: [AJUDA]Nгo estб a guardar -
andmeida10 - 23.06.2012
funcionou...
oq vc alterou??
Re: [AJUDA]Nгo estб a guardar -
Edu33 - 23.06.2012
Os return's no fim. e a ''}''
Re: [AJUDA]Nгo estб a guardar -
andmeida10 - 23.06.2012
Qual a funзгo e como funcionam o return
Nunca entedi
Re: [AJUDA]Nгo estб a guardar -
.FuneraL. - 23.06.2012
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.
Re: [AJUDA]Nгo estб a guardar -
Bruno Pereira - 24.06.2012
Eu retirei o return true; e arrumei o format de:
PHP код:
format(pfile, sizeof(pfile), "/Players/%s.ini", iname);
Para:
PHP код:
format(pfile, sizeof(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є
Re: [AJUDA]Nгo estб a guardar -
steeldark - 24.06.2012
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
Re: [AJUDA]Nгo estб a guardar -
Bruno Pereira - 24.06.2012
Й sobre a barra nгo tinha certeza, retirei por que sempre uso sem barra

mas o problema era realmente no return true;
Respuesta: [AJUDA]Nгo estб a guardar -
zSuYaNw - 24.06.2012
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