SA-MP Forums Archive
[HELP] Cуdigo de Registro que estou criando. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [HELP] Cуdigo de Registro que estou criando. (/showthread.php?tid=322364)



[HELP] Cуdigo de Registro que estou criando. - Edu_Oliveira - 01.03.2012

Olб galera. Estou criando um GM com um amigo e estamos criando um sistema de registro. Como nгo gosto de copiar nada dos outros, estamos criando do zero, e, usei uns tutoriais para ter uma noзгo de como fazer. Eu preciso de ajuda para terminar ele.

Eis minhas dъvidas: Meu sistema nгo estб salvando a conta. Й claro que ele ainda estб incompleto, mas a parte do salvamento de contas jб devia funcionar, nгo ?
Outra coisa. Eu coloquei duas dialogs. Uma de regras, e uma de registro. Caso o cara nгo aceite as regras й kickado etc etc etc. Porйm, como eu estou usando dialog no registro, nгo sei como gravar a senha do cara na conta. Jб tentei colocar o inputtext definido como senha mas nгo adianta... E ai, resumindo, como nгo tб gravando, nгo tб dando resposta no dialog de registro, sendo assim, nгo loga e etc. Eu jб estou com um sistema mais simples aqui, mas queria ajuda para terminar esse FS. Atй deixaria o FS disponivel ai depois de terminar. Mas queria bastante a ajuda para terminar.

Grato.

pawn Код:
// FS de Registro e Regras do servidor.

#include <a_samp>
#include <dini>
#include <udb>

#define SALMAO 0xFF8080FF
#define BRANCO 0xFFFFFFFF

#define dialog_regras 1212
#define dialog_registro 1212
#define dialog_login 1212


new Logado [MAX_PLAYERS];
new Registrado [MAX_PLAYERS];

enum pInfo
{
 pNome,
 pLevel,
 pAdmin,
 pHelper,
 pBanco,
 pGrana,
 pSenha
 }

new PlayerInfo [MAX_PLAYERS][pInfo];
#define PocketMoney 500

public OnFilterScriptInit()
{
   return 1;
   }
   
   public OnFilterScriptExit()
   {
   return 1;
   }
public OnPlayerConnect(playerid)
{
   Logado[playerid] = 0;
   Registrado[playerid] = 0;
   
   new Nome[MAX_PLAYERS];
   new Arquivo[MAX_PLAYERS];
   GetPlayerName(playerid,Nome,sizeof(Nome));
   format(Arquivo,sizeof(Arquivo),"CONTAS/%s.ini",Nome);
   if (fexist(Arquivo)) {Registrado[playerid] =1;}
   
   if (Registrado[playerid] == 0)
   {
   SendClientMessage(playerid,SALMAO,"Vocк ainda nгo й registrado. Leia os termos e se registre.");
   ShowPlayerDialog(playerid,dialog_regras,DIALOG_STYLE_MSGBOX,"Termos e Condicoes do Servidor","Quando clicar em aceito, estara...BLABLABLA","Concordo","Discordo");
   return 1;
   }
   else
   {
   ShowPlayerDialog(playerid,dialog_login,DIALOG_STYLE_PASSWORD,"Login","Logue no servidor digitando sua senha","Logar","Cancelar");
   return 1;
   }
   return 1;
   }
   
   public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
   if (dialogid == dialog_regras && response == 1)
   {
   SendClientMessage(playerid,BRANCO,"Obrigado por concordar. Isso quer dizer que voce sabe as regras.");
   ShowPlayerDialog(playerid,dialog_registro,DIALOG_STYLE_PASSWORD,"Registro","Registre-se no servidor digitando sua senha","Registrar","Cancelar");
   return 1;
   }
   if (dialogid == dialog_regras && response == 0)
   {
   SendClientMessage(playerid,SALMAO,"Vocк nгo pode se registrar por nгo concordar com os termos./n/nObrigado");
   Kick(playerid);
   return 1;
   }
   if (dialogid == dialog_registro && response == 1)
   {
   
   new Nome[MAX_PLAYER_NAME];
   new Arquivo[MAX_PLAYERS];
   #define inputtext pSenha
   GetPlayerName(playerid,Nome,sizeof(Nome));
   format(Arquivo,sizeof(Arquivo),"CONTAS/%s.ini");

   if(!fexist(Arquivo))
   {
      dini_Create(Arquivo,"CONTAS/%s.ini");
      dini_IntSet(Arquivo,"Senha",pSenha);
      PlayerInfo[playerid][pSenha] = dini_Int(Arquivo,"Senha");
      Registrado[playerid] = 1;
      return (Registrado[playerid] == 1 && Logado[playerid] == 1);
      }

   SendClientMessage(playerid,BRANCO,"Obrigado por se registrar. Tenha um bom jogo./n/nAperte SHIFT para spawnar.");
   return 1;
   }
   if (dialogid == dialog_registro && response == 0)
   {
   SendClientMessage(playerid,SALMAO,"Voce nao se registrou, entao foi kickado. Ate mais./n/nObrigado.");
   Kick(playerid);
   return 1;
   }
   return 1;
}
PS: Se alguem editar algo, por favor fale oque fez e se possнvel explique, assim, aprenderei!


Re: [HELP] Cуdigo de Registro que estou criando. - [BOPE]Jonathan - 01.03.2012

tente
pawn Код:
dini_Set(Arquivo,"Senha",pSenha);
ps: acho que falei merda


Re: [HELP] Cуdigo de Registro que estou criando. - GuiihCamargo - 01.03.2012

@OFF
Cara oque muda de :
Код:
dini_IntSet(Arquivo,"Senha",pSenha);
Para:
Код:
dini_Set(Arquivo,"Senha",pSenha);



Re: [HELP] Cуdigo de Registro que estou criando. - [BOPE]Jonathan - 01.03.2012

acho que confundi dini_Int com dini_IntSet RIARIARIA malz ae


Re: [HELP] Cуdigo de Registro que estou criando. - Edu_Oliveira - 01.03.2012

Ah, desprezem o
pawn Код:
#define PocketMoney 500
Aquilo ali foi sу um teste.


Re: [HELP] Cуdigo de Registro que estou criando. - DouglasRodrigues - 01.03.2012

pawn Код:
// FS de Registro e Regras do servidor.

#include <a_samp>
#include <dini>
#include <dudb>

#define SALMAO 0xFF8080FF
#define BRANCO 0xFFFFFFFF

#define dialog_regras 1212
#define dialog_registro 1212
#define dialog_login 1212
#pragma unused ret_memcpy


new Logado [MAX_PLAYERS];
new Registrado [MAX_PLAYERS];

enum pInfo
{
 pNome,
 pLevel,
 pAdmin,
 pHelper,
 pBanco,
 pGrana,
 pSenha
 }

new PlayerInfo [MAX_PLAYERS][pInfo];
#define PocketMoney 500

public OnFilterScriptInit()
{
   return 1;
   }

   public OnFilterScriptExit()
   {
   return 1;
   }
public OnPlayerConnect(playerid)
{
   Logado[playerid] = 0;
   Registrado[playerid] = 0;

   new Nome[MAX_PLAYERS];
   new Arquivo[MAX_PLAYERS];
   GetPlayerName(playerid,Nome,sizeof(Nome));
   format(Arquivo,sizeof(Arquivo),"CONTAS/%s.ini",Nome);
   if (fexist(Arquivo)) {Registrado[playerid] =1;}

   if (Registrado[playerid] == 0)
   {
   SendClientMessage(playerid,SALMAO,"Vocк ainda nгo й registrado. Leia os termos e se registre.");
   ShowPlayerDialog(playerid,dialog_regras,DIALOG_STYLE_MSGBOX,"Termos e Condicoes do Servidor","Quando clicar em aceito, estara...BLABLABLA","Concordo","Discordo");
   return 1;
   }
   else
   {
   ShowPlayerDialog(playerid,dialog_login,DIALOG_STYLE_PASSWORD,"Login","Logue no servidor digitando sua senha","Logar","Cancelar");
   return 1;
   }
   return 1;
   }

   public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
   if (dialogid == dialog_regras && response == 1)
   {
   SendClientMessage(playerid,BRANCO,"Obrigado por concordar. Isso quer dizer que voce sabe as regras.");
   ShowPlayerDialog(playerid,dialog_registro,DIALOG_STYLE_PASSWORD,"Registro","Registre-se no servidor digitando sua senha","Registrar","Cancelar");
   return 1;
   }
   if (dialogid == dialog_regras && response == 0)
   {
   SendClientMessage(playerid,SALMAO,"Vocк nгo pode se registrar por nгo concordar com os termos./n/nObrigado");
   Kick(playerid);
   return 1;
   }
   if (dialogid == dialog_registro && response == 1)
   {

   new Nome[MAX_PLAYER_NAME];
   new Arquivo[MAX_PLAYERS];
   #define inputtext pSenha
   GetPlayerName(playerid,Nome,sizeof(Nome));
   format(Arquivo,sizeof(Arquivo),"CONTAS/%s.ini");

   if(!fexist(Arquivo))
   {
      dini_Create(Arquivo,"CONTAS/%s.ini");
      dini_IntSet(Arquivo,"Senha",pSenha);
      PlayerInfo[playerid][pSenha] = dini_Int(Arquivo,"Senha");
      Registrado[playerid] = 1;
      return (Registrado[playerid] == 1 && Logado[playerid] == 1);
      }

   SendClientMessage(playerid,BRANCO,"Obrigado por se registrar. Tenha um bom jogo./n/nAperte SHIFT para spawnar.");
   return 1;
   }
   if (dialogid == dialog_registro && response == 0)
   {
   SendClientMessage(playerid,SALMAO,"Voce nao se registrou, entao foi kickado. Ate mais./n/nObrigado.");
   Kick(playerid);
   return 1;
   }
   return 1;
}
Troquei a include dudb pela udb para retirar alguns warnings.


Re: [HELP] Cуdigo de Registro que estou criando. - Edu_Oliveira - 01.03.2012

E porque serб que estб gerando os warnings da 64 e 92 ?


Re: [HELP] Cуdigo de Registro que estou criando. - DouglasRodrigues - 01.03.2012

com a udb nгo tinha os wars?
Com ela aqui deu mais de 12.


Re: [HELP] Cуdigo de Registro que estou criando. - Edu_Oliveira - 01.03.2012

Nгo. Tinha 2. Os mesmos permaneceram. Talvez suas includes estejam desatualizadas. Mas aqui nгo fez diferenзa. Ficaram os 2 warnings de antes. Ai sumiram todos ?


Re: [HELP] Cуdigo de Registro que estou criando. - DouglasRodrigues - 01.03.2012

pawn Код:
// FS de Registro e Regras do servidor.

#include <a_samp>
#include <dini>
#include <dudb>
#pragma unused ret_memcpy


#define SALMAO 0xFF8080FF
#define BRANCO 0xFFFFFFFF

#define dialog_regras 1212
#define dialog_registro 1212
#define dialog_login 1212


new Logado [MAX_PLAYERS];
new Registrado [MAX_PLAYERS];

enum pInfo
{
 pNome,
 pLevel,
 pAdmin,
 pHelper,
 pBanco,
 pGrana,
 pSenha
 }

new PlayerInfo [MAX_PLAYERS][pInfo];
#define PocketMoney 500

public OnFilterScriptInit()
{
   return 1;
   }

   public OnFilterScriptExit()
   {
   return 1;
   }
public OnPlayerConnect(playerid)
{
   Logado[playerid] = 0;
   Registrado[playerid] = 0;

   new Nome[MAX_PLAYERS];
   new Arquivo[MAX_PLAYERS];
   GetPlayerName(playerid,Nome,sizeof(Nome));
   format(Arquivo,sizeof(Arquivo),"CONTAS/%s.ini",Nome);
   if (fexist(Arquivo)) {Registrado[playerid] =1;}

   if (Registrado[playerid] == 0)
   {
   SendClientMessage(playerid,SALMAO,"Vocк ainda nгo й registrado. Leia os termos e se registre.");
   ShowPlayerDialog(playerid,dialog_regras,DIALOG_STYLE_MSGBOX,"Termos e Condicoes do Servidor","Quando clicar em aceito, estara...BLABLABLA","Concordo","Discordo");
   return 1;
   }
   else
   {
   ShowPlayerDialog(playerid,dialog_login,DIALOG_STYLE_PASSWORD,"Login","Logue no servidor digitando sua senha","Logar","Cancelar");
   return 1;
   }
}

   public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
   if (dialogid == dialog_regras && response == 1)
   {
   SendClientMessage(playerid,BRANCO,"Obrigado por concordar. Isso quer dizer que voce sabe as regras.");
   ShowPlayerDialog(playerid,dialog_registro,DIALOG_STYLE_PASSWORD,"Registro","Registre-se no servidor digitando sua senha","Registrar","Cancelar");
   return 1;
   }
   if (dialogid == dialog_regras && response == 0)
   {
   SendClientMessage(playerid,SALMAO,"Vocк nгo pode se registrar por nгo concordar com os termos./n/nObrigado");
   Kick(playerid);
   return 1;
   }
   if (dialogid == dialog_registro && response == 1)
   {

   new Nome[MAX_PLAYER_NAME];
   new Arquivo[MAX_PLAYERS];
   #define inputtext pSenha
   GetPlayerName(playerid,Nome,sizeof(Nome));
   format(Arquivo,sizeof(Arquivo),"CONTAS/%s.ini");

   if(!fexist(Arquivo))
   {
      dini_Create(Arquivo,"CONTAS/%s.ini");
      dini_IntSet(Arquivo,"Senha",pSenha);
      PlayerInfo[playerid][pSenha] = dini_Int(Arquivo,"Senha");
      Registrado[playerid] = 1;
      return (Registrado[playerid] == 1 && Logado[playerid] == 1);
      }

   SendClientMessage(playerid,BRANCO,"Obrigado por se registrar. Tenha um bom jogo./n/nAperte SHIFT para spawnar.");
   return 1;
   }
   if (dialogid == dialog_registro && response == 0)
   {
   SendClientMessage(playerid,SALMAO,"Voce nao se registrou, entao foi kickado. Ate mais./n/nObrigado.");
   Kick(playerid);
   return 1;
   }
   return 1;
}