Quantcast
Channel: SA-MP Forums
Viewing all articles
Browse latest Browse all 18226

[Ajuda] Salva Dados do player

$
0
0
Bom galera estou editando uma gm e estou tentando por para Cada conta salva o uiltimo login efeituado e não estou conseguindo alguém pode me ajuda-lo pfv :(

PHP Code:

new    Hora[MAX_PLAYERS];
new 
Minuto[MAX_PLAYERS];
new 
Ano[MAX_PLAYERS];
new 
Mes[MAX_PLAYERS];
new 
Dia[MAX_PLAYERS]; 

PHP Code:

stock CriarConta(playerid,password[])
{
    new 
arq[36];
    
format(arq,36,"/acc/%s.ini",GetName(playerid));
    
DOF2_CreateFile(arq,password);
    
DOF2_SetInt(arq,"Admin",0);
    
DOF2_SetInt(arq,"Skin",0);
    
DOF2_SetInt(arq,"Matou",0);
    
DOF2_SetInt(arq,"Morreu",0);
    
DOF2_SetInt(arq,"Clan",0);
    
DOF2_SetInt(arq,"Recorde",0);
    
DOF2_SetInt(arq,"RecordeSpree",0);
    
DOF2_SetInt(arq,"Losses",0);
    
DOF2_SetInt(arq,"Wins",0);
    
DOF2_SetInt(arq"Ano"0);
    
DOF2_SetInt(arq"Mês"0);
    
DOF2_SetInt(arq"Dia"0);
    
DOF2_SetInt(arq"Hora"0);
    
DOF2_SetInt(arq"Minuto",  0);
    
DOF2_SaveFile();
    
ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Seja bem vindo","{22FF22}Sua conta foi criada!\nDigite sua senha para continuar!","Login","Sair");
}

stock CarregarConta(playerid,password[])
{
    new 
arq[36];
    
format(arq,36,"/acc/%s.ini",GetName(playerid));
    if(
DOF2_CheckLogin(arq,password))
    {
        
Player[playerid][matou] = 0;
        
Player[playerid][morreu] = 0;
        
Player[playerid][admin] = 0;
        
Recorde[playerid] = 0;
        
Player[playerid][wins] = 0;
        
Player[playerid][losses] = 0;
        
RecordeSpree[playerid] = 0;
        
SetPlayerScore(playerid,0);
        
Player[playerid][wins] = DOF2_GetInt(arq,"Wins");
        
Player[playerid][losses] = DOF2_GetInt(arq,"Losses");
        
Recorde[playerid] = DOF2_GetInt(arq,"Recorde");
        
RecordeSpree[playerid] = DOF2_GetInt(arq,"RecordeSpree");
        
Player[playerid][matou] = DOF2_GetInt(arq,"Matou");
        
Player[playerid][morreu] = DOF2_GetInt(arq,"Morreu");
        
Player[playerid][admin] = DOF2_GetInt(arq,"Admin");
        
HudColor[playerid] = DOF2_GetInt(arq,"HUD");
        
SetPlayerScore(playerid,DOF2_GetInt(arq,"Score"));
        
DOF2_SetInt(arq,"Logins",DOF2_GetInt(arq,"Logins") + 1);
        
DOF2_SetInt(arq"Minuto",  Minuto[playerid]);
        
DOF2_SetInt(arq"Hora"Hora[playerid]);
        
DOF2_SetInt(arq"Dia"Dia[playerid]);
        
DOF2_SetInt(arq"Mês"Mes[playerid]);
        
DOF2_SetInt(arq"Ano"Ano[playerid]);
        new 
ip[16];
        
GetPlayerIp(playerid,ip,16);
        
DOF2_SetString(arq,"IP",ip);
        
DOF2_SaveFile();
        
skine[playerid] = DOF2_GetInt(arq,"Skin");
        
Logado[playerid] = true;
        new 
welcome[150];
        
format(welcome,150,"{962020}(INFO) Novo Player: {FFFFFF}%s {FFFF00}ID:{FFFFFF} %d {FFFF00}Logins: {FFFFFF}%d $d/%d/%d $d",GetName(playerid),playerid,DOF2_GetInt(arq,"Dia"), playerid,DOF2_GetInt(arq,"Mês"), playerid,DOF2_GetInt(arq,"Ano"), playerid,DOF2_GetInt(arq,"Logins"));
        
SendClientMessageToAll(verde,welcome);
        
Atualizar(playerid,HudColor[playerid]);
        
SpawnPlayer(playerid);
    }
    else 
ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Seja bem vindo!","{FF2222}Senha incorreta! For favor tente novamente...","Login","Sair");
}

stock SalvarConta(playerid)
{
    new 
arq[36];
    
format(arq,sizeof arq,"/acc/%s.ini",GetName(playerid));
    
DOF2_SetInt(arq,"Matou",Player[playerid][matou]);
    
DOF2_SetInt(arq,"Morreu",Player[playerid][morreu]);
    
DOF2_SetInt(arq,"Admin",Player[playerid][admin]);
    
DOF2_SetInt(arq,"Skin",skine[playerid]);
    
DOF2_SetInt(arq,"Wins",Player[playerid][wins]);
    
DOF2_SetInt(arq,"Losses",Player[playerid][losses]);
    
DOF2_SetInt(arq,"RecordeSpree",RecordeSpree[playerid]);
    
DOF2_SetInt(arq,"Recorde",Recorde[playerid]);
    
DOF2_SetInt(arq,"Score",GetPlayerScore(playerid));
    
DOF2_SetInt(arq,"HUD",HudColor[playerid]);
    
DOF2_SetInt(arq"Minuto",  Minuto[playerid]);
    
DOF2_SetInt(arq"Hora"Hora[playerid]);
    
DOF2_SetInt(arq"Dia"Dia[playerid]);
    
DOF2_SetInt(arq"Mês"Mes[playerid]);
    
DOF2_SetInt(arq"Ano"Ano[playerid]);
    new 
ip[16];
    
GetPlayerIp(playerid,ip,sizeof ip);
    
DOF2_SetString(arq,"IP",ip);
    
DOF2_SaveFile();



Viewing all articles
Browse latest Browse all 18226

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>