[Ajuda] Nнvel de Admin nгo grava.
#1

Este й o meu sistema de salvamento, o ъnico problema й que nao salva o nivel de Admin quando desligo e volto a ligar o servidor. alguma ajuda ?
dou +rep.

Aqui estб o enum do Player.

pawn Код:
enum pInfo
{
    Password,
    Cash,
    Kills,
    Deaths,
    Adminlevel
}
new PlayerInfo[MAX_PLAYERS][pInfo];
public OnPlayerDisconnect(playerid)

pawn Код:
{

    new pname[MAX_PLAYER_NAME], string[39 + MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
    switch(reason)
    {
        case 0: format(string, sizeof(string), " %s abandonou o servidor. (perda de sinal)", pname);
        case 1: format(string, sizeof(string), " %s abandonou o servidorr. (saiu por vontade)", pname);
        case 2: format(string, sizeof(string), " %s abandonou o servidor. (Kickado/Banido)", pname);
    }
    SendClientMessageToAll(COLOR_GREY, string);

    new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"data");
    INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
    INI_WriteInt(File,"Kills",PlayerInfo[playerid][Kills]);
    INI_WriteInt(File,"Deaths",PlayerInfo[playerid][Deaths]);
    INI_WriteInt(File,"Adminlevel",PlayerInfo[playerid][Adminlevel]);
    INI_Close(File);
    return 1;
}
public onplayerconnect(playerid)

pawn Код:
{

    new pname[MAX_PLAYER_NAME], string[22 + MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
    format(string, sizeof(string), "%s entrou no servidor.", pname);
    SendClientMessageToAll(COLOR_GREY, string);

    for(new chat = 0; chat <= 100; chat++)
    {
    SendClientMessage(playerid,COLOR_WHITE," ");
    }

    if(fexist(UserPath(playerid)))
    {
        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""#COL_ORANGE":: "#COL_WHITE"Entrada", "\t\t"#COL_EASY"aaaaaaa "#COL_DGREEN"V "#COL_EASY"1\n\n"#COL_WHITEaaaaa, \naaaaaa", "Entrar", "Sair");
    }
    else
    {
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""#COL_ORANGE":: "#COL_WHITE"Registo" , "\t\t"#COL_EASY"aaaaaa"#COL_DGREEN"V "#COL_EASY"1\n\n"#COL_WHITE"aaaaaa, \naaaaaa!", "Registar", "Sair");
    }
    return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])

pawn Код:
{
    switch( dialogid )
    {
        case DIALOG_REGISTER:
        {
            if (!response) return Kick(playerid);
            if(response)
            {
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""#COL_ORANGE":: "#COL_WHITE"aaaa" , "\t\t"#COL_EASY"aaaaa"#COL_DGREEN"V "#COL_EASY"1\n\n"#COL_WHITE"aaaaa, \naaaaa", "Registar", "Sair");
                new INI:File = INI_Open(UserPath(playerid));
                INI_SetTag(File,"data");
                INI_WriteInt(File,"Password",udb_hash(inputtext));
                INI_WriteInt(File,"Cash",0);
                INI_WriteInt(File,"Kills",0);
                INI_WriteInt(File,"Deaths",0);
                INI_WriteInt(File,"Adminlevel",0);
                INI_Close(File);

                SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
                SetTimer("limparchat", 2000, 0);
                SpawnPlayer(playerid);
            }
        }

        case DIALOG_LOGIN:
        {
            if ( !response ) return Kick ( playerid );
            if( response )
            {
                if(udb_hash(inputtext) == PlayerInfo[playerid][Password])
                {
                    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
                    GivePlayerMoney(playerid, PlayerInfo[playerid][Cash]);
                }
                else
                {
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""#COL_ORANGE":: "#COL_WHITE"aaaa", "\t\t"#COL_EASY"aaaaaa"#COL_DGREEN"V "#COL_EASY"1\n\n"#COL_WHITE"aaaaa, \naaaaa!", "Entrar", "Sair");
                }
                return 1;
            }
        }
    }
    return 1;
}
public LoadUser_data(playerid,name[],value[])
pawn Код:
{
    INI_Int("Password",PlayerInfo[playerid][Password]);
    INI_Int("Cash",PlayerInfo[playerid][Cash]);
    INI_Int("Kills",PlayerInfo[playerid][Kills]);
    INI_Int("Deaths",PlayerInfo[playerid][Deaths]);
    INI_Int("AdminLevel",PlayerInfo[playerid][Adminlevel]);
    return 1;
}
COMMAND:makeadmin(playerid, params[])

pawn Код:
{
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,COLOR_RED,".:: You are not authorized to use this command ::.");
    new id, lvl;
    if(sscanf(params, "ui", id, lvl)) return SendClientMessage(playerid, COLOR_WHITE, ""#COL_DGREY"[CMD] / "#COL_SGREY"[PlayerID/PartOfName] [Level]");
    else if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_WHITE, "Invalid ID");
    else if(lvl > 5) return SendClientMessage(playerid, COLOR_WHITE, "Administrator level only can be 5 ");
    else
    {
    PlayerInfo[id][Adminlevel] = lvl;
    }
    return 1;
}
Reply


Messages In This Thread
[Ajuda] Nнvel de Admin nгo grava. - by noobre - 03.09.2011, 22:01
Re: [Ajuda] Nнvel de Admin nгo grava. - by Josma_cmd - 03.09.2011, 22:09
Re: [Ajuda] Nнvel de Admin nгo grava. - by noobre - 03.09.2011, 22:19
Re: [Ajuda] Nнvel de Admin nгo grava. - by rene20 - 03.09.2011, 22:33
Re: [Ajuda] Nнvel de Admin nгo grava. - by noobre - 03.09.2011, 22:52
Re: [Ajuda] Nнvel de Admin nгo grava. - by Dolby - 03.09.2011, 23:02
Re: [Ajuda] Nнvel de Admin nгo grava. - by KingstoN* - 04.09.2011, 00:19
Re: [Ajuda] Nнvel de Admin nгo grava. - by noobre - 04.09.2011, 07:21
Re: [Ajuda] Nнvel de Admin nгo grava. - by StrondA_ - 04.09.2011, 10:46
Re: [Ajuda] Nнvel de Admin nгo grava. - by noobre - 04.09.2011, 10:51

Forum Jump:


Users browsing this thread: 2 Guest(s)