Help with rescue system
#1

I followed a tutorial over not working properly, the file is not being saved in the folder 'Users' and the informations that are saved within the file. 'Ini' not hit with the informations of the game, could someone help me?

Sorry my bad english =x (Translate)

pawn Код:
#include <a_samp>
#include <DOF2>

#define DIALOG_REGISTER 1
#define DIALOG_LOGIN 2

public OnGameModeInit()
{
    SetGameModeText("Blank Script DOF2");
    return 1;
}
enum pInfo
{
    pMatou,
    pMorreu,
    pDinheiro,
    pAdmin
}
new PlayerInfo[MAX_PLAYERS][pInfo];


public OnGameModeExit()
{
    DOF2_Exit();
    return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
    return 1;
}

public OnPlayerConnect(playerid)
{
    new file[64];
    GetPlayerName(playerid,file,sizeof(file));
    format(file,sizeof(file),DOF2_File(file));
    if(DOF2_FileExists(file))
    {
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login","Digite sua senha para logar:\n","Logar","Sair");
    }
    else
    {
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,"Registro","Conta: Nгo registrada\nDigite uma senha para se registrar:","Registrar","Sair");
    }
    return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case DIALOG_REGISTER:
        {
            if(!response) Kick(playerid);
            if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,"Registro","Conta: Nгo registrada\nDigite uma senha para se registrar:","Registrar","Sair");
           
            if(response)
            {
                new file[64];
                GetPlayerName(playerid,file,sizeof(file));
                format(file,sizeof(file),DOF2_File(file));
                DOF2_CreateFile(file, inputtext);
                DOF2_SetInt(file, "Matou",PlayerInfo[playerid][pMatou] = 0);
                DOF2_SetInt(file, "Morreu",PlayerInfo[playerid][pMorreu] = 0);
                DOF2_SetInt(file, "Dinheiro",PlayerInfo[playerid][pDinheiro] = 1000);
                DOF2_SetInt(file, "Admin",PlayerInfo[playerid][pAdmin] = 0);
                DOF2_SaveFile();
            }
        }
        case DIALOG_LOGIN:
        {
            if(!response) Kick(playerid);
            if(response)
            {
                new file[64];
                GetPlayerName(playerid,file,sizeof(file));
                format(file,sizeof(file),DOF2_File(file));
                if(DOF2_FileExists(file))
                {
                    if(DOF2_CheckLogin(file,inputtext))
                    {
                        PlayerInfo[playerid][pMatou] = DOF2_GetInt(file,"Matou");
                        PlayerInfo[playerid][pMorreu] = DOF2_GetInt(file,"Morreu");
                        PlayerInfo[playerid][pDinheiro] = DOF2_GetInt(file,"Dinheiro");
                        PlayerInfo[playerid][pAdmin] = DOF2_GetInt(file,"Admin");
                        return 1;
                    }
                    else
                    {
                        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Registro","Senha incorreta\nDigite sua senha para logar:","Logar","Sair");
                        return 1;
                    }
                }
            }
        }
    }
    return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
    new file[64];
    GetPlayerName(playerid,file,sizeof(file));
    format(file,sizeof(file),DOF2_File(file));
    DOF2_SetInt(file, "Matou",PlayerInfo[playerid][pMatou]);
    DOF2_SetInt(file, "Morreu",PlayerInfo[playerid][pMorreu]);
    DOF2_SetInt(file, "Dinheiro",PlayerInfo[playerid][pDinheiro]);
    DOF2_SetInt(file, "Admin",PlayerInfo[playerid][pAdmin]);
    return 1;
}

public OnPlayerSpawn(playerid)
{
    GivePlayerMoney(playerid, PlayerInfo[playerid][pDinheiro]);
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    PlayerInfo[killerid][pMatou]++;
    PlayerInfo[playerid][pMorreu]++;
    return 1;
}
Why I posted here in the area PT / BR nobody helped me.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)