public OnPlayerDisconnect(playerid, reason)
{
if(reason == 2 || if(reason == 1) if(reason == 0)) salvar_conta(playerid);
}
forward OnPlayerUpdateEx();
public OnPlayerUpdateEx()
{
salvar_conta(playerid);
}
salvar_conta(playerid)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (gPlayerLogged[i] == 1)
{
new string3[32], playername3[MAX_PLAYER_NAME];
GetPlayerName(i, playername3, sizeof(playername3));
format(string3, sizeof(string3), "Usuarios/%s.txt", playername3);
new File: hFile = fopen(string3, io_write);
if (hFile)
{
new var[32];
format(var,32,"Key=%s\n",PlayerInfo[i][pKey]);fwrite(hFile,var);
PlayerInfo[i][pCash] = GetPlayerMoney(i);
format(var,32,"Level=%d\n",PlayerInfo[i][pLevel]);fwrite(hFile,var);
format(var,32,"Funcao=%s\n",PlayerInfo[i][pFuncao]);fwrite(hFile, var);
format(var,32,"AdminLevel=%d\n",PlayerInfo[i][pAdmin]);fwrite(hFile,var);
format(var,32,"AdminStats=%d\n",PlayerInfo[i][pAdmDuty]);fwrite(hFile,var);
format(var,32,"HelperLevel=%d\n",PlayerInfo[i][pHelper]);fwrite(hFile, var);
format(var,32,"Premio=%d\n",PlayerInfo[i][pDonateRank]);fwrite(hFile,var);
format(var,32,"UpgradePoints=%d\n",PlayerInfo[i][gPupgrade]);fwrite(hFile,var);
format(var,32,"ConnectedTime=%d\n",PlayerInfo[i][pConnectTime]);fwrite(hFile,var);
format(var,32,"Capacete=%d\n",PlayerInfo[i][pCapacete]);fwrite(hFile,var);
format(var,32,"MatouEvento=%d\n",PlayerInfo[i][pMatou]);fwrite(hFile,var);
format(var,32,"Hospital=%d\n",Hospital[i]);fwrite(hFile,var);
format(var,32,"Sex=%d\n",PlayerInfo[i][pSex]);fwrite(hFile,var);
format(var,32,"Age=%d\n",PlayerInfo[i][pAge]);fwrite(hFile,var);
format(var,32,"Origin=%d\n",PlayerInfo[i][pOrigin]);fwrite(hFile,var);
format(var,32,"CK=%d\n",PlayerInfo[i][pCK]);fwrite(hFile,var);
format(var,32,"Gorro=%d\n",PlayerInfo[i][pGorro]);fwrite(hFile,var);
format(var,32,"Chapeu=%d\n",PlayerInfo[i][pChapeu]);fwrite(hFile,var);
format(var,32,"Muted=%d\n",PlayerInfo[i][pMuted]);fwrite(hFile,var);
format(var,32,"Respect=%d\n",PlayerInfo[i][pExp]);fwrite(hFile,var);
format(var,32,"Money=%d\n",PlayerInfo[i][pCash]);fwrite(hFile,var);
format(var,32,"Banco=%d\n",PlayerInfo[i][pAccount]);fwrite(hFile,var);
format(var,32,"Crimes=%d\n",PlayerInfo[i][pCrimes]);fwrite(hFile,var);
format(var,32,"Kills=%d\n",PlayerInfo[i][pKills]);fwrite(hFile,var);
format(var,32,"Deaths=%d\n",PlayerInfo[i][pDeaths]);fwrite(hFile,var);
format(var,32,"Arrested=%d\n",PlayerInfo[i][pArrested]);fwrite(hFile,var);
format(var,32,"Procurado=%d\n",PlayerInfo[i][pWantedLevel]);fwrite(hFile,var);
format(var,32,"ListaTelefonica=%d\n",PlayerInfo[i][pListaTelefonica]);fwrite(hFile,var);
format(var,32,"Radio=%d\n",PlayerInfo[i][pRadio]);fwrite(hFile,var);
format(var,32,"RadioStats=%d\n",PlayerInfo[i][pRadioStats]);fwrite(hFile,var);
format(var,32,"Pilotar=%d\n",PlayerInfo[i][pPilotar]);fwrite(hFile,var);
format(var,32,"Loteria=%d\n",PlayerInfo[i][pLoteria]);fwrite(hFile,var);
format(var,32,"Peixes=%d\n",PlayerInfo[i][pFishes]);fwrite(hFile,var);
format(var,32,"BiggestPeixe=%d\n",PlayerInfo[i][pBiggestPeixe]);fwrite(hFile,var);
format(var,32,"Emprego=%d\n",PlayerInfo[i][pEmprego]);fwrite(hFile,var);
format(var,32,"Salario=%d\n",PlayerInfo[i][pSalario]);fwrite(hFile,var);
format(var,32,"HeadValue=%d\n",PlayerInfo[i][pHeadValue]);fwrite(hFile,var);
format(var,32,"Jailed=%d\n",PlayerInfo[i][pJailed]);fwrite(hFile,var);
format(var,32,"JailTime=%d\n",PlayerInfo[i][pJailTime]);fwrite(hFile,var);
format(var,32,"Materials=%d\n",PlayerInfo[i][pMats]);fwrite(hFile,var);
format(var,32,"Drogas=%d\n",PlayerInfo[i][pMaconha]);fwrite(hFile,var);
format(var,32,"Cocaina=%d\n",PlayerInfo[i][pCocaina]);fwrite(hFile,var);
format(var,32,"SafeMats=%d\n",PlayerInfo[i][pBoxMats]);fwrite(hFile,var);
format(var,32,"SafeDrogas=%d\n",PlayerInfo[i][pBoxDrogas]);fwrite(hFile,var);
format(var,32,"SafeDrogas2=%d\n",PlayerInfo[i][pBoxDrogas2]);fwrite(hFile,var);
format(var,32,"Leader=%d\n",PlayerInfo[i][pLider]);fwrite(hFile,var);
format(var,32,"Member=%d\n",PlayerInfo[i][pMembro]);fwrite(hFile,var);
format(var,32,"FMember=%d\n",PlayerInfo[i][pFMember]);fwrite(hFile,var);
format(var,32,"Cargo=%d\n",PlayerInfo[i][pCargo]);fwrite(hFile,var);
format(var,32,"Char=%d\n",PlayerInfo[i][pChar]);fwrite(hFile,var);
format(var,32,"EquipSkin=%d\n",PlayerInfo[i][pEquipSkin]);fwrite(hFile,var);
format(var,32,"ContractTime=%d\n",PlayerInfo[i][pContractTime]);fwrite(hFile,var);
format(var,32,"Painel=%d\n",PlayerInfo[i][pStatusPlayer]);fwrite(hFile,var);
format(var,32,"VeiculoModelo=%d\n",PlayerInfo[i][pVeiculoModelo]);fwrite(hFile,var);
format(var,32,"DetSkill=%d\n",PlayerInfo[i][pDetSkill]);fwrite(hFile,var);
format(var,32,"SexSkill=%d\n",PlayerInfo[i][pSexSkill]);fwrite(hFile,var);
format(var,32,"BoxSkill=%d\n",PlayerInfo[i][pBoxSkill]);fwrite(hFile,var);
format(var,32,"LawSkill=%d\n",PlayerInfo[i][pLawSkill]);fwrite(hFile,var);
format(var,32,"MechSkill=%d\n",PlayerInfo[i][pMechSkill]);fwrite(hFile,var);
format(var,32,"JackSkill=%d\n",PlayerInfo[i][pJackSkill]);fwrite(hFile,var);
format(var,32,"NewsSkill=%d\n",PlayerInfo[i][pNewsSkill]);fwrite(hFile,var);
format(var,32,"DrogasSkill=%d\n",PlayerInfo[i][pDrogasSkill]);fwrite(hFile,var);
format(var,32,"Bilhete=%d\n",PlayerInfo[i][pBilhete]);fwrite(hFile,var);
format(var,32,"fishesSkill=%d\n",PlayerInfo[i][pFishesSkill]);fwrite(hFile,var);
format(var,32,"pSHealth=%.1f\n",PlayerInfo[i][pSHealth]);fwrite(hFile,var);
format(var,32,"Local=%d\n",PlayerInfo[i][pLocal]);fwrite(hFile,var);
format(var,32,"Model=%d\n",PlayerInfo[i][pModel]);fwrite(hFile,var);
format(var,32,"PhoneNr=%d\n",PlayerInfo[i][pPnumber]);fwrite(hFile,var);
format(var,32,"House=%d\n",PlayerInfo[i][pPhousekey]);fwrite(hFile,var);
format(var,32,"Bizz=%d\n",PlayerInfo[i][pPbiskey]);fwrite(hFile,var);
format(var,32,"Carro=%d\n",PlayerInfo[i][pVeiculo]);fwrite(hFile,var);
format(var,32,"Carro2=%d\n",PlayerInfo[i][pVeiculo2]);fwrite(hFile,var);
format(var,32,"Carro3=%d\n",PlayerInfo[i][pVeiculo3]);fwrite(hFile,var);
format(var,32,"Carro4=%d\n",PlayerInfo[i][pVeiculo4]);fwrite(hFile,var);
format(var,32,"Carro5=%d\n",PlayerInfo[i][pVeiculo5]);fwrite(hFile,var);
format(var,32,"CarLic=%d\n",PlayerInfo[i][pVeiculoLic]);fwrite(hFile,var);
format(var,32,"MotoLic=%d\n",PlayerInfo[i][pMotoLic]);fwrite(hFile,var);
format(var,32,"CaminhaoLic=%d\n",PlayerInfo[i][pCaminhaoLic]);fwrite(hFile,var);
format(var,32,"OnibusLic=%d\n",PlayerInfo[i][pOnibusLic]);fwrite(hFile,var);
format(var,32,"VooLic=%d\n",PlayerInfo[i][pVooLic]);fwrite(hFile,var);
format(var,32,"BarcoLic=%d\n",PlayerInfo[i][pBarcoLic]);fwrite(hFile,var);
format(var,32,"PeixeLic=%d\n",PlayerInfo[i][pPeixeLic]);fwrite(hFile,var);
format(var,32,"GunLic=%d\n",PlayerInfo[i][pGunLic]);fwrite(hFile,var);
format(var,32,"Gun1=%d\n",PlayerInfo[i][pGun1]);fwrite(hFile,var);
format(var,32,"Gun2=%d\n",PlayerInfo[i][pGun2]);fwrite(hFile,var);
format(var,32,"Gun3=%d\n",PlayerInfo[i][pGun3]);fwrite(hFile,var);
format(var,32,"Gun4=%d\n",PlayerInfo[i][pGun4]);fwrite(hFile,var);
format(var,32,"Gun5=%d\n",PlayerInfo[i][pGun5]);fwrite(hFile,var);
format(var,32,"Gun6=%d\n",PlayerInfo[i][pGun6]);fwrite(hFile,var);
format(var,32,"Gun7=%d\n",PlayerInfo[i][pGun7]);fwrite(hFile,var);
format(var,32,"Gun8=%d\n",PlayerInfo[i][pGun8]);fwrite(hFile,var);
format(var,32,"Gun11=%d\n",PlayerInfo[i][pGun11]);fwrite(hFile,var);
format(var,32,"Gun10=%d\n",PlayerInfo[i][pGun10]);fwrite(hFile,var);
format(var,32,"Ammo1=%d\n",PlayerInfo[i][pAmmo1]);fwrite(hFile,var);
format(var,32,"Ammo2=%d\n",PlayerInfo[i][pAmmo2]);fwrite(hFile,var);
format(var,32,"Ammo3=%d\n",PlayerInfo[i][pAmmo3]);fwrite(hFile,var);
format(var,32,"Ammo4=%d\n",PlayerInfo[i][pAmmo4]);fwrite(hFile,var);
format(var,32,"Ammo5=%d\n",PlayerInfo[i][pAmmo5]);fwrite(hFile,var);
format(var,32,"Ammo6=%d\n",PlayerInfo[i][pAmmo6]);fwrite(hFile,var);
format(var,32,"Ammo7=%d\n",PlayerInfo[i][pAmmo7]);fwrite(hFile,var);
format(var,32,"Ammo8=%d\n",PlayerInfo[i][pAmmo8]);fwrite(hFile,var);
format(var,32,"Ammo11=%d\n",PlayerInfo[i][pAmmo11]);fwrite(hFile,var);
format(var,32,"Ammo10=%d\n",PlayerInfo[i][pAmmo10]);fwrite(hFile,var);
format(var,32,"CarTime=%d\n",PlayerInfo[i][pCarTime]);fwrite(hFile,var);
format(var,32,"AdvogadoTime=%d\n",PlayerInfo[i][pAdvogadoTime]);fwrite(hFile,var);
format(var,32,"RouboTime=%d\n",PlayerInfo[i][pRouboTime]);fwrite(hFile,var);
format(var,32,"TimerUm=%d\n",PlayerInfo[i][pTimerUm]);fwrite(hFile,var);
format(var,32,"ContratoOrg=%d\n",PlayerInfo[i][pContOrg]);fwrite(hFile,var);
format(var,32,"Conce=%d\n",PlayerInfo[i][pConce]);fwrite(hFile,var);
format(var,32,"Fome=%d\n",FomePlayer[i]);fwrite(hFile,var);
format(var,32,"TimeCaixa=%d\n",PlayerInfo[i][pTimeCaixa]);fwrite(hFile,var);
format(var,32,"PayDay=%d\n",PlayerInfo[i][pPayDay]);fwrite(hFile,var);
format(var,32,"PayDayHad=%d\n",PlayerInfo[i][pPayDayHad]);fwrite(hFile,var);
format(var,32,"FGTS=%d\n",PlayerInfo[i][pFGTS]);fwrite(hFile,var);
format(var,32,"CDPlayer=%d\n",PlayerInfo[i][pCDPlayer]);fwrite(hFile,var);
format(var,32,"Wins=%d\n",PlayerInfo[i][pWins]);fwrite(hFile,var);
format(var,32,"Loses=%d\n",PlayerInfo[i][pLoses]);fwrite(hFile,var);
format(var,32,"AlcoholPerk=%d\n",PlayerInfo[i][pAlcoholPerk]);fwrite(hFile,var);
format(var,32,"DrugPerk=%d\n",PlayerInfo[i][pDrugPerk]);fwrite(hFile,var);
format(var,32,"MiserPerk=%d\n",PlayerInfo[i][pMiserPerk]);fwrite(hFile,var);
format(var,32,"PainPerk=%d\n",PlayerInfo[i][pPainPerk]);fwrite(hFile,var);
format(var,32,"TraderPerk=%d\n",PlayerInfo[i][pTraderPerk]);fwrite(hFile,var);
format(var,32,"Tutorial=%d\n",PlayerInfo[i][pTut]);fwrite(hFile,var);
format(var,32,"Warnings=%d\n",PlayerInfo[i][pWarns]);fwrite(hFile,var);
format(var,32,"Adjustable=%d\n",PlayerInfo[i][pAdjustable]);fwrite(hFile,var);
format(var,32,"Combustivel=%d\n",PlayerInfo[i][pCombustivel]);fwrite(hFile,var);
format(var,32,"Married=%d\n",PlayerInfo[i][pMarried]);fwrite(hFile,var);
format(var,32,"MarriedTo=%s\n",PlayerInfo[i][pMarriedTo]);fwrite(hFile,var);
format(var,32,"Saque=%d\n",PlayerInfo[i][pSaque]);fwrite(hFile,var);
format(var,32,"Moedas=%d\n",PlayerInfo[i][pMoedasVIP]);fwrite(hFile,var);
format(var,32,"Luta=%d\n",PlayerInfo[i][pLuta]);fwrite(hFile,var);
format(var,32,"Multas=%d\n",PlayerInfo[i][pPrecoMulta]);fwrite(hFile,var);
format(var,32,"Ajustado=%d\n",PlayerInfo[i][pAjustado]);fwrite(hFile, var);
format(var,32,"CasaEntrada=%d\n",PlayerInfo[i][pCasaEntrada]);fwrite(hFile, var);
fclose(hFile);
}
}
}
}
public OnPlayerDisconnect(playerid, reason)
{
if(reason == 2 || if(reason == 1) if(reason == 0)) salvar_conta(playerid);
}
public OnPlayerDisconnect(playerid, reason)
{
salvar_conta(playerid);
return 1;
}
PHP код:
PHP код:
|
1° nгo precisa usar um if com o motivo da saнda do player,
2° nгo precisa ficar salvando a conta do player segundo a segundo na OnPlayerUpdateEx. 3° nгo precisa de um loop para salvar as contas 4° isso ai com certeza deve legar seu servidor |
for(new i = 0; i < MAX_PLAYERS; i++) salvar_conta(i);