SA-MP Forums Archive
[Ajuda] Conta nao ta salvando - 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] Conta nao ta salvando (/showthread.php?tid=287601)



[Ajuda] Conta nao ta salvando - gabrielbnv - 03.10.2011

bom galera meu gm tava salvando as contas normalmente e agora nao ta mais, olha aki as linha de salvamento

no OnPlayerDisconnect:

pawn Код:
SavePlayerConfig(playerid);
e as public que salvam e carregam as contas:

pawn Код:
forward SavePlayerConfig(playerid);
public SavePlayerConfig(playerid)
{
    new FilePath[256];
    new pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
    format(FilePath, sizeof(FilePath), "%s%s.ini",UserFiles,pname);
    if(!dini_Exists(FilePath))
    {
    }
    else if(PlayerInfo[playerid][Loged] == 1)
    {
        PlayerInfo[playerid][pMoney] = GetPlayerMoneyEx(playerid);
        dini_Set(FilePath, "Name", PlayerInfo[playerid][pName]);
        dini_IntSet(FilePath, "Level", PlayerInfo[playerid][pLevel]);
        dini_IntSet(FilePath, "Money", GetPlayerMoneyEx(playerid));
        dini_IntSet(FilePath, "Skin", PlayerInfo[playerid][pSkin]);
        dini_IntSet(FilePath, "Respeito", PlayerInfo[playerid][pExp]);
        dini_IntSet(FilePath, "Org", PlayerInfo[playerid][pOrg]);
        dini_IntSet(FilePath, "Lider", PlayerInfo[playerid][pLider]);
        dini_IntSet(FilePath, "Cargo", PlayerInfo[playerid][pCargo]);
        dini_IntSet(FilePath, "Admin", PlayerInfo[playerid][pAdmin]);
        dini_IntSet(FilePath, "Telefone", PlayerInfo[playerid][pPnumber]);
        dini_IntSet(FilePath, "Mutado", PlayerInfo[playerid][pMuted]);
        dini_IntSet(FilePath, "Banco", PlayerInfo[playerid][pBanco]);
        dini_IntSet(FilePath, "HouseKey", PlayerInfo[playerid][HouseKey]);
        dini_IntSet(FilePath, "VHouseKey", PlayerInfo[playerid][VHouseKey]);
        dini_IntSet(FilePath, "SpawnAtHome", PlayerInfo[playerid][SpawnAtHome]);
        dini_IntSet(FilePath, "StoreKey", PlayerInfo[playerid][StoreKey]);
        printf("Conta de %s salva com sucesso.",PlayerInfo[playerid][pName]);
    }
}

forward LoadPlayerConfig(playerid);
public LoadPlayerConfig(playerid)
{
    new FilePath[256];
    new pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
    format(FilePath, sizeof(FilePath), "%s%s.ini",UserFiles,pname);
    if(!dini_Exists(FilePath))
    {
        PlayerInfo[playerid][pMoney] = GetPlayerMoneyEx(playerid);
        dini_Create(FilePath);
        dini_Set(FilePath, "Name", PlayerInfo[playerid][pName]);
        dini_IntSet(FilePath, "Level",1);
        dini_IntSet(FilePath, "Money",0);
        dini_IntSet(FilePath, "Skin", 23);
        dini_IntSet(FilePath, "Respeito", 0);
        dini_IntSet(FilePath, "Org", 0);
        dini_IntSet(FilePath, "Lider", 0);
        dini_IntSet(FilePath, "Cargo", 0);
        dini_IntSet(FilePath, "Admin", 0);
        dini_IntSet(FilePath, "Telefone", 0);
        dini_IntSet(FilePath, "Mutado", 0);
        dini_IntSet(FilePath, "Banco", 0);
        dini_IntSet(FilePath, "HouseKey", 255);
        dini_IntSet(FilePath, "VHouseKey", 255);
        dini_IntSet(FilePath, "SpawnAtHome", 0);
        dini_IntSet(FilePath, "StoreKey", 255);
        GivePlayerMoneyEx(playerid,4000);
        SetPlayerScore(playerid,1);
        printf("Conta de %s criada com sucesso.",PlayerInfo[playerid][pName]);
    }
    else
    {
        ResetPlayerMoneyEx(playerid);
        SetPlayerScore(playerid, dini_Int(FilePath, "Level"));
        PlayerInfo[playerid][pLevel] = dini_Int(FilePath, "Level");
        GivePlayerMoneyEx(playerid,dini_Int(FilePath, "Money"));
        PlayerInfo[playerid][pSkin] = dini_Int(FilePath, "Skin");
        PlayerInfo[playerid][pExp] = dini_Int(FilePath, "Respeito");
        PlayerInfo[playerid][pOrg] = dini_Int(FilePath, "Org");
        PlayerInfo[playerid][pLider] = dini_Int(FilePath, "Lider");
        PlayerInfo[playerid][pCargo] = dini_Int(FilePath, "Cargo");
        PlayerInfo[playerid][pAdmin] = dini_Int(FilePath, "Admin");
        PlayerInfo[playerid][pPnumber] = dini_Int(FilePath, "Telefone");
        PlayerInfo[playerid][pMuted] = dini_Int(FilePath, "Mutado");
        PlayerInfo[playerid][pBanco] = dini_Int(FilePath, "Banco");
        PlayerInfo[playerid][HouseKey] = dini_Int(FilePath, "HouseKey");
        PlayerInfo[playerid][VHouseKey] = dini_Int(FilePath, "VHouseKey");
        PlayerInfo[playerid][SpawnAtHome] = dini_Int(FilePath, "SpawnAtHome");
        PlayerInfo[playerid][StoreKey] = dini_Int(FilePath, "StoreKey");
    }
    return 1;
}



Re: [Ajuda] Conta nao ta salvando - Pharrel - 03.10.2011

pawn Код:
if(!dini_Exists(FilePath))
    {
    }
se nгo existir o arquivo ele nгo faz nada...

nгo ta salvando ou n ta criando as files?


Re: [Ajuda] Conta nao ta salvando - gabrielbnv - 03.10.2011

nao ta salvando qdo eu me desconecto


Re: [Ajuda] Conta nao ta salvando - Pharrel - 03.10.2011

Nгo to vendo nada errado no seu codigo, se vc ta passando em todos os ifs tem q funcionar...

outra coisa, colocou LoadPlayerCondig qdo ele loga/conecta?


Re: [Ajuda] Conta nao ta salvando - gabrielbnv - 03.10.2011

quando eu coloco pra salvar a conta ao spawnar, a conta salva normal. mais qdo no OnPlayerDisconnect nao ta salvando mais