[Ajuda] Nгo carrega os dados do Player
#7

Talvez seja o REGISTRO. Da uma olhada nesse sistema que eu fiz aqui, ele salva tudo e carrega tudo ja testei e n achei bugs

>=

PHP код:
//  INCLUDES
#include <a_samp>
#include <DOF2>
//  DIALOGS
#define DIALOG_REGISTRO                                                         1
#define DIALOG_LOGIN                                                            2
#define DIALOG_SEXO                                                             3
//  NEWS
enum PlayerInfo
{
    
Dinheiro,
    
Level,
    
Skin,
    
Procurado,
    
Admin,
    
Float:pX,
    
Float:pY,
    
Float:pZ,
    
Float:pA,
    
bool:Logado
};
new 
Player[MAX_PLAYERS][PlayerInfo];
main() {}
public 
OnPlayerRequestClass(playeridclassid)
{
    new 
File[50];
    
format(Filesizeof(File), "Contas/%s.ini"Nome(playerid));
    if(!
DOF2::FileExists(File))
    {
        
ShowPlayerDialog(playeridDIALOG_REGISTRODIALOG_STYLE_INPUT"REGISTRO""- Insira sua senha para Registrar-se:""Registrar""Sair");
    }
    else if(
DOF2::FileExists(File))
    {
        
ShowPlayerDialog(playeridDIALOG_LOGINDIALOG_STYLE_PASSWORD"LOGIN""- Insira sua senha para Logar-se:""Logar""Sair");
    }
    return 
1;
}
public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    new 
File[50];
    
format(Filesizeof(File), "Contas/%s.ini"Nome(playerid));
    if(
dialogid == DIALOG_REGISTRO)
    {
        if(
response)
        {
            if(
strlen(inputtext) < || strlen(inputtext) > 20)
            {
                
SendClientMessage(playeridVermelho"| ERRO | Insira uma senha entre 5 e 20 caracters!");
                
ShowPlayerDialog(playeridDIALOG_REGISTRODIALOG_STYLE_INPUT"REGISTRO""- Insira sua senha para Registrar-se:""Registrar""Sair");
                return 
1;
            }
            
DOF2::CreateFile(File);
            
DOF2::SetString(File"Senha"inputtext);
            
DOF2::SetInt(File"Dinheiro"Player[playerid][Dinheiro] = 5000);
            
DOF2::SetInt(File"Procurado"Player[playerid][Procurado] = 0);
            
DOF2::SetInt(File"Level"Player[playerid][Level] = 0);
            
DOF2::SetInt(File"Skin"Player[playerid][Skin] = 60);
            
DOF2::SetInt(File"Admin"Player[playerid][Admin] = 0);
            
DOF2::SetFloat(File"X"Player[playerid][pX] = 1958.3783);
            
DOF2::SetFloat(File"Y"Player[playerid][pY] = 1343.1572);
            
DOF2::SetFloat(File"Z"Player[playerid][pZ] = 15.3746);
            
DOF2::SetFloat(File"A"Player[playerid][pA] = 270.0000);
            
DOF2::SaveFile();
            
GivePlayerMoney(playeridPlayer[playerid][Dinheiro]);
            
SetPlayerScore(playeridPlayer[playerid][Level]);
            
SetPlayerWantedLevel(playeridPlayer[playerid][Procurado]);
            
SetSpawnInfo(playerid0Player[playerid][Skin], Player[playerid][pX], Player[playerid][pY], Player[playerid][pZ], Player[playerid][pA], 000000);
            
Player[playerid][Logado] = true;
            
SpawnPlayer(playerid);
        }
        else
        {
            
Kick(playerid);
            return 
1;
        }
        return 
1;
    }
    if(
dialogid == DIALOG_LOGIN)
    {
        if(
response)
        {
            if(!
strlen(inputtext))
            {
                 
ShowPlayerDialog(playeridDIALOG_LOGINDIALOG_STYLE_PASSWORD"LOGIN""- Insira sua senha para Logar-se:""Logar""Sair");
                return 
1;
            }
            if(
strcmp(inputtextDOF2::GetString(File"Senha"), true) == 0)
            {
                
Player[playerid][Dinheiro] = DOF2::GetInt(File"Dinheiro");
                
Player[playerid][Procurado] = DOF2::GetInt(File"Procurado");
                
Player[playerid][Level] = DOF2::GetInt(File"Level");
                
Player[playerid][Skin] = DOF2::GetInt(File"Skin");
                
Player[playerid][Admin] = DOF2::GetInt(File"Admin");
                
Player[playerid][pX] = DOF2::GetFloat(File"X");
                
Player[playerid][pY] = DOF2::GetFloat(File"Y");
                
Player[playerid][pZ] = DOF2::GetFloat(File"Z");
                
Player[playerid][pA] = DOF2::GetFloat(File"A");
                
GivePlayerMoney(playeridPlayer[playerid][Dinheiro]);
                
SetPlayerScore(playeridPlayer[playerid][Level]);
                
SetPlayerWantedLevel(playeridPlayer[playerid][Procurado]);
                
SetSpawnInfo(playerid0Player[playerid][Skin], Player[playerid][pX], Player[playerid][pY], Player[playerid][pZ], Player[playerid][pA], 000000);
                
Player[playerid][Logado] = true;
                
SpawnPlayer(playerid);
            }
            else
            {
                 
ShowPlayerDialog(playeridDIALOG_LOGINDIALOG_STYLE_PASSWORD"LOGIN""- Insira sua senha para Logar-se:""Logar""Sair");
                return 
1;
            }
        }
        else
        {
            
Kick(playerid);
            return 
1;
        }
        return 
1;
    }
    return 
0;

Reply


Messages In This Thread
Nгo carrega os dados do Player - by WiliHacking - 01.02.2019, 21:32
Re: Nгo carrega os dados do Player - by AutoMatic2 - 01.02.2019, 22:13
Re: Nгo carrega os dados do Player - by WiliHacking - 02.02.2019, 01:47
Re: Nгo carrega os dados do Player - by WiliHacking - 02.02.2019, 20:35
Re: Nгo carrega os dados do Player - by AutoMatic2 - 02.02.2019, 20:44
Re: Nгo carrega os dados do Player - by WiliHacking - 02.02.2019, 21:03
Re: Nгo carrega os dados do Player - by AutoMatic2 - 02.02.2019, 21:41
Re: Nгo carrega os dados do Player - by WiliHacking - 02.02.2019, 21:55
Re: Nгo carrega os dados do Player - by WiliHacking - 09.02.2019, 14:56
Re: Nгo carrega os dados do Player - by DanielMatrix - 09.02.2019, 18:27

Forum Jump:


Users browsing this thread: 3 Guest(s)