Problem with rescue
#1

Use DOF2 in my gamemode, sometimes more when someone leaves or is kicked from the server the account is reset, and also when the server crashes or restarts ..
Could someone help me to know why the bills are not being saved?

Note: It is not often that are reset, 100%, 50% are reset when restarting the server.

pawn Code:
#define Dialog_Registro    999
#define Dialog_Login       888
OnPlayerConnect
pawn Code:
if(!DOF2_FileExists(ReturnFileUser(playerid))) ShowPlayerDialog(playerid, Dialog_Registro, DIALOG_STYLE_PASSWORD,"-| Bem vindo |-","{CFCFCF}Conta:{FF0000} Nгo registrada\n \n{CFCFCF}Digite uma senha para se registrar:", "Registrar","");
    else if(DOF2_FileExists(ReturnFileUser(playerid))) ShowPlayerDialog(playerid,Dialog_Login,DIALOG_STYLE_PASSWORD,"[Login]", "{CFCFCF}Olб, Seja bem-vindo ao nosso servidor\n \n{CFCFCF}Conta:{00FF00} Registrada\n{CFCFCF}Digite sua senha para logar:", "Logar","");
OnDialogResponse
pawn Code:
if(dialogid == Dialog_Registro) {
        if(response) {
            if(!strlen(inputtext)) return ShowPlayerDialog(playerid,Dialog_Registro,DIALOG_STYLE_INPUT,"Registro","{CFCFCF}Digite uma senha para se registrar","Registrar","");
            if(strlen(inputtext) < 5 || strlen(inputtext) > 15) return ShowPlayerDialog(playerid,Dialog_Registro,DIALOG_STYLE_PASSWORD,"{CFCFCF}Registro","A senha deve ter de 5 a 15 caracteres","Registrar","");
            new string[70];
            format(string,sizeof(string),"Conta registrada com sucesso! Senha: {F6E500}%s", inputtext);
            SendClientMessage(playerid,-1,string);
            DOF2_CreateFile(ReturnFileUser(playerid));
            DOF2_SetString(ReturnFileUser(playerid),"Senha",inputtext);
            GivePlayerMoney(playerid, 10000);
            SetPlayerScore(playerid,10);
            DOF2_SaveFile();
        }
        return 1;
    }
    if(dialogid == Dialog_Login) {
        if(response) {
            if(!strlen(inputtext)) return ShowPlayerDialog(playerid,Dialog_Login,DIALOG_STYLE_INPUT,"Login","{CFCFCF}Digite sua senha","Logar","");
            if(strcmp(inputtext,DOF2_GetString(ReturnFileUser(playerid),"Senha"),true) == 0) {
                GivePlayerMoney(playerid, 1000);
                CarregarPlayer(playerid);
                SendClientMessage(playerid,0x2CB60AAA,"» Logado com sucesso!");
            }
            else {
                if(SenhaErrada[playerid] == 10)
                {
                    SendClientMessage(playerid,0xC5B43AAA,"Voce foi kickado por errar a senha 10 vezes!");
                    Kick(playerid);
                    for(new i = 0; i < MAX_PLAYERS; i++)

                    SalvarPlayer(i);

                }
                else if(SenhaErrada[playerid] < 10) {
                    SenhaErrada[playerid] ++;
                    ShowPlayerDialog(playerid,Dialog_Login,DIALOG_STYLE_INPUT,"Login","{FF0000}Senha incorreta\n{CFCFCF}Se errar 5 vezes serб banido.","Logar","");
                }
            }
        }
        else if(!response) {
            SendClientMessage(playerid,0xC5B43AAA,"Vocк foi kickado por nгo logar");
            SalvarPlayer(playerid);
            Kick(playerid);
        }
        return 1;
    }
pawn Code:
stock SalvarPlayer(playerid)
{
   if(!DOF2_FileExists(ReturnFileUser(playerid))) DOF2_CreateFile(ReturnFileUser(playerid));
    else
    {
        DOF2_SetInt(ReturnFileUser(playerid),"Level",GetPlayerScore(playerid));
        DOF2_SetInt(ReturnFileUser(playerid),"Dinheiro",GetPlayerMoney(playerid));
        DOF2_SetInt(ReturnFileUser(playerid),"Admin Level",PlayerDados[playerid][pAdmin]);
        DOF2_SetInt(ReturnFileUser(playerid),"Skin",GetPlayerSkin(playerid));
        DOF2_SetInt(ReturnFileUser(playerid),"VIP", PlayerDados[playerid][pVIP]);
        DOF2_SaveFile();
    }
}


stock CarregarPlayer(playerid)
{
    if(DOF2_FileExists(ReturnFileUser(playerid))) {
        SetPlayerScore(playerid, DOF2_GetInt(ReturnFileUser(playerid), "Level"));
        SetPlayerMoney(playerid, DOF2_GetInt(ReturnFileUser(playerid), "Dinheiro"));
        PlayerDados[playerid][pAdmin] = DOF2_GetInt(ReturnFileUser(playerid),"Admin Level");
        SetPlayerSkin(playerid, DOF2_GetInt(ReturnFileUser(playerid),"Skin"));
        PlayerDados[playerid][pVIP] = DOF2_GetInt(ReturnFileUser(playerid),"VIP");
    }
}
OnGameModeExit
pawn Code:
SalvarPlayer(playerid);
    DOF2_Exit();
OnPlayerDisconnect
pawn Code:
SalvarPlayer(playerid);
Note: I used ****** translator
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)