[Ajuda] Sistema De Salvamento DOF2!
#1

Olб Galera !
Meu Problema Й O Salvamento Da Skin Do Player ._.
Ele Nгo Salva A Skin Do Player!
Alguйm Ajuda Ae, Sou Novato Em Sistemas De Salvamento HEHE!

PHP код:
#define Contas "Contas/%s.ini"
#define Login "Bem-Vindo Ao Brasil Rockstar GameS!\nDigite Sua Senha Para Logar-Se!."
#define Registro "Bem-Vindo Ao Brasil Rockstar GameS!\nDigite Uma Senha Abaixo Para Se Registre-Se!." 
PHP код:
enum pInfo
{
    
pGrana,
    
pSenha,
    
pSkin,
    
pLevel,
};
new 
PlayerInfo[MAX_PLAYERS][pInfo]; 
PHP код:
public OnPlayerConnect(playerid)
{
        
GetPlayerName(playerid,nome,24);
    
format(arquivo,50,Contas,nome);
    if(
fexist(arquivo))
    {
        
GetPlayerName(playerid,nome,24);
        
format(BRG,90,Login,nome);
        
ShowPlayerDialog(playerid,9998,DIALOG_STYLE_INPUT,"Servidor",BRG,"entrar","sair");
    }
    else
    {
        
GetPlayerName(playerid,nome,24);
        
format(BRG,90,Registro,nome);
         
ShowPlayerDialog(playerid,9999,DIALOG_STYLE_INPUT,"Servidor",BRG,"registrar","sair");
    }
     return 
1;

PHP код:
public OnPlayerDisconnect(playeridreason)
{
    
SalvarContasplayerid );
    return 
1;

PHP код:
public OnPlayerSpawn(playerid)
{
    
SetPlayerSkin(playeridPlayerInfo[playerid][pSkin]);
    return 
1;

PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    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][pSenha] = strlen(inputtext);
            
PlayerInfo[playerid][pLevel] = DOF2_SetInt(arquivo,"Level",5);
            
PlayerInfo[playerid][pGrana] = DOF2_SetInt(arquivo,"Dinheiro",50000);
             
PlayerInfo[playerid][pSkin] = DOF2_SetInt(arquivo"Skin",59);
            
format(BRG,90,Login,nome);
            new 
len strlen(inputtext);
            if(
len || 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"));
                
PlayerInfo[playerid][pSkin] = DOF2_GetInt(arquivo"Skin");
                  
SetPlayerSkin(playeridPlayerInfo[playerid][pSkin]);
                
SendClientMessage(playerid, -1"[BRG] Logado Com Sucesso!");
                
SetSpawnInfo(playerid0PlayerInfo[playerid][pSkin], -2025.4244,145.6596,28.8359269.15000000);
                
SpawnPlayerplayerid );
            }
            else
            {
                
ShowPlayerDialog(playerid,9998,DIALOG_STYLE_INPUT,"Servidor","senha errada, insira a senha correta.","ok","sair");
                
SendClientMessage(playerid,-1,"senha errada.");
            }
        }
    }
    return 
1;

PHP код:
stock SalvarContas(playerid)
{
        
PlayerInfo[playerid][pGrana] = GetPlayerMoney(playerid);
        
PlayerInfo[playerid][pLevel] = GetPlayerScore(playerid);
          
PlayerInfo[playerid][pSkin] = GetPlayerSkin(playerid);
        
DOF2_SetInt(Contas,"Skin"PlayerInfo[playerid][pSkin]);
        
DOF2_SetInt(Contas"Senha",PlayerInfo[playerid][pSenha]);
        
DOF2_SetInt(Contas"Level",PlayerInfo[playerid][pLevel]);
        
DOF2_SetInt(Contas"Dinheiro",PlayerInfo[playerid][pGrana]);
        
DOF2_SaveFile();
        return 
1;

__________________________________________________ _______________________________________________

Obrigado Desde Jб !
Reply
#2

PHP код:

            PlayerInfo
[playerid][pLevel] = DOF2_SetInt(arquivo,"Level",5); 
            
PlayerInfo[playerid][pGrana] = DOF2_SetInt(arquivo,"Dinheiro",50000); 
             
PlayerInfo[playerid][pSkin] = DOF2_SetInt(arquivo"Skin",59); 
// Nгo й SetInt nessa parte de setar o player, no salvamento estб correto porйm para setar o player й "GetInt"
troque esses DOF2_SetInt por DOF2_GetInt
Reply
#3

Vocк nгo formatou o nome do arquivo.

PHP код:
stock SalvarContas(playerid

    new 
file[64];
    
GetPlayerName(playeridfileMAX_PLAYER_NAME);
    
format(filesizeof fileContasfile);    
    
PlayerInfo[playerid][pGrana] = GetPlayerMoney(playerid); 
    
PlayerInfo[playerid][pLevel] = GetPlayerScore(playerid); 
    
PlayerInfo[playerid][pSkin] = GetPlayerSkin(playerid); 
    
DOF2_SetInt(file,"Skin"PlayerInfo[playerid][pSkin]); 
    
DOF2_SetInt(file"Senha",PlayerInfo[playerid][pSenha]); 
    
DOF2_SetInt(file"Level",PlayerInfo[playerid][pLevel]); 
    
DOF2_SetInt(file"Dinheiro",PlayerInfo[playerid][pGrana]); 
    
DOF2_SaveFile(); 
    return 
1

PS: Ao carregar os dados, vocк deve usar get, nгo set.
Reply
#4

Vlw Galera Consegui =)!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)