SA-MP Forums Archive
[Ajuda] DOF2 Nгo salva. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] DOF2 Nгo salva. (/showthread.php?tid=473054)



DOF2 Nгo salva. - Jorge-IN - 01.11.2013

oque ocorre agora, й que nгo estou conseguindo salvar em dof2, exemplo, player registra no servidor e ganha 5k. ai ele deposita 3k no banco fica com 2 na mao e quando deslogo do servidor e logo novamente, volta os 5k na mгo dele, percebi que na pasta scriptfiles nгo altera nada, entгo o problema deve estar no salvamento, vejam:

OnPlayerDisconnect
PHP код:
OnPlayerSave(playerid); 
PHP код:
public OnPlayerSave(playerid)
{
    if(
IsPlayerConnected(playerid))
    {
        if(
gPlayerLogged[playerid])
        {
            new 
file[128];
            
format(filesizeof(file), "/RPG/users/%s.ini"Player[playerid][pName]);
            
DOF2_SetInt(file"Level"Player[playerid][pLevel]);
            
DOF2_SetInt(file"AdminLevel"Player[playerid][pAdmin]);
            
DOF2_SetInt(file"DonateRank"Player[playerid][pDonateRank]);
            
DOF2_SetInt(file"UpgradePoints"Player[playerid][gPupgrade]);
            
DOF2_SetInt(file"ConnectedTime"Player[playerid][pConnectTime]);
            
DOF2_SetInt(file"Registered"Player[playerid][pReg]);
            
DOF2_SetInt(file"Sex"Player[playerid][pSex]);
            
DOF2_SetInt(file"Age"Player[playerid][pAge]);
            
DOF2_SetInt(file"Origin"Player[playerid][pOrigin]);
            
DOF2_SetInt(file"Respect"Player[playerid][pExp]);
            
DOF2_SetInt(file"Money"Player[playerid][pCash]);
            
DOF2_SetInt(file"Bank"Player[playerid][pBank]);
            
printf("bankvar: %d,  bankfile: %d"Player[playerid][pBank], DOF2_GetInt(file"Bank"));
            
DOF2_SetInt(file"Crimes"Player[playerid][pCrimes]);
            
DOF2_SetInt(file"Crimes2"Player[playerid][pCrimes2]);
            
DOF2_SetInt(file"Kills"Player[playerid][pKills]);
            
DOF2_SetInt(file"Morto"Player[playerid][pMorto]);
            
DOF2_SetInt(file"SkillPistol"Player[playerid][SkillPistol]);
            
DOF2_SetInt(file"SkillPistolS"Player[playerid][SkillPistolS]);
            
DOF2_SetInt(file"SkillEagle"Player[playerid][SkillEagle]);
            
DOF2_SetInt(file"SkillShotgun"Player[playerid][SkillShotgun]);
            
DOF2_SetInt(file"SkillMP5"Player[playerid][SkillMP5]);
            
DOF2_SetInt(file"SkillAK47"Player[playerid][SkillAK47]);
            
DOF2_SetInt(file"SkillM4"Player[playerid][SkillM4]);
            
DOF2_SetInt(file"Deaths"Player[playerid][pDeaths]);
            
DOF2_SetInt(file"Arrested"Player[playerid][pArrested]);
            
DOF2_SetInt(file"WantedDeaths"Player[playerid][pWantedDeaths]);
            
DOF2_SetInt(file"Phone"Player[playerid][pPhone]);
            
DOF2_SetInt(file"Mask"Player[playerid][pMask]);
            
DOF2_SetInt(file"Phonebook"Player[playerid][pPhoneBook]);
            
DOF2_SetInt(file"LottoNr"Player[playerid][pLottoNr]);
            
DOF2_SetInt(file"Fishes"Player[playerid][pFishes]);
            
DOF2_SetInt(file"BiggestFish"Player[playerid][pBiggestFish]);
            
DOF2_SetInt(file"Job"Player[playerid][pJob]);
            
DOF2_SetInt(file"Paycheck",0);
            
DOF2_SetInt(file"HeadValue"Player[playerid][pHeadValue]);
            
DOF2_SetInt(file"Jailed"Player[playerid][pJailed]);
            
DOF2_SetInt(file"JailTime"Player[playerid][pJailTime]);
            
DOF2_SetInt(file"Materials"Player[playerid][pMats]);
            
DOF2_SetInt(file"Drugs"Player[playerid][pDrugs]);
            
DOF2_SetInt(file"Cigarro"Player[playerid][pCigarro]);
            
DOF2_SetInt(file"PC"Player[playerid][pPC]);
            
DOF2_SetInt(file"Luta"Player[playerid][pLuta]);
            
DOF2_SetInt(file"Corda"Player[playerid][pCorda]);
            
DOF2_SetInt(file"Plano"Player[playerid][pPlano]);
            
DOF2_SetInt(file"Votou"Player[playerid][pVotou]);
            
DOF2_SetInt(file"Ban"Player[playerid][pBan]);
            
DOF2_SetInt(file"Leader"Player[playerid][pLeader]);
            
DOF2_SetInt(file"Member"Player[playerid][pMember]);
            
DOF2_SetInt(file"FMember"Player[playerid][pFMember]);
            
DOF2_SetInt(file"Rank"Player[playerid][pRank]);
            
DOF2_SetInt(file"Char"Player[playerid][pChar]);
            
DOF2_SetInt(file"ContractTime"Player[playerid][pContractTime]);
            
DOF2_SetInt(file"DetSkill"Player[playerid][pDetSkill]);
            
DOF2_SetInt(file"SexSkill"Player[playerid][pSexSkill]);
            
DOF2_SetInt(file"BoxSkill"Player[playerid][pBoxSkill]);
            
DOF2_SetInt(file"LawSkill"Player[playerid][pLawSkill]);
            
DOF2_SetInt(file"MechSkill"Player[playerid][pMechSkill]);
            
DOF2_SetInt(file"JackSkill"Player[playerid][pJackSkill]);
            
DOF2_SetInt(file"CarSkill"Player[playerid][pCarSkill]);
            
DOF2_SetInt(file"NewsSkill"Player[playerid][pNewsSkill]);
            
DOF2_SetInt(file"DrugsSkill"Player[playerid][pDrugsSkill]);
            
DOF2_SetInt(file"CookSkill"Player[playerid][pCookSkill]);
            
DOF2_SetInt(file"FishSkill"Player[playerid][pFishSkill]);
            
DOF2_SetFloat(file"pSHealth",Player[playerid][pSHealth]);
            
DOF2_SetFloat(file"LocalX",Player[playerid][pLocalX]);
            
DOF2_SetFloat(file"LocalY",Player[playerid][pLocalY]);
            
DOF2_SetFloat(file"LocalZ",Player[playerid][pLocalZ]);
            
GetPlayerHealth(playerid,Player[playerid][pHealth]);
            
DOF2_SetFloat(file"pHealth",Player[playerid][pHealth]);
            
DOF2_SetInt(file"Int"Player[playerid][pInt]);
            
DOF2_SetInt(file"Local"Player[playerid][pLocal]);
            
DOF2_SetInt(file"Team"Player[playerid][pTeam]);
            
DOF2_SetInt(file"Model"Player[playerid][pModel]);
            
DOF2_SetInt(file"PhoneNr"Player[playerid][pPnumber]);
            
DOF2_SetInt(file"House"Player[playerid][pPhousekey]);
            
DOF2_SetInt(file"Aluguel"Player[playerid][pPaluguelkey]);
            
DOF2_SetInt(file"Atendimentos"Player[playerid][pAtend]);
            
DOF2_SetInt(file"Nota"Player[playerid][pNota]);
            
DOF2_SetInt(file"LocalSpawn"Player[playerid][pLocalSpawn]);
            
DOF2_SetInt(file"Enigma"Player[playerid][pEnigma]);
            
DOF2_SetInt(file"Bizz"Player[playerid][pPbiskey]);
            
DOF2_SetInt(file"CarLic"Player[playerid][pCarLic]);
            
DOF2_SetInt(file"FlyLic"Player[playerid][pFlyLic]);
            
DOF2_SetInt(file"BoatLic"Player[playerid][pBoatLic]);
            
DOF2_SetInt(file"FishLic"Player[playerid][pFishLic]);
            
DOF2_SetInt(file"GunLic"Player[playerid][pGunLic]);
            
DOF2_SetInt(file"Gun1"Player[playerid][pGun1]);
            
DOF2_SetInt(file"Gun2"Player[playerid][pGun2]);
            
DOF2_SetInt(file"Gun3"Player[playerid][pGun3]);
            
DOF2_SetInt(file"Gun4"Player[playerid][pGun4]);
            
DOF2_SetInt(file"Ammo1"Player[playerid][pAmmo1]);
            
DOF2_SetInt(file"Ammo2"Player[playerid][pAmmo2]);
            
DOF2_SetInt(file"Ammo3"Player[playerid][pAmmo3]);
            
DOF2_SetInt(file"Ammo4"Player[playerid][pAmmo4]);
            
DOF2_SetInt(file"CarTime"Player[playerid][pCarTime]);
            
DOF2_SetInt(file"InvWeapon"Player[playerid][pInvWeapon]);
            
DOF2_SetInt(file"InvAmmo"Player[playerid][pInvAmmo]);
            
DOF2_SetInt(file"PayDayHad"Player[playerid][pPayDayHad]);
            
DOF2_SetInt(file"CDPlayer"Player[playerid][pCDPlayer]);
            
DOF2_SetInt(file"Wins"Player[playerid][pWins]);
            
DOF2_SetInt(file"Loses"Player[playerid][pLoses]);
            
DOF2_SetInt(file"AlcoholPerk"Player[playerid][pAlcoholPerk]);
            
DOF2_SetInt(file"DrugPerk"Player[playerid][pDrugPerk]);
            
DOF2_SetInt(file"MiserPerk"Player[playerid][pMiserPerk]);
            
DOF2_SetInt(file"PainPerk"Player[playerid][pPainPerk]);
            
DOF2_SetInt(file"TraderPerk"Player[playerid][pTraderPerk]);
            
DOF2_SetInt(file"Tutorial"Player[playerid][pTut]);
            
DOF2_SetInt(file"Warnings"Player[playerid][pWarns]);
            
DOF2_SetInt(file"Adjustable"Player[playerid][pAdjustable]);
            
DOF2_SetInt(file"Fuel"Player[playerid][pFuel]);
            
DOF2_SetInt(file"Married"Player[playerid][pMarried]);
            
DOF2_SetString(file"MarriedTo",pMarriedTo[playerid]);
            
DOF2_SetString(file"Dest",Player[playerid][pDest]);
            
DOF2_SetString(file"Aviso1",Player[playerid][pAviso1]);
            
DOF2_SetString(file"Aviso2",Player[playerid][pAviso2]);
            
DOF2_SetString(file"Prisao",Player[playerid][JailReason]);
            
DOF2_SetString(file"LU",Player[playerid][pLastLogin]);
            
DOF2_SetInt(file"LS"Player[playerid][pLastSave]);
            
DOF2_SetInt(file"LogedTime"Player[playerid][pLogedTime]);
            
DOF2_SetInt(file"Skin"GetPlayerSkin(playerid));
            
DOF2_SetString(file"ControleRemoto",Player[playerid][pControleR]);
            
DOF2_SaveFile();
          }
    }
    return 
1;




Re: DOF2 Nгo salva. - DanDRT - 01.11.2013

Use o OnPlayerSave(playerid) onde ele receber algo acho que ira parar este problema.


Re: DOF2 Nгo salva. - kreison - 01.11.2013

O Player[playerid][pCash] estб sendo atualizado sempre que o jogador ganha ou perde determinada quantia de dinheiro? Tenta usar DOF2_SetInt(file, "Money", GetPlayerMoney(playerid)); ou vocк vai ter que atualizar o Player[playerid][pCash] sempre que o jogador perder ou ganhar dinheiro (porque й desta variavel que ele estб tirando o valor que vai ser salvo).


Re: DOF2 Nгo salva. - DanDRT - 01.11.2013

Quote:
Originally Posted by kreison
Посмотреть сообщение
O Player[playerid][pCash] estб sendo atualizado sempre que o jogador recebe ou ganha determinada quantia de dinheiro? Tenta usar DOF2_SetInt(file, "Money", GetPlayerMoney(playerid)); ou vocк vai ter que atualizar o Player[playerid][pCash] sempre que o jogador perder ou ganhar dinheiro (porque й desta variavel que ele estб tirando o valor que vai ser salvo).
й verdade nгo tinha analisado este detalhe


Re: DOF2 Nгo salva. - Jorge-IN - 01.11.2013

Quote:
Originally Posted by kreison
Посмотреть сообщение
O Player[playerid][pCash] estб sendo atualizado sempre que o jogador ganha ou perde determinada quantia de dinheiro? Tenta usar DOF2_SetInt(file, "Money", GetPlayerMoney(playerid)); ou vocк vai ter que atualizar o Player[playerid][pCash] sempre que o jogador perder ou ganhar dinheiro (porque й desta variavel que ele estб tirando o valor que vai ser salvo).
sу que nгo й so o dinheiro que nгo salva, й tudo, o debug nгo aparece no console, й como se a public OnPlayerSave nгo fosse chamada


Re: DOF2 Nгo salva. - bruxo00 - 01.11.2013

E ela й chamada? Tente chama-la no OnPlayerDisconnect.


Re: DOF2 Nгo salva. - Jorge-IN - 01.11.2013

Quote:
Originally Posted by bruxo00
Посмотреть сообщение
E ela й chamada? Tente chama-la no OnPlayerDisconnect.
Nгo sei, ela jб ta no OnPlayerDisconnect, veja no code... Mais nada й mostrado no console, com o debug :/


Re: DOF2 Nгo salva. - PT - 01.11.2013

podera ser a obter a conta do cara

muda la isto

pawn Код:
new file[128], ptn[MAX_PLAYER_NAME];
GetPlayerName(playerid, ptn, MAX_PLAYER_NAME);
format(file, sizeof(file), "/RPG/users/%s.ini", ptn);



Re: DOF2 Nгo salva. - Jorge-IN - 01.11.2013

Quote:
Originally Posted by PT
Посмотреть сообщение
podera ser a obter a conta do cara

muda la isto

pawn Код:
new file[128], ptn[MAX_PLAYER_NAME];
GetPlayerName(playerid, ptn, MAX_PLAYER_NAME);
format(file, sizeof(file), "/RPG/users/%s.ini", ptn);
nгo resultou,


Re: DOF2 Nгo salva. - bruxo00 - 01.11.2013

Actualiza a include... e retira aquele if(gPlayerLogged[playerid]) para testares.