[Ajuda] Sistema registro
#2

Tenta ae!
PHP код:
//----------------------------------------------------------------------------//
#include < a_samp >
#include < DOF2 >
//----------------------------------------------------------------------------//
#define     DIALOG_REGISTRO         1
#define     DIALOG_LOGAR            2
#define     UsuariosSalvos "/Usuarios/%s.ini"
//----------------------------------------------------------------------------//
enum Informacoes
{
    
Senha,
    
Matou,
    
Morreu,
    
Dinheiro,
    
Vida,
    
PlayerAdmin
}
//----------------------------------------------------------------------------//
new Player[MAX_PLAYERS][Informacoes];
new 
name[MAX_PLAYER_NAME];
//----------------------------------------------------------------------------//
public OnGameModeInit()
{
    
SetGameModeText("Versгo 1.0.1");
    
AddPlayerClass(01642.1667, -2335.494113.54697.6790000000);
    return 
1;
}
public 
OnGameModeExit()
{
    
DOF2_Exit();
    return 
1;
}
public 
OnPlayerConnect(playerid)
{
    new 
arquivo[40];
    
GetPlayerName(playeridnameMAX_PLAYER_NAME);
    
format(arquivo40"Usuarios/%s.ini"name);
    if(
DOF2_FileExists(arquivo))
    {
        
ShowPlayerDialog(playeridDIALOG_LOGARDIALOG_STYLE_PASSWORD"Logar""Vocк jб estб registrado em nosso banco de dados, digite sua senha para logar.""Entrar""Sair");
    }
    else
    {
        
ShowPlayerDialog(playeridDIALOG_REGISTRODIALOG_STYLE_INPUT"Registro""Vocк ainda nгo estб registrado em nosso banco de dados, digite uma senha para poder registrar.""Confirmar""Cancelar");
    }
    return 
1;
}
public 
OnPlayerDisconnect(playeridreason)
{
    new 
arquivo[40];
    
GetPlayerName(playeridnameMAX_PLAYER_NAME );
    
format(arquivo40"Usuarios/%s.ini"name);
    if(
DOF2_FileExists(arquivo))
    {
        
Player[playerid][Dinheiro] = GetPlayerMoney(playerid);
        
DOF2_SetInt(arquivo"Senha"Player[playerid][Senha]);
        
DOF2_SetInt(arquivo"Matou"Player[playerid][Matou]);
        
DOF2_SetInt(arquivo"Morreu"Player[playerid][Morreu]);
        
DOF2_SetInt(arquivo"Dinheiro"Player[playerid][Dinheiro]);
        
DOF2_SetInt(arquivo"Vida"Player[playerid][Vida]);
        
DOF2_SaveFile();
    }
    return 
1;
}
public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    new 
arquivo[40];
    
GetPlayerName(playeridnameMAX_PLAYER_NAME);
    
format(arquivo40"Usuarios/%s.ini"name);
    if(
dialogid == DIALOG_REGISTRO)
    {
        if(!
strval(inputtext))
        {
            
ShowPlayerDialog(playeridDIALOG_REGISTRODIALOG_STYLE_INPUT"Registro""Por favor, digite apenas nъmeros em sua senha!\nPor favor, digite sua senha novamente para concluir seu registro!""Confirma""Cancelar");
            return 
1;
        }
        if(!
response)
        {
            
Kick(playerid);
            return 
1;
        }
        else
        {
            
Player[playerid][Dinheiro] = GivePlayerMoney(playerid5000);
            
Player[playerid][Vida] = SetPlayerHealth(playerid50);
            
DOF2_SetInt(arquivo"Senha"Player[playerid][Senha]);
            
DOF2_SetInt(arquivo"Matou"Player[playerid][Matou]);
            
DOF2_SetInt(arquivo"Morreu"Player[playerid][Morreu]);
            
DOF2_SetInt(arquivo"Dinheiro"Player[playerid][Dinheiro]);
            
DOF2_SetInt(arquivo"Vida"Player[playerid][Vida]);
            
DOF2_SaveFile();
            
ShowPlayerDialog(playeridDIALOG_LOGARDIALOG_STYLE_PASSWORD"Logar""Vocк acaba de se registrar em nosso banco de dados, por favor digite sua senha para logar!""Confirma""Cancelar");
        }
    }
    if(
dialogid == DIALOG_LOGAR)
    {
        if(!
response)
        {
            
SendClientMessage(playerid, -1"Vocк nгo quis logar, entгo foi kickado automaticamente");
            
Kick(playerid);
        }
        if(
response)
        {
            new 
file[32];
            
GetPlayerName(playeridnameMAX_PLAYER_NAME);
            
format(file,sizeof(file),"Usuarios/%s.ini"name);
            if(
DOF2_FileExists(file))
            {
               if( 
DOF2_CheckLogin file inputtext ) )
                {
                    
SendClientMessageplayerid , -"Logado com sucesso" );
                    return 
1;
                }
                else
                {
                    
ShowPlayerDialog(playeridDIALOG_LOGARDIALOG_STYLE_PASSWORD"Logar""Por favor, digite apenas nъmeros em sua senha.\nPor favor, digite sua senha para poder logar!""Confirmar""Cancelar");
                }
            }
        }
    }
    return 
1;
}
public 
OnPlayerClickPlayer(playeridclickedplayeridsource)
{
    return 
1;

Reply


Messages In This Thread
Sistema registro - by sh0wtime - 11.12.2012, 16:07
Re: Sistema registro - by mau.tito - 11.12.2012, 16:21
Re: Sistema registro - by EditPawn - 11.12.2012, 16:31
Re: Sistema registro - by sh0wtime - 11.12.2012, 16:33
Re: Sistema registro - by EditPawn - 11.12.2012, 16:46
Re: Sistema registro - by sh0wtime - 11.12.2012, 16:57
Re: Sistema registro - by mau.tito - 11.12.2012, 17:09
Re: Sistema registro - by sh0wtime - 11.12.2012, 17:20
Re: Sistema registro - by JonathanFeitosa - 11.12.2012, 17:21
Re: Sistema registro - by sh0wtime - 11.12.2012, 17:24

Forum Jump:


Users browsing this thread: 9 Guest(s)