[Ajuda] carregamento
#10

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

#define DIALOG_REGISTRO  1
#define DIALOG_LOGIN     2

enum pInfo
{
     pScore,
     pDinheiro,
     pBank,
     pAdmin,
     pJob,
     bool:pTut,
     pCash,
     pRespeito,
     bool:Empresa,
     bool:Indentidade,
     pAviso,
     pSkin,
     pDrogas,
     pDinamite,
     pVida,
     pColete
}
new TitoInfo[MAX_PLAYERS][pInfo];
public OnPlayerConnect(playerid)
{
    new String[500];
    GetPlayerName(playerid, Nome,sizeof(Nome));
    format(String, sizeof(String), "Contas/%s.ini", Nome);
    if(!DOF2_FileExists(String))
    {
        format(String, sizeof(String), "{FFFFFF}Seja Bem Vindo ao Servidor, 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, "Servidor", String, "Registrar", "Cancelar");
    }
    else
    {
        format(String, sizeof(String),"{FFFFFF}Seja Bem Vindo ao Servidor, sua Conta e Registrada\nConta {01FCFF}%s{FFFFFF}, Digite sua senha para efutar o login:", Nome);
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Servidor", String, "Logar", "Cancelar");
    }
    return true;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
   if(dialogid == DIALOG_REGISTRO)
   {
     if(response)
     {
        if(!strlen(inputtext))
        {
            new String[1000];
            GetPlayerName(playerid, Nome,sizeof(Nome));
            format(String, sizeof(String), "{FFFFFF}Seja Bem Vindo ao Servidor, 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, "Servidor", String, "Registrar", "Cancelar");
            SendClientMessage(playerid,0x1E90FFAA,"Senha incorreta !!");
            return 1;
        }
        new String[700];
        GetPlayerName(playerid, Nome,sizeof(Nome));
        format(String, sizeof(String), "Contas/%s.ini", Nome);
        DOF2_CreateFile(String);
        DOF2_SetString(String, "Senha", inputtext);
        GivePlayerMoney(playerid, 1000);
        TitoInfo[playerid][pDinheiro] = 1000;
        TitoInfo[playerid][pAdmin] = 0;
        TitoInfo[playerid][pScore] = 1;
        SetPlayerScore(playerid, 1);
        TitoInfo[playerid][pAviso] = 0;
        TitoInfo[playerid][pTut] = false;
        TitoInfo[playerid][Empresa] = false;
        SalvarConta(playerid);
        SpawnPlayer(playerid);
        format(String,sizeof(String),"Hello %s, you just desired record is level 1 & won $1000 in cash.",Nome);
        SendClientMessage(playerid, -1, String);
        format(String, sizeof(String),"{FFFFFF}Seja Bem Vindo ao Servidor, sua Conta e Registrada\nConta {01FCFF}%s{FFFFFF}, Digite sua senha para efutar o login:", Nome);
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Servidor", String, "Logar", "Cancelar");
        return 1;
     }
     else
     {
        SendClientMessage(playerid, 0xFF0000AA, "Voce Foi Kickado!");
        Kick(playerid);
        return 1;
     }
   }
   if(dialogid == DIALOG_LOGIN)
   {
     if(response)
     {
        if(!strlen(inputtext))
        {
            new String[1000];
            GetPlayerName(playerid, Nome,sizeof(Nome));
            format(String, sizeof(String),"{FFFFFF}Seja Bem Vindo ao Servidor, sua Conta e Registrada\nConta {01FCFF}%s{FFFFFF}, Digite sua senha para efutar o login:", Nome);
            ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Servidor", String, "Logar", "Cancelar");
            SendClientMessage(playerid,0x1E90FFAA,"Senha Incorreta !");
            return 1;
        }
        new String[1000], str[200];
        GetPlayerName(playerid, Nome,sizeof(Nome));
        format(String, sizeof(String), "Contas/%s.ini", Nome);
        if(strcmp((inputtext), DOF2_GetString(String,"Senha"), true) == 0)
        {
            CarregarConta(playerid);
            SpawnPlayer(playerid);
            SendClientMessage(playerid, -1,"|---------------------------------------------------|");
            format(str,sizeof(str),"Seja Bem Vindo , %s .", Nome);
            SendClientMessage(playerid, -1, str);
            SendClientMessage(playerid, -1,"Servidor");
            SendClientMessage(playerid, -1,"|----------------------------------------------------|");
            format(str,sizeof(str),"~g~Seja Bem Vindo~n~ ~y~ %s", Nome);
            GameTextForPlayer(playerid, str, 2000, 1);
        }
        return 1;
     }
     else
     {
        SendClientMessage(playerid, 0xFF0000AA, "Voce Foi Kickado!");
        Kick(playerid);
        return 1;
     }
   }
   return true;
}
stock SalvarConta(playerid)
{
    new String[99];
    GetPlayerName(playerid, Nome,sizeof(Nome));
    format(String, sizeof(String), "Contas/%s.ini", Nome);

    DOF2_SetInt(String,  "Dinheiro", GetPlayerMoney(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_SaveFile();
    return 1;
}
stock CarregarConta(playerid)
{
    new String[99];
    GetPlayerName(playerid, Nome,sizeof(Nome));
    format(String, sizeof(String), "Contas/%s.ini", Nome);
    if(DOF2_FileExists(String))
    {
        TitoInfo[playerid][pDinheiro]  = DOF2_GetInt(String,   "Dinheiro");
        TitoInfo[playerid][pBank] = DOF2_GetInt(String,           "Banco");
        TitoInfo[playerid][pScore] = 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");
    }
    return 1;
Ajeitei algumas coisa obvias e vou te deixar um alerta, tu ta usando muita cйlulas vei seu GM vai fica cagado, Olha vou dizendo nгo encontrei nenhum problema, o que eu ajeitei nгo resolverб seu problema foi somente um melhoramento, faзa um debug para descobrir o problema, pois ele nгo estб sendo encontrado visualmente...
Reply


Messages In This Thread
carregamento - by mau.tito - 19.09.2012, 18:43
Re: carregamento - by .FuneraL. - 19.09.2012, 18:52
Re: carregamento - by mau.tito - 19.09.2012, 19:04
Re: carregamento - by CaioMiglioli - 19.09.2012, 19:05
Re: carregamento - by @Riichard - 19.09.2012, 19:09
Re: carregamento - by mau.tito - 19.09.2012, 19:10
Re: carregamento - by .FuneraL. - 19.09.2012, 19:11
Re: carregamento - by Jason` - 19.09.2012, 19:15
Re: carregamento - by mau.tito - 19.09.2012, 19:30
Re: carregamento - by paulor - 19.09.2012, 23:40

Forum Jump:


Users browsing this thread: 4 Guest(s)