[Ajuda] Registro
#1

Eae galera na hora de se registrar so aparece o dialog de registrar n de login olha ae
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == REGISTRO)
    {
        if(response)
        {
            if(!strlen(inputtext))
            {
                new Nome[MAX_PLAYER_NAME];
                GetPlayerName(playerid, Nome, sizeof(Nome));
                new String[100];
                format(String, sizeof(String), "{7FFFD4}Nick: {1E90FF}%s  {1E90FF}Nгo Registrado\n\n{FFFFFF} Digite Uma Senha Para Continuar", Nome);
                ShowPlayerDialog(playerid, REGISTRO, DIALOG_STYLE_INPUT, "Registro", String, "Registrar", "Cancelar");
                SendClientMessage(playerid,0x1E90FFAA,"Senha invalida, digite uma senha vбlida");
                return 1;
            }
            new Nome[MAX_PLAYER_NAME];
            GetPlayerName(playerid, Nome, sizeof(Nome));
            new String[100];
            format(String, sizeof(String), CONTAS, Nome);
            dini_Create(String);
            dini_Set(String,"Senha",inputtext);
            dini_IntSet(String,"Dinheiro",0);
            dini_IntSet(String,"Matou",0);
            dini_IntSet(String,"Morreu",0);
            dini_IntSet(String,"Logou",0);
            dini_IntSet(String,"Pano",0);
            dini_IntSet(String,"PanoP",0);
            dini_IntSet(String,"Admin",0);
            dini_IntSet(String,"Funcao",0);
            dini_IntSet(String,"PMLS",0);
            dini_IntSet(String,"GDE",0);
            dini_IntSet(String,"Procurado",0);
            dini_IntSet(String,"NivelProcurado",0);
            dini_IntSet(String,"EstrelaProcurado",0);
            dini_IntSet(String,"Choque",0);
            dini_IntSet(String,"PresoLS",0);
            dini_IntSet(String,"TempoPreso",0);
            dini_IntSet(String,"Maconha",0);
            dini_IntSet(String,"Cocaina",0);
            dini_IntSet(String,"Sinalizador",0);
            dini_IntSet(String,"ReporterLS",0);
            GivePlayerMoneyEx(playerid, 50000);

            ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_INPUT, "Login", "Parabйns, conta criada com sucesso! \nAgora digite sua senha para logar:", "Logar", "Cancelar");
            ShowPlayerDialog(playerid, JFS_OWNA, DIALOG_STYLE_LIST, " Escolha Uma Torcida ", "Sudeste\nSul e Centro - Oeste\nNorte e Nordeste", "Selecionar", "Cancelar");
            return 1;
        }
        else
        {
            SendClientMessage(playerid, 0xFF0000AA, "Vocк nгo quis se registrar, por este motivo sera Kickado");
            Kick(playerid);
            return 1;
        }
    }// alguem em ajuda ae 60 on no meu server
Reply
#2

Queria q o dialog login vinha primeiro
Reply
#3

BINI
pawn Код:
#include a_samp
#include bIni

#if defined MAX_PLAYERS
        #undef MAX_PLAYERS
#endif

#define MAX_PLAYERS 45

#define contas "%s.ini"

#define login "Bem vindo ao servidor %s digite sua senha para logar-se."
#define registro "Bem vindo ao servidor %s registre-se."


enum pInfo
{
    pGrana,
    pLevel,
};

new playerinfo[MAX_PLAYERS][pInfo];

new
    file[50],
    nome[24],
    paramount[90]
;


public OnPlayerConnect(playerid)
{
    GetPlayerName(playerid,nome,24);
    format(file,50,contas,nome);
    if(fexist(file))
    {
        GetPlayerName(playerid,nome,24);
        format(paramount,90,login,nome);
        ShowPlayerDialog(playerid,9998,DIALOG_STYLE_INPUT,"Servidor",paramount,"entrar","Sair");
    }
    else
    {
        GetPlayerName(playerid,nome,24);
        format(paramount,90,registro,nome);
        ShowPlayerDialog(playerid,9999,DIALOG_STYLE_INPUT,"Servidor",paramount,"registrar","Sair");
    }
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 9999)
    {
        if(!response) return Kick(playerid);
        if(response)
        {
            GetPlayerName(playerid,nome,24);
            format(file,50,contas,nome);
            INI_Open(file);
            INI_WriteString("senha",inputtext);
            playerinfo[playerid][pLevel] = INI_WriteInt("level",5);
            playerinfo[playerid][pGrana] = INI_WriteInt("dinheiro",5000);
            INI_Save();
            INI_Close();
            format(paramount,90,login,nome);
            new len = strlen(inputtext);
            if(len < 5 || len > 20) return ShowPlayerDialog(playerid,9999,DIALOG_STYLE_INPUT,"Servidor","Senha deve conter no minimo 5 caracteres.","Ok","kick");
            return ShowPlayerDialog(playerid,9998,DIALOG_STYLE_INPUT,"Servidor",login,"Ok","fechar");
        }
    }
    if(dialogid == 9998)
    {
        if(!response) return Kick(playerid);
        if(response)
        {
            new senha[20];
            GetPlayerName(playerid,nome,24);
            format(senha,20,"%s",strval(inputtext));
            format(file,50,contas,nome);
            INI_Open(file);
            INI_ReadString("senha");
            INI_Close();
            if(strcmp(senha,inputtext,true) == 0)
            {
                if(!strlen(inputtext))
                {
                    ShowPlayerDialog(playerid,9998,DIALOG_STYLE_INPUT,"Servidor","senha errada, digite a senha correta para logar-se.","Ok","Sair");
                    return SendClientMessage(playerid,-1,"senha errada.");
                }
                GetPlayerName(playerid,nome,24);
                format(file,28,contas,nome);
                INI_Open(file);
                SetPlayerScore(playerid,INI_ReadInt("level"));
                GivePlayerMoney(playerid,INI_ReadInt("dinheiro"));
                INI_Close();
            }
            else
            {
                ShowPlayerDialog(playerid,9998,DIALOG_STYLE_INPUT,"Servidor","senha errada, insira a senha correta.","Ok","Sair");
                SendClientMessage(playerid,-1,"senha errada.");
            }
        }
    }
    return 1;
DOF 2
pawn Код:
#include a_samp
#include DOF2


#if defined MAX_PLAYERS
        #undef MAX_PLAYERS
#endif

#define MAX_PLAYERS 45

#define contas "%s.ini"

#define login "Bem vindo ao servidor %s digite sua senha para logar-se."
#define registro "Bem vindo ao servidor %s registre-se."


enum pInfo
{
    pGrana,
    pLevel,
};

new playerinfo[MAX_PLAYERS][pInfo];

new
    arquivo[50],
    nome[24],
    paramount[90]
;

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

public OnPlayerConnect(playerid)
{
    GetPlayerName(playerid,nome,24);
    format(arquivo,50,contas,nome);
    if(fexist(arquivo))
    {
        GetPlayerName(playerid,nome,24);
        format(paramount,90,login,nome);
        ShowPlayerDialog(playerid,9998,DIALOG_STYLE_INPUT,"Servidor",paramount,"entrar","sair");
    }
    else
    {
        GetPlayerName(playerid,nome,24);
        format(paramount,90,registro,nome);
        ShowPlayerDialog(playerid,9999,DIALOG_STYLE_INPUT,"Servidor",paramount,"registrar","sair");
    }
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 9999)
    {
        if(!response) return Kick(playerid);
        if(response)
        {
            GetPlayerName(playerid,nome,24);
            format(arquivo,50,contas,nome);
            DOF2_CreateFile(arquivo);
            DOF2_SetString(arquivo,"senha",inputtext);
            playerinfo[playerid][pLevel] = DOF2_SetInt(arquivo,"level",5);
            playerinfo[playerid][pGrana] = DOF2_SetInt(arquivo,"dinheiro",5000);
            format(paramount,90,login,nome);
            new len = strlen(inputtext);
            if(len < 5 || len > 20) return ShowPlayerDialog(playerid,9999,DIALOG_STYLE_INPUT,"Servidor","Senha deve conter no minimo 5 caracteres.","Ok","kick");
            return ShowPlayerDialog(playerid,9998,DIALOG_STYLE_INPUT,"Servidor",login,"ok","fechar");
        }
    }
    if(dialogid == 9998)
    {
        if(!response) return Kick(playerid);
        if(response)
        {
            new senha[20];
            GetPlayerName(playerid,nome,24);
            format(arquivo,50,contas,nome);
            format(senha,20,"%s",strval(inputtext));
            if(strcmp(inputtext,DOF2_GetString(arquivo,"senha"),true) == 0)
            {
                if(!strlen(inputtext))
                {
                    ShowPlayerDialog(playerid,9998,DIALOG_STYLE_INPUT,"Servidor","senha errada, digite a senha correta para logar-se.","ok","sair");
                    return SendClientMessage(playerid,-1,"senha errada.");
                }
                GetPlayerName(playerid,nome,24);
                format(arquivo,28,contas,nome);
                SetPlayerScore(playerid,DOF2_GetInt(arquivo,"level"));
                GivePlayerMoney(playerid,DOF2_GetInt(arquivo,"dinheiro"));
            }
            else
            {
                ShowPlayerDialog(playerid,9998,DIALOG_STYLE_INPUT,"Servidor","senha errada, insira a senha correta.","ok","sair");
                SendClientMessage(playerid,-1,"senha errada.");
            }
        }
    }
    return 1;
}
}

SII
pawn Код:
#include a_samp
#include SII

#if defined MAX_PLAYERS
        #undef MAX_PLAYERS
#endif

#define MAX_PLAYERS 45

#define contas "%s.ini"

#define login "Bem vindo ao servidor %s digite sua senha para logar-se."
#define registro "Bem vindo ao servidor %s registre-se."

enum pInfo
{
    pGrana,
    pLevel,
};

new playerinfo[MAX_PLAYERS][pInfo];

new
    file[50],
    nome[24],
    paramount[90]
;


public OnPlayerConnect(playerid)
{
    GetPlayerName(playerid,nome,24);
    format(file,50,contas,nome);
    if(fexist(file))
    {
        GetPlayerName(playerid,nome,24);
        format(paramount,90,login,nome);
        ShowPlayerDialog(playerid,9998,DIALOG_STYLE_INPUT,"Servidor",paramount,"entrar","sair");
    }
    else
    {
        GetPlayerName(playerid,nome,24);
        format(paramount,90,registro,nome);
        ShowPlayerDialog(playerid,9999,DIALOG_STYLE_INPUT,"Servidor",paramount,"registrar","sair");
    }
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 9999)
    {
        if(!response) return Kick(playerid);
        if(response)
        {
            GetPlayerName(playerid,nome,24);
            format(file,50,contas,nome);
            INI_Open(file);
            INI_WriteString("senha",inputtext);
            playerinfo[playerid][pLevel] = INI_WriteInt("level",5);
            playerinfo[playerid][pGrana] = INI_WriteInt("dinheiro",5000);
            INI_Save();
            INI_Close();
            format(paramount,90,login,nome);
            new len = strlen(inputtext);
            if(len < 5 || len > 20) return ShowPlayerDialog(playerid,9999,DIALOG_STYLE_INPUT,"Servidor","Senha deve conter no minimo 5 caracteres.","Ok","kick");
            return ShowPlayerDialog(playerid,9998,DIALOG_STYLE_INPUT,"Servidor",login,"ok","fechar");
        }
    }
    if(dialogid == 9998)
    {
        if(!response) return Kick(playerid);
        if(response)
        {
            new senha[20];
            GetPlayerName(playerid,nome,24);
            format(senha,20,"%s",strval(inputtext));
            format(file,50,contas,nome);
            INI_Open(file);
            INI_ReadString(senha,"senha");
            INI_Close();
            if(strcmp(senha,inputtext,true) == 0)
            {
                if(!strlen(inputtext))
                {
                    ShowPlayerDialog(playerid,9998,DIALOG_STYLE_INPUT,"Servidor","senha errada, digite a senha correta para logar-se.","ok","sair");
                    return SendClientMessage(playerid,-1,"senha errada.");
                }
                GetPlayerName(playerid,nome,24);
                format(file,28,contas,nome);
                INI_Open(file);
                SetPlayerScore(playerid,INI_ReadInt("level"));
                GivePlayerMoney(playerid,INI_ReadInt("dinheiro"));
                INI_Close();
            }
            else
            {
                ShowPlayerDialog(playerid,9998,DIALOG_STYLE_INPUT,"Servidor","senha errada, insira a senha correta.","ok","sair");
                SendClientMessage(playerid,-1,"senha errada.");
            }
        }
    }
    return 1;
}
Espero Ter Ajudado!
CREDITOS : Paramount <
Reply
#4

Й do Paramount isso ai, ele foi banido...
Reply
#5

obr por lenbrar dos creditos ae ja colokei
Reply
#6

Voces nгo intenderam tipow eu tenho o sistema de registro e login mais queria q os dialog aparecer mais n aparece o dialog de login quando registra mais se eu tiro odialog das torcidas aparece entenderam ?
Reply
#7

Quote:
Originally Posted by denis15711
Посмотреть сообщение
Voces nгo intenderam tipow eu tenho o sistema de registro e login mais queria q os dialog aparecer mais n aparece o dialog de login quando registra mais se eu tiro odialog das torcidas aparece entenderam ?
Simples, tira o
pawn Код:
ShowPlayerDialog(playerid, JFS_OWNA, DIALOG_STYLE_LIST, " Escolha Uma Torcida ", "Sudeste\nSul e Centro - Oeste\nNorte e Nordeste", "Selecionar", "Cancelar");
E poe ele no Dialog de Login
pawn Код:
if(dialogid == LOGIN)
Reply
#8

mais ae vai aparecer toda vez q eele logar so quero na hr do registro pq as torcidas salva agr quando ele loga ja й spawn para torcida q ele escolheu
Reply
#9

Humm.. Entгo й sу criar um variбvel booleana (que deve ser salva) e checar se tб false ou true.
No topo do GM:
pawn Код:
new bool:EscolherTorcida[MAX_PLAYERS];
No Dialog de Registro
pawn Код:
EscolherTorcida[playerid] = true;
No Dialog de Login:
pawn Код:
if(EscolherTorcida[playerid] == true)
{
   ShowPlayerDialog(playerid, TORCIDA, DIALOG_STYLE_LIST,"Escolha uma torcida","Torcida 1\nTorcida 2","Escolher","");
   EscolherTorcida[playerid] = false;  
  //Para nao haver bugs й melhor setar pra false (/\) depois que tiver escolhido a torcida
}
E onde vocк setar false vocк poe:
pawn Код:
new file[56], nome[MAX_PLAYER_NAME];
GetPlayerName(playerid, nome, sizeof(nome));
format(file, sizeof(file),"Contas/%s.ini",  nome);
if(DOF2_FileExists(file))
{
   DOF2_SetBool(file,"TorcidaEscolhida", EscolherTorcida[playerid]);  
   DOF2_SaveFile();
}
E onde carrega o jogador coloque:
pawn Код:
new file[56], nome[MAX_PLAYER_NAME];
GetPlayerName(playerid, nome, sizeof(nome));
format(file, sizeof(file),"Contas/%s.ini",  nome);
if(DOF2_FileExists(file))
{
     EscolherTorcida[playerid] = DOF2_GetBool(file,"TorcidaEscolhida");
}
Reply
#10

Vlw manin funcionou certinho +rep para vc ae vlw msm
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)