SA-MP Forums Archive
[Ajuda] Level = Score - 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] Level = Score (/showthread.php?tid=378236)



Level = Score - Rhayziin - 16.09.2012

E aew Povos e Povas o/, tipo, eu queria que quando eu ganhasse de level, tambйm ganhar em score, ou seja, se minha variavel de Level tiver 1, quando a pessoa apertar TAB vai ver 1 de score lб!

Eu fiz assim:
pawn Код:
stock SalvarConta(playerid)
{
    new arquivo[50], playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername, sizeof(playername));
    format(arquivo, sizeof(arquivo), "BrazukaRPG/Contas/%s.txt", playername);
    if(DOF2_FileExists(arquivo))
    {
        DOF2_SetInt(arquivo, "Admin", Info[playerid][zAdmin]);
        DOF2_SetInt(arquivo, "Profissao", Profissao[playerid]);
        Info[playerid][zLevel] = GetPlayerScore(playerid);
        DOF2_SetInt(arquivo, "Level", Info[playerid][zLevel]);
        DOF2_SetInt(arquivo, "Respeito", Info[playerid][zRespeito]);
        Info[playerid][zDinheiro] = GetPlayerMoney(playerid);
        DOF2_SetInt(arquivo, "Dinheiro", Info[playerid][zDinheiro]);
    }
    else
    {
        DOF2_CreateFile(arquivo);
        DOF2_SetInt(arquivo, "Admin", Info[playerid][zAdmin]);
        DOF2_SetInt(arquivo, "Profissao", Profissao[playerid]);
        Info[playerid][zLevel] = GetPlayerScore(playerid);
        DOF2_SetInt(arquivo, "Level", Info[playerid][zLevel]);
        DOF2_SetInt(arquivo, "Respeito", Info[playerid][zRespeito]);
        Info[playerid][zDinheiro] = GetPlayerMoney(playerid);
        DOF2_SetInt(arquivo, "Dinheiro", Info[playerid][zDinheiro]);
    }
    return 1;
}

stock CarregarConta(playerid)
{
    new arquivo[50], playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername, sizeof(playername));
    format(arquivo, sizeof(arquivo), "BrazukaRPG/Contas/%s.txt", playername);
    Info[playerid][zAdmin] = DOF2_GetInt(arquivo, "Admin");
    Info[playerid][zRespeito] = DOF2_GetInt(arquivo, "Respeito");
    SetPlayerScore(playerid, GetPlayerScore(Info[playerid][zLevel]));
    Info[playerid][zLevel] = DOF2_GetInt(arquivo, "Level");
    Info[playerid][zDinheiro] = DOF2_GetInt(arquivo, "Dinheiro");
    GivePlayerMoney(playerid, Info[playerid][zDinheiro]);
    Profissao[playerid] = DOF2_GetInt(arquivo, "Profissao");
    return 1;
}
Mas sу que quando eu entro, sempre fica 0 o escore e o level!

Alguem ajuda ae o/


Re: Level = Score - mau.tito - 16.09.2012

Tenta ae
pawn Код:
stock SalvarConta(playerid)
{
    new arquivo[50], playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername, sizeof(playername));
    format(arquivo, sizeof(arquivo), "BrazukaRPG/Contas/%s.txt", playername);
    if(DOF2_FileExists(arquivo))
    {
        DOF2_SetInt(arquivo, "Admin", Info[playerid][zAdmin]);
        DOF2_SetInt(arquivo, "Profissao", Profissao[playerid]);
        DOF2_SetInt(String,  "Score", GetPlayerScore(playerid));
        DOF2_SetInt(arquivo, "Respeito", Info[playerid][zRespeito]);
        Info[playerid][zDinheiro] = GetPlayerMoney(playerid);
        DOF2_SetInt(arquivo, "Dinheiro", Info[playerid][zDinheiro]);
    }
    else
    {
        DOF2_CreateFile(arquivo);
        DOF2_SetInt(arquivo, "Admin", Info[playerid][zAdmin]);
        DOF2_SetInt(arquivo, "Profissao", Profissao[playerid]);
        DOF2_SetInt(String,  "Score", GetPlayerScore(playerid));
        DOF2_SetInt(arquivo, "Respeito", Info[playerid][zRespeito]);
        Info[playerid][zDinheiro] = GetPlayerMoney(playerid);
        DOF2_SetInt(arquivo, "Dinheiro", Info[playerid][zDinheiro]);
    }
    return 1;
}

stock CarregarConta(playerid)
{
    new arquivo[50], playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername, sizeof(playername));
    format(arquivo, sizeof(arquivo), "BrazukaRPG/Contas/%s.txt", playername);
    Info[playerid][zAdmin] = DOF2_GetInt(arquivo, "Admin");
    Info[playerid][zRespeito] = DOF2_GetInt(arquivo, "Respeito");
    Info[playerid][pScore] = DOF2_GetInt(String,          "Score");
    Info[playerid][zDinheiro] = DOF2_GetInt(arquivo, "Dinheiro");
    GivePlayerMoney(playerid, Info[playerid][zDinheiro]);
    Profissao[playerid] = DOF2_GetInt(arquivo, "Profissao");
    return 1;
}



Re: Level = Score - Rhayziin - 16.09.2012

Quote:
Originally Posted by mau.tito
Посмотреть сообщение
Tenta ae
pawn Код:
stock SalvarConta(playerid)
{
    new arquivo[50], playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername, sizeof(playername));
    format(arquivo, sizeof(arquivo), "BrazukaRPG/Contas/%s.txt", playername);
    if(DOF2_FileExists(arquivo))
    {
        DOF2_SetInt(arquivo, "Admin", Info[playerid][zAdmin]);
        DOF2_SetInt(arquivo, "Profissao", Profissao[playerid]);
        DOF2_SetInt(String,  "Score", GetPlayerScore(playerid));
        DOF2_SetInt(arquivo, "Respeito", Info[playerid][zRespeito]);
        Info[playerid][zDinheiro] = GetPlayerMoney(playerid);
        DOF2_SetInt(arquivo, "Dinheiro", Info[playerid][zDinheiro]);
    }
    else
    {
        DOF2_CreateFile(arquivo);
        DOF2_SetInt(arquivo, "Admin", Info[playerid][zAdmin]);
        DOF2_SetInt(arquivo, "Profissao", Profissao[playerid]);
        DOF2_SetInt(String,  "Score", GetPlayerScore(playerid));
        DOF2_SetInt(arquivo, "Respeito", Info[playerid][zRespeito]);
        Info[playerid][zDinheiro] = GetPlayerMoney(playerid);
        DOF2_SetInt(arquivo, "Dinheiro", Info[playerid][zDinheiro]);
    }
    return 1;
}

stock CarregarConta(playerid)
{
    new arquivo[50], playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername, sizeof(playername));
    format(arquivo, sizeof(arquivo), "BrazukaRPG/Contas/%s.txt", playername);
    Info[playerid][zAdmin] = DOF2_GetInt(arquivo, "Admin");
    Info[playerid][zRespeito] = DOF2_GetInt(arquivo, "Respeito");
    Info[playerid][pScore] = DOF2_GetInt(String,          "Score");
    Info[playerid][zDinheiro] = DOF2_GetInt(arquivo, "Dinheiro");
    GivePlayerMoney(playerid, Info[playerid][zDinheiro]);
    Profissao[playerid] = DOF2_GetInt(arquivo, "Profissao");
    return 1;
}
Fumou oq meu fi?
pawn Код:
Info[playerid][pScore] = DOF2_GetInt(String,          "Score");
Que isso? lol


Re: Level = Score - mau.tito - 16.09.2012

e So troca pra zLevel ¬¬


Re: Level = Score - Victor' - 16.09.2012

pawn Код:
//OnPlayerUpdate
SetPlayerScore(playerid, Info[playerid][zLevel]);