[Ajuda] Salvar nome da conta no arquivo.
#1

Pessoal to fazendo um sistema aqui.

o problema й quando crio a conta 3 e 4, nгo salva o nome dela na pasta dos ips..

sу salva a "Conta" e a "conta1"

pawn Код:
new STG[64], PegarIP[16];

    GetPlayerIp(playerid, PegarIP, 16);

    format(STG, 64, "InfoJogadores/IPs/%s.ini", PegarIP);
   
    if(!DOF2_FileExists(STG))
    {
        DOF2_CreateFile(STG);
        DOF2_SetString(STG, "Conta", Nome_Conta(playerid));
        DOF2_SaveFile();
    }
    else
    {
        DOF2_SetString(STG, "Conta1", Nome_Conta(playerid));
        DOF2_SaveFile();       
    }
    else
    {
        DOF2_SetString(STG, "Conta2", Nome_Conta(playerid));
        DOF2_SaveFile();       
    }
    else
    {
        DOF2_SetString(STG, "Conta3", Nome_Conta(playerid));
        DOF2_SaveFile();       
    }
    else
    {
        DOF2_SetString(STG, "Conta4", Nome_Conta(playerid));
        DOF2_SaveFile();       
    }
    else
    {
        DOF2_SetString(STG, "Conta5", Nome_Conta(playerid));
        DOF2_SaveFile();       
    }
Reply
#2

Para de ser burro e usa a cabeзa!
PHP код:
new STG[64], PegarIP[16];
GetPlayerIp(playeridPegarIP16);
format(STG64"InfoJogadores/IPs/%s.ini"PegarIP);
if(!
DOF2_FileExists(STG)) {
    
DOF2_CreateFile(STG);
}
else {
    
DOF2_SetString(STG"Conta"Nome_Conta(playerid));
    
DOF2_SetString(STG"Conta1"Nome_Conta(playerid));
    
DOF2_SetString(STG"Conta2"Nome_Conta(playerid));
    
DOF2_SetString(STG"Conta3"Nome_Conta(playerid));
    
DOF2_SetString(STG"Conta4"Nome_Conta(playerid));
    
DOF2_SetString(STG"Conta5"Nome_Conta(playerid));
    
DOF2_SaveFile();        

Reply
#3

Quote:
Originally Posted by ipsLuan
Посмотреть сообщение
Para de ser burro e usa a cabeзa!
PHP код:
new STG[64], PegarIP[16];
GetPlayerIp(playeridPegarIP16);
format(STG64"InfoJogadores/IPs/%s.ini"PegarIP);
if(!
DOF2_FileExists(STG)) {
    
DOF2_CreateFile(STG);
}
else {
    
DOF2_SetString(STG"Conta"Nome_Conta(playerid));
    
DOF2_SetString(STG"Conta1"Nome_Conta(playerid));
    
DOF2_SetString(STG"Conta2"Nome_Conta(playerid));
    
DOF2_SetString(STG"Conta3"Nome_Conta(playerid));
    
DOF2_SetString(STG"Conta4"Nome_Conta(playerid));
    
DOF2_SetString(STG"Conta5"Nome_Conta(playerid));
    
DOF2_SaveFile();        

Cara o burro aqui й vocк.

Isso vai fazer salvar o nome do player nos 5 valores

Conta 1 = Duk
Conta 2 = Duk
Conta 3 = duk
conta 4 = duk
conta 5 k

To querendo fazer,

Quero fazer pra cada conta criada no IP, for para um valor

Exemplo:

O fulano do ip 127.0.0.1

Criou a conta Pique_SP
dai ele saiu dessa conta e foi la e criou outra

dai iria comeзar

Conta1 = PiqueRJ
dai ele saiu da dessa conta e foi criar outra
Conta2 = PiqueMG
Reply
#4

Vocк viu o modo que vocк estava fazendo?
Jб falei... Usa https://sampwiki.blast.hk/wiki/File_Functions ou entгo pesquise sobre que vocк acha...
Reply
#5

Quote:
Originally Posted by ipsLuan
Посмотреть сообщение
Vocк viu o modo que vocк estava fazendo?
Jб falei... Usa https://sampwiki.blast.hk/wiki/File_Functions ou entгo pesquise sobre que vocк acha...
Ta difнcil. Faz um pra min? deixo vocк em paz.
Reply
#6

https://sampforum.blast.hk/showthread.php?tid=172073.
Era bem mais fбcil vocк fazer um com File_Functions.
Reply
#7

O Correto seria mais ou menos assim:

PHP код:

stock SalvarConta
(playerid){

    new
        
boolsucess false,
        
pSTR[70],
        
pIP[16]
    ;


    
GetPlayerIp(playeridpIP16);

    
format(pSTR70"InfoJogadores/IPs/%s.ini"pIP);
    {
        static
            
invSTR[16]
        ;

        
// Criamos um arquivo para percorrer  contas de 0 а 1.
        
for(05n; ++i){

                
// Formatamos a string..
                
format(vSTR16"Conta%d"i);


                
// Verificamos se a string "vSTR" estб no arquivo "pSTR".
                // Caso nгo estiver, salva o nome do jogador.
                
if(!DOF2_IsSet(pSTRvSTR)){


                    
DOF2_SetString(pSTRvSTRpIP);
                    
sucess true;
                    break;
                }



        }

    }

    return 
sucess;

Tentem estudar um pouco mais sobre, Lуgica de programaзгo/Algorнtimos e a prуpria livraria DOF2.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)