[Ajuda] BUG - Salvamento
#1

Entгo, й como esta acima, quando eu dou admin a um Player ou a mim mesmo, todo outro player que loga loga como admin o.o .
Tinha parado com Samp a um tempo, agora estou estudando DOF2.
Comecei a olhar o sistema Funeral, e de la tirei minha base, sу que ocorre o Bug citado acima..

pawn Код:
if(strcmp(cmd, "/daradmin", true) ==0 )
    {
        GetPlayerName(playerid, sendername, 256);
        if (Info[playerid][DAdmin] >= 0) //Sу pra mim logar com player sem admin e me auto promover e.e
            {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, CINZA, "USE: /daradmin [ id ] [Level 0 б 4]");
                return true;
            }
            new para1;
            new level;
            para1 = ReturnUser(tmp);
            tmp = strtok(cmdtext, idx);
            level = strval(tmp);
            GetPlayerName(playerid, sendername, 256);
            {
                if(IsPlayerConnected(para1))
                {
                    if(para1 != INVALID_PLAYER_ID)
                    {
                        GetPlayerName(para1, giveplayer, sizeof(giveplayer));
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        Info[para1][DAdmin] = level;
                        printf("%s Promoveu %s a Admin Level %d.", sendername, giveplayer, level);
                        format(string, sizeof(string), "   Voce foi promovido para level  %d de Admin - Por %s", level, sendername);
                        SendClientMessage(para1, AZUL, string);
                        format(string, sizeof(string), "   Voce promoveu o(a) %s Para o level %d de Admin.", giveplayer,level);
                        SendClientMessage(playerid, AZUL, string);
                        format(string, sizeof(string), "%s Promoveu %s a Admin level %d ",sendername,giveplayer,level);
                    }
                }
                SendClientMessage(playerid, VERDE, "{FF0000}[BFG]{FFFFFF}: Voce nгo esta autorizado a usar este comando!");
            }
        }
        return true;
    }
Salvamento:

pawn Код:
stock PlayerArchive(playerid)
{
    new StringArquivo[128], NomeArquivo[24];
    GetPlayerName(playerid, NomeArquivo, sizeof(NomeArquivo));
    format(StringArquivo, sizeof(StringArquivo), ContasSalvas, NomeArquivo);
    return StringArquivo;
}
stock CarregarDados(playerid)
{
    Info[playerid][DAdmin] = DOF2_GetInt(PlayerArchive(playerid), "Administrador");
    GivePlayerMoney(playerid, DOF2_GetInt(PlayerArchive(playerid), "Grana"));
    Info[playerid][PlayerScore] = DOF2_GetInt(PlayerArchive(playerid), "Score");
    Info[playerid][PlayerKills] = DOF2_GetInt(PlayerArchive(playerid), "Kills");
    Info[playerid][PlayerDeaths] = DOF2_GetInt(PlayerArchive(playerid), "Morreu");
    Info[playerid][PlayerVip] = DOF2_GetInt(PlayerArchive(playerid), "Vip");
    Info[playerid][PlayerBanido] = DOF2_GetInt(PlayerArchive(playerid), "Banido");
}

stock SalvarDados(playerid)
{
    DOF2_SetInt(PlayerArchive(playerid), "Grana", GetPlayerMoney(playerid));
    DOF2_SetInt(PlayerArchive(playerid), "Administrador", Info[playerid][DAdmin]);
    DOF2_SetInt(PlayerArchive(playerid), "Score", GetPlayerScore(playerid));
    DOF2_SetInt(PlayerArchive(playerid), "Kills", Info[playerid][PlayerKills]);
    DOF2_SetInt(PlayerArchive(playerid), "Morreu", Info[playerid][PlayerDeaths]);
    DOF2_SetInt(PlayerArchive(playerid), "Vip", Info[playerid][PlayerVip]);
    DOF2_SetInt(PlayerArchive(playerid), "Banido", Info[playerid][PlayerBanido]);
    DOF2_SaveFile();
    return 1;
}
Connect, Disconnect:

pawn Код:
public OnPlayerConnect(playerid)
{
    new i = 0;
    TextDrawShowForPlayer(playerid, Baixo[i]);
    GameTextForPlayer(playerid, "~r~Fuchter ~w~Games~r~4Fun",6000,6);
    if(Info[playerid][PlayerBanido] == 1) return SendClientMessage(playerid, VERMELHO, "Banido do Servidor Temporariбmente, Bye!"), Kick(playerid);
    if(DOF2_FileExists(PlayerArchive(playerid)))
    {
        ShowPlayerDialog(playerid, DLogar, DIALOG_STYLE_INPUT,"Logando no Servidor", "Bem Vindo Novamente\nLogue-se com Sua Senha do Registro","Logar","Cancelar");
    }
    else
    {
        ShowPlayerDialog(playerid, DRegistrar, DIALOG_STYLE_INPUT,"Registrando no Servidor", "Bem Vindo ao Servidor\nDigite sua Senha Abaixo Para Registrar-se","Registrar","Cancelar");
    }
    AddNitro[i][0] = 0;
    GetPlayerName(playerid, NameDoug, sizeof(NameDoug));
    format(SDoug, sizeof(SDoug), "[ID: %d] %s Entrou no Servidor!", playerid, NameDoug);
    SendClientMessageToAll(AMARELO, SDoug);
    return 1;
}

public OnPlayerDisconnect(playerid, reason) {
    new i = 0;
    TextDrawHideForPlayer(playerid, Baixo[i]);
    DOF2_SetInt(PlayerArchive(playerid), "Administrador", Info[playerid][DAdmin]);
    DOF2_SetInt(PlayerArchive(playerid), "Grana", GetPlayerMoney(playerid));
    DOF2_SetInt(PlayerArchive(playerid), "Score", Info[playerid][PlayerScore]);
    DOF2_SetInt(PlayerArchive(playerid), "Kills", Info[playerid][PlayerKills]);
    DOF2_SetInt(PlayerArchive(playerid), "Deaths", Info[playerid][PlayerDeaths]);
    DOF2_SetInt(PlayerArchive(playerid), "Vip", Info[playerid][PlayerVip]);
    DOF2_SaveFile();
    GetPlayerName(playerid, NameDoug, sizeof(NameDoug));
    format(SDoug, sizeof(SDoug), "[ID: %d] %s Saiu do Servidor!", playerid, NameDoug);
    SendClientMessageToAll(AMARELO, SDoug);
    AddNitro[i][0] = 0;
    return 1;
}
Entгo, й isso, Onde esta o erro? '-'
Reply
#2

Aqui esta seu erro
pawn Код:
GetPlayerName(playerid, sendername, 256);
            {
                if(IsPlayerConnected(para1))
                {
                    if(para1 != INVALID_PLAYER_ID)
                    {
                        GetPlayerName(para1, giveplayer, sizeof(giveplayer));
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        Info[para1][DAdmin] = level;
                        printf("%s Promoveu %s a Admin Level %d.", sendername, giveplayer, level);
                        format(string, sizeof(string), "   Voce foi promovido para level  %d de Admin - Por %s", level, sendername);
                        SendClientMessage(para1, AZUL, string);
                        format(string, sizeof(string), "   Voce promoveu o(a) %s Para o level %d de Admin.", giveplayer,level);
                        SendClientMessage(playerid, AZUL, string);
                        format(string, sizeof(string), "%s Promoveu %s a Admin level %d ",sendername,giveplayer,level);
                    }
                }
Reply
#3


Poderia me explicar o que foi que eu errei?
Reply
#4

Ninguйm?
Preciso disso :\
Reply
#5

Nгo devia resetar o admin na hora de se conectar/sair?
Exemplo :

pawn Код:
public OnPlayerDisconnect(playerid)
{
   Info[para1][DAdmin] = 0;
   return 0;
}
Ai no OnPlayerConnect,so coloca para Carrega-lo.
Reply
#6

Deu certo.
Fiz algo diferente, antes de carregar os dados, usei o
Info[playerid][DAdmin] = 0; para setar 0, isso й prejudicial?
Levou meu Rep @Riichard ;
Reply
#7

Quote:
Originally Posted by DouglasRodrigues
Посмотреть сообщение
Deu certo.
Fiz algo diferente, antes de carregar os dados, usei o
Info[playerid][DAdmin] = 0; para setar 0, isso й prejudicial?
Levou meu Rep @Riichard ;
Nгo.
Quando ele conectar irб setar o admin para level 0. Ai os status serгo carregados. Se foi salvo como admin, irб setar o level. ^^
E como eu faзo :]

Obrigado .

This forum requires that you wait 120 seconds between posts. Please try again in 55 seconds.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)