SA-MP Forums Archive
Help with rescue system - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help with rescue system (/showthread.php?tid=381754)



Help with rescue system - Tr0jan - 30.09.2012

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.