[Ajuda] Conta
#1

Уla galera do forum sa-mp .

Vim pedir ajuda num troso que esta tenso de mais, nгo consigo resolver,
quando o player registra ele ganhas as coisa mas no arquivo dele nгo salva nada nada msm
o arquivo fica zero como esta na foto.


Code \/
pawn Код:
if(dialogid == DIALOG_REGISTRO)
    {
        if(response)
        {
            if(!strlen(inputtext))
            {
                GetPlayerName(playerid, Nome, sizeof(Nome));
                format(String, sizeof(String), "{FFFFFF}Seja Bem Vindo ao Advanced PlayHard RP, Sr.{01FCFF}%s{FFFFFF} vocк nгo esta Registrado \npois й sua primeira vez, digite uma senha para efutar o registro(utilize senhas confiveis):", Nome);
                ShowPlayerDialog(playerid, DIALOG_REGISTRO, DIALOG_STYLE_PASSWORD, "Advanced PlayHard RP", String, "Registrar", "Cancelar");
                SendClientMessage(playerid,0x1E90FFAA,"Senha incorreta !!");
                return 1;
            }
            GetPlayerName(playerid, Nome, sizeof(Nome));
            format(String, sizeof(String), "Contas/%s.ini", Nome); DOF2_CreateFile(String);
            DOF2_SetString(String,"Senha",inputtext);

            DOF2_SetInt(String,"Dinheiro",1000);
            DOF2_SetInt(String,"Score",1);

            TitoInfo[playerid][pBank] = 50;
            TitoInfo[playerid][pAdmin] = 0;
            TitoInfo[playerid][pJob] = 0;
            TitoInfo[playerid][pTut] = false;
            TitoInfo[playerid][pCash] = 0;
            TitoInfo[playerid][pRespeito] = 0;
            TitoInfo[playerid][Empresa] = false;
            TitoInfo[playerid][pAviso] = 0;
            TitoInfo[playerid][Indentidade] = false;
            TitoInfo[playerid][pDrogas] = 0;
            TitoInfo[playerid][pDinamite] = 0;
            SalvarConta(playerid);
            format(String, sizeof(String),"{FFFFFF}Seja Bem Vindo ao Advanced PlayHard RP, sua Conta e Registrada\nConta {01FCFF}%s{FFFFFF}, Digite sua senha para efutar o login:", Nome);
            ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Advanced PlayHard RP", String, "Logar", "Cancelar");
            return 1;
        }
        else
        {
            SendClientMessage(playerid, 0xFF0000AA, "Voce Foi Kickado Por mau_tito||Motivo:Nгo quer se registrar");
            Kick(playerid);
            return 1;
        }
    }
    if(dialogid == DIALOG_LOGIN)
    {
        if(response)
        {
            if(!strlen(inputtext))
            {
                GetPlayerName(playerid, Nome, sizeof(Nome));
                format(String, sizeof(String),"{FFFFFF}Seja Bem Vindo ao Advanced PlayHard RP, sua Conta e Registrada\nConta {01FCFF}%s{FFFFFF}, Digite sua senha para efutar o login:", Nome);
                ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Advanced PlayHard RP", String, "Logar", "Cancelar");
                SendClientMessage(playerid,0x1E90FFAA,"Senha Incorreta !");
                return 1;
            }
            GetPlayerName(playerid, Nome, sizeof(Nome));
            format(String, sizeof(String), "Contas/%s.ini", Nome);
            if(!strcmp(inputtext,DOF2_GetString(String,"Senha"),false))
            {
                CarregarPlayer(playerid);
                TotalLogou[playerid]++;
                format(String,sizeof(String),"~g~Seja Bem Vindo~n~ ~y~ %s", Nome);
                GameTextForPlayer(playerid, String, 2000, 1);
                SpawnPlayer(playerid);
                return 1;
            }
            else
            {
                SendClientMessage(playerid,0x00FF00AA,"Senha incorreta digite-a novamente");
                format(String, sizeof(String),"{FFFFFF}Seja Bem Vindo ao Advanced PlayHard RP, sua Conta e Registrada\nConta {01FCFF}%s{FFFFFF}, Digite sua senha para efutar o login:", Nome);
                ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Advanced PlayHard RP", String, "Logar", "Cancelar");
            }
            return 1;
        }
        else
        {
            SendClientMessage(playerid, 0xFF0000AA, "Voce Foi Kickado Por mau_tito||Motivo:Nгo quer logar");
            Kick(playerid);
            return 1;
        }
    }
    stock SalvarConta(playerid)
{
    GetPlayerName(playerid, Nome, sizeof(Nome));
    format(String, sizeof(String), "Contas/%s.ini", Nome);
    if(!DOF2_FileExists(String))
    {
       DOF2_SetInt(String,  "Dinheiro", GetPlayerMoney(playerid));
       DOF2_SetInt(String,  "Score",    GetPlayerScore(playerid));
       DOF2_SetInt(String,  "Banco",    TitoInfo[playerid][pBank]);
       DOF2_SetInt(String,  "Score",    GetPlayerScore(playerid));
       DOF2_SetInt(String,  "AdiminLevel", TitoInfo[playerid][pAdmin]);
       DOF2_SetInt(String,  "Emprego",   TitoInfo[playerid][pJob]);
       DOF2_SetBool(String, "Tutorial", TitoInfo[playerid][pTut]);
       DOF2_SetInt(String,  "Cash", TitoInfo[playerid][pCash]);
       DOF2_SetInt(String,  "Respeito", TitoInfo[playerid][pRespeito]);
       DOF2_SetBool(String, "Empresa", TitoInfo[playerid][Empresa]);
       DOF2_SetInt(String,  "Aviso", TitoInfo[playerid][pAviso]);
       DOF2_SetInt(String,  "Skin", GetPlayerSkin(playerid));
       DOF2_SetBool(String, "Indentidade", TitoInfo[playerid][Indentidade]);
       DOF2_SetInt(String,  "Drogas", TitoInfo[playerid][pDrogas]);
       DOF2_SetInt(String,  "Dinamite", TitoInfo[playerid][pDinamite]);
       DOF2_SetInt(String,  "Total Matou", TotalMatou[playerid]);
       DOF2_SetInt(String,  "Total Morreu", TotalMorreu[playerid]);
       DOF2_SetInt(String,  "Total Logou", TotalLogou[playerid]);
    }
    return 1;
}

stock CarregarPlayer(playerid)
{
    GetPlayerName(playerid, Nome, sizeof(Nome));
    format(String, sizeof(String), "Contas/%s.ini", Nome);
    if(DOF2_FileExists(String))
    {
       GivePlayerMoney(playerid, DOF2_GetInt(String,"Dinheiro"));
       TitoInfo[playerid][pBank] = DOF2_GetInt(String,           "Banco");
       SetPlayerScore(playerid, DOF2_GetInt(String,          "Score"));
       TitoInfo[playerid][pAdmin] = DOF2_GetInt(String,    "AdiminLevel");
       TitoInfo[playerid][pJob] = DOF2_GetInt(String,          "Emprego");
       TitoInfo[playerid][pTut] = DOF2_GetBool(String,         "Tutorial");
       TitoInfo[playerid][pCash] = DOF2_GetInt(String,            "Cash");
       TitoInfo[playerid][pRespeito] = DOF2_GetInt(String,    "Respeito");
       TitoInfo[playerid][pAviso] = DOF2_GetInt(String,          "Aviso");
       TitoInfo[playerid][pSkin] =  DOF2_GetInt(String,  "Skin");
       TitoInfo[playerid][Empresa] = DOF2_GetBool(String,  "Empresa");
       TitoInfo[playerid][Indentidade] = DOF2_GetBool(String,  "Indentidade");
       TitoInfo[playerid][pDrogas] = DOF2_GetBool(String,  "Drogas");
       TitoInfo[playerid][pDinamite] = DOF2_GetInt(String,  "Dinamite");
       TotalMatou[playerid] = DOF2_GetInt(String, "Total Matou");
       TotalMorreu[playerid] = DOF2_GetInt(String, "Total Morreu");
       TotalLogou[playerid] = DOF2_GetInt(String, "Total Logou");
    }
    return 1;
}
Reply
#2

pawn Код:
if(dialogid == DIALOG_REGISTRO)
    {
        if(response)
        {
            if(!strlen(inputtext))
            {
                GetPlayerName(playerid, Nome, sizeof(Nome));
                format(String, sizeof(String), "{FFFFFF}Seja Bem Vindo ao Advanced PlayHard RP, Sr.{01FCFF}%s{FFFFFF} vocк nгo esta Registrado \npois й sua primeira vez, digite uma senha para efutar o registro(utilize senhas confiveis):", Nome);
                ShowPlayerDialog(playerid, DIALOG_REGISTRO, DIALOG_STYLE_PASSWORD, "Advanced PlayHard RP", String, "Registrar", "Cancelar");
                SendClientMessage(playerid,0x1E90FFAA,"Senha incorreta !!");
                return 1;
            }
            GetPlayerName(playerid, Nome, sizeof(Nome));
            format(String, sizeof(String), "Contas/%s.ini", Nome); DOF2_CreateFile(String);
            DOF2_SetString(String,"Senha",inputtext);

            DOF2_SetInt(String,"Dinheiro",1000);
            DOF2_SetInt(String,"Score",1);
            DOF2_SaveFile();
            TitoInfo[playerid][pBank] = 50;
            TitoInfo[playerid][pAdmin] = 0;
            TitoInfo[playerid][pJob] = 0;
            TitoInfo[playerid][pTut] = false;
            TitoInfo[playerid][pCash] = 0;
            TitoInfo[playerid][pRespeito] = 0;
            TitoInfo[playerid][Empresa] = false;
            TitoInfo[playerid][pAviso] = 0;
            TitoInfo[playerid][Indentidade] = false;
            TitoInfo[playerid][pDrogas] = 0;
            TitoInfo[playerid][pDinamite] = 0;
            SalvarConta(playerid);
            format(String, sizeof(String),"{FFFFFF}Seja Bem Vindo ao Advanced PlayHard RP, sua Conta e Registrada\nConta {01FCFF}%s{FFFFFF}, Digite sua senha para efutar o login:", Nome);
            ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Advanced PlayHard RP", String, "Logar", "Cancelar");
            return 1;
        }
        else
        {
            SendClientMessage(playerid, 0xFF0000AA, "Voce Foi Kickado Por mau_tito||Motivo:Nгo quer se registrar");
            Kick(playerid);
            return 1;
        }
    }
    if(dialogid == DIALOG_LOGIN)
    {
        if(response)
        {
            if(!strlen(inputtext))
            {
                GetPlayerName(playerid, Nome, sizeof(Nome));
                format(String, sizeof(String),"{FFFFFF}Seja Bem Vindo ao Advanced PlayHard RP, sua Conta e Registrada\nConta {01FCFF}%s{FFFFFF}, Digite sua senha para efutar o login:", Nome);
                ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Advanced PlayHard RP", String, "Logar", "Cancelar");
                SendClientMessage(playerid,0x1E90FFAA,"Senha Incorreta !");
                return 1;
            }
            GetPlayerName(playerid, Nome, sizeof(Nome));
            format(String, sizeof(String), "Contas/%s.ini", Nome);
            if(!strcmp(inputtext,DOF2_GetString(String,"Senha"),false))
            {
                CarregarPlayer(playerid);
                TotalLogou[playerid]++;
                format(String,sizeof(String),"~g~Seja Bem Vindo~n~ ~y~ %s", Nome);
                GameTextForPlayer(playerid, String, 2000, 1);
                SpawnPlayer(playerid);
                return 1;
            }
            else
            {
                SendClientMessage(playerid,0x00FF00AA,"Senha incorreta digite-a novamente");
                format(String, sizeof(String),"{FFFFFF}Seja Bem Vindo ao Advanced PlayHard RP, sua Conta e Registrada\nConta {01FCFF}%s{FFFFFF}, Digite sua senha para efutar o login:", Nome);
                ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Advanced PlayHard RP", String, "Logar", "Cancelar");
            }
            return 1;
        }
        else
        {
            SendClientMessage(playerid, 0xFF0000AA, "Voce Foi Kickado Por mau_tito||Motivo:Nгo quer logar");
            Kick(playerid);
            return 1;
        }
    }
    stock SalvarConta(playerid)
{
    GetPlayerName(playerid, Nome, sizeof(Nome));
    format(String, sizeof(String), "Contas/%s.ini", Nome);
    if(!DOF2_FileExists(String))
    {
       DOF2_SetInt(String,  "Dinheiro", GetPlayerMoney(playerid));
       DOF2_SetInt(String,  "Score",    GetPlayerScore(playerid));
       DOF2_SetInt(String,  "Banco",    TitoInfo[playerid][pBank]);
       DOF2_SetInt(String,  "Score",    GetPlayerScore(playerid));
       DOF2_SetInt(String,  "AdiminLevel", TitoInfo[playerid][pAdmin]);
       DOF2_SetInt(String,  "Emprego",   TitoInfo[playerid][pJob]);
       DOF2_SetBool(String, "Tutorial", TitoInfo[playerid][pTut]);
       DOF2_SetInt(String,  "Cash", TitoInfo[playerid][pCash]);
       DOF2_SetInt(String,  "Respeito", TitoInfo[playerid][pRespeito]);
       DOF2_SetBool(String, "Empresa", TitoInfo[playerid][Empresa]);
       DOF2_SetInt(String,  "Aviso", TitoInfo[playerid][pAviso]);
       DOF2_SetInt(String,  "Skin", GetPlayerSkin(playerid));
       DOF2_SetBool(String, "Indentidade", TitoInfo[playerid][Indentidade]);
       DOF2_SetInt(String,  "Drogas", TitoInfo[playerid][pDrogas]);
       DOF2_SetInt(String,  "Dinamite", TitoInfo[playerid][pDinamite]);
       DOF2_SetInt(String,  "Total Matou", TotalMatou[playerid]);
       DOF2_SetInt(String,  "Total Morreu", TotalMorreu[playerid]);
       DOF2_SetInt(String,  "Total Logou", TotalLogou[playerid]);
       DOF2_SaveFile();
    }
    return 1;
}

stock CarregarPlayer(playerid)
{
    GetPlayerName(playerid, Nome, sizeof(Nome));
    format(String, sizeof(String), "Contas/%s.ini", Nome);
    if(DOF2_FileExists(String))
    {
       GivePlayerMoney(playerid, DOF2_GetInt(String,"Dinheiro"));
       TitoInfo[playerid][pBank] = DOF2_GetInt(String,           "Banco");
       SetPlayerScore(playerid, DOF2_GetInt(String,          "Score"));
       TitoInfo[playerid][pAdmin] = DOF2_GetInt(String,    "AdiminLevel");
       TitoInfo[playerid][pJob] = DOF2_GetInt(String,          "Emprego");
       TitoInfo[playerid][pTut] = DOF2_GetBool(String,         "Tutorial");
       TitoInfo[playerid][pCash] = DOF2_GetInt(String,            "Cash");
       TitoInfo[playerid][pRespeito] = DOF2_GetInt(String,    "Respeito");
       TitoInfo[playerid][pAviso] = DOF2_GetInt(String,          "Aviso");
       TitoInfo[playerid][pSkin] =  DOF2_GetInt(String,  "Skin");
       TitoInfo[playerid][Empresa] = DOF2_GetBool(String,  "Empresa");
       TitoInfo[playerid][Indentidade] = DOF2_GetBool(String,  "Indentidade");
       TitoInfo[playerid][pDrogas] = DOF2_GetBool(String,  "Drogas");
       TitoInfo[playerid][pDinamite] = DOF2_GetInt(String,  "Dinamite");
       TotalMatou[playerid] = DOF2_GetInt(String, "Total Matou");
       TotalMorreu[playerid] = DOF2_GetInt(String, "Total Morreu");
       TotalLogou[playerid] = DOF2_GetInt(String, "Total Logou");
    }
    return 1;
}
Depois de setar tudo que tiver pra setar no arquivo, vocк utiliza DOF2_SaveFile(); para salvar
Reply
#3

Ae Vlw ja me ajudo arrumar um outro bug junto com esse vlwґs +REP.
Reply
#4

Quote:
Originally Posted by mau.tito
Посмотреть сообщение
Ae Vlw ja me ajudo arrumar um outro bug junto com esse vlwґs +REP.
Nada Vlw pelo REP *-*
Reply
#5

pawn Код:
stock SalvarConta(playerid)
{
    GetPlayerName(playerid, Nome, sizeof(Nome));
    format(String, sizeof(String), "Contas/%s.ini", Nome);
    if(DOF2_FileExists(String))
    {
       DOF2_SetInt(String,  "Dinheiro", GetPlayerMoney(playerid));
       DOF2_SetInt(String,  "Score",    GetPlayerScore(playerid));
       DOF2_SetInt(String,  "Banco",    TitoInfo[playerid][pBank]);
       DOF2_SetInt(String,  "Score",    GetPlayerScore(playerid));
       DOF2_SetInt(String,  "AdiminLevel", TitoInfo[playerid][pAdmin]);
       DOF2_SetInt(String,  "Emprego",   TitoInfo[playerid][pJob]);
       DOF2_SetBool(String, "Tutorial", TitoInfo[playerid][pTut]);
       DOF2_SetInt(String,  "Cash", TitoInfo[playerid][pCash]);
       DOF2_SetInt(String,  "Respeito", TitoInfo[playerid][pRespeito]);
       DOF2_SetBool(String, "Empresa", TitoInfo[playerid][Empresa]);
       DOF2_SetInt(String,  "Aviso", TitoInfo[playerid][pAviso]);
       DOF2_SetInt(String,  "Skin", GetPlayerSkin(playerid));
       DOF2_SetBool(String, "Indentidade", TitoInfo[playerid][Indentidade]);
       DOF2_SetInt(String,  "Drogas", TitoInfo[playerid][pDrogas]);
       DOF2_SetInt(String,  "Dinamite", TitoInfo[playerid][pDinamite]);
       DOF2_SetInt(String,  "Total Matou", TotalMatou[playerid]);
       DOF2_SetInt(String,  "Total Morreu", TotalMorreu[playerid]);
       DOF2_SetInt(String,  "Total Logou", TotalLogou[playerid]);
    }
    return 1;
}
Vocк tinha posto pra escrever caso o arquivo nгo exista. LOL
Reply
#6

Quote:
Originally Posted by Pedro_Miranda
Посмотреть сообщение
pawn Код:
stock SalvarConta(playerid)
{
    GetPlayerName(playerid, Nome, sizeof(Nome));
    format(String, sizeof(String), "Contas/%s.ini", Nome);
    if(DOF2_FileExists(String))
    {
       DOF2_SetInt(String,  "Dinheiro", GetPlayerMoney(playerid));
       DOF2_SetInt(String,  "Score",    GetPlayerScore(playerid));
       DOF2_SetInt(String,  "Banco",    TitoInfo[playerid][pBank]);
       DOF2_SetInt(String,  "Score",    GetPlayerScore(playerid));
       DOF2_SetInt(String,  "AdiminLevel", TitoInfo[playerid][pAdmin]);
       DOF2_SetInt(String,  "Emprego",   TitoInfo[playerid][pJob]);
       DOF2_SetBool(String, "Tutorial", TitoInfo[playerid][pTut]);
       DOF2_SetInt(String,  "Cash", TitoInfo[playerid][pCash]);
       DOF2_SetInt(String,  "Respeito", TitoInfo[playerid][pRespeito]);
       DOF2_SetBool(String, "Empresa", TitoInfo[playerid][Empresa]);
       DOF2_SetInt(String,  "Aviso", TitoInfo[playerid][pAviso]);
       DOF2_SetInt(String,  "Skin", GetPlayerSkin(playerid));
       DOF2_SetBool(String, "Indentidade", TitoInfo[playerid][Indentidade]);
       DOF2_SetInt(String,  "Drogas", TitoInfo[playerid][pDrogas]);
       DOF2_SetInt(String,  "Dinamite", TitoInfo[playerid][pDinamite]);
       DOF2_SetInt(String,  "Total Matou", TotalMatou[playerid]);
       DOF2_SetInt(String,  "Total Morreu", TotalMorreu[playerid]);
       DOF2_SetInt(String,  "Total Logou", TotalLogou[playerid]);
    }
    return 1;
}
Vocк tinha posto pra escrever caso o arquivo nгo exista. LOL
Verdade, nem vi. Se eu tivesse visto eu teria corrigido pra ele.


mau.tito troque o
pawn Код:
if(!DOF2_FileExists(String))
Para
pawn Код:
if(DOF2_FileExists(String))
Na stock de salvar, senгo sу vai setar se o arquivo NГO existir. E nгo tem como setar algo num arquivo que nгo existe! rsrs :P
Reply
#7

Ok..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)