[Ajuda] Verificar se nome da string existe.
#1

Pessoal to querendo verificar se o nome da string existe

exemplo:

Conta 1 nгo existe dai vai criar um nome dentro do arquivo do ip com o nome da conta
exemplo: Conta1: DanielPicaGrossa.
Se caso existir o nome dentro do arquivo irб criar outro nome dentro do arquivo tipo
Conta2: DanielRolaGostosa e assim por diante mais nгo consigo

To registrando quantas contas o jogador criou no mesmo IP

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 if(!DOF2_FileExists(DOF2_GetString(String, "Conta1")))
    {
        DOF2_SetString(STG, "Conta1", Nome_Conta(playerid));
        DOF2_SaveFile();       
    }
    else if(!DOF2_FileExists(DOF2_GetString(String, "Conta2")))
    {
        DOF2_SetString(STG, "Conta2", Nome_Conta(playerid));
        DOF2_SaveFile();       
    }
    else if(!DOF2_FileExists(DOF2_GetString(String, "Conta3")))
    {
        DOF2_SetString(STG, "Conta3", Nome_Conta(playerid));
        DOF2_SaveFile();       
    }

Eu fis esse codigo mais tipo quando eu crio uma nova conta no mesmo IP
Nгo aparece o nome Conta1 ou conta 2 dentro do arquivo ini do ip.
Reply
#2

Use a nativa do SA-MP.
https://sampwiki.blast.hk/wiki/File_Functions.
Reply
#3

Quote:
Originally Posted by ipsLuan
Посмотреть сообщение
Cara, nem sei como usar isso.

quero usar com dof2
Reply
#4

Os exemplos estгo lб.
Com DOF2 vai ser um pouco mais complicado...
Reply
#5

Quote:
Originally Posted by ipsLuan
Посмотреть сообщение
Os exemplos estгo lб.
Com DOF2 vai ser um pouco mais complicado...
Faz uma base pra min de acordo com meu code?
Reply
#6

Fiz deste jeito aqui mais sу salva a Conta e a conta 1, eu queria acrescentar a conta2, conta 3 dentro do arquivo do ip.

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();       
    }
Reply
#7

Jб falei nй...
Quote:
Originally Posted by ipsLuan
Посмотреть сообщение
Reply
#8

Quote:
Originally Posted by ipsLuan
Посмотреть сообщение
Jб falei nй...
Fбcil pra vc que tem conhecimento.
Reply
#9

Quote:
Originally Posted by Duk
Посмотреть сообщение
Fбcil pra vc que tem conhecimento.
Se estudares em vez de andares a procura que te faзam o trabalho na mao, tambem se torna simples pra vc.
Reply
#10

Quote:
Originally Posted by PT
Посмотреть сообщение
Se estudares em vez de andares a procura que te faзam o trabalho na mao, tambem se torna simples pra vc.
Fiz deste jeito mais nгo vai cara, nгo funfa. o nome da nova conta nгo aparece no arquivo do ip

pawn Код:
new STG[64], PegarIP[16], string[64];
    new File:Nconta = fopen("InfoJogadores/IPs/%s.ini", io_read);
    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 if(Nconta)
    {
        while(fread(Nconta, string))
        {
            if(strfind(string, "conta1") != -1)
            {
                DOF2_CreateFile(STG);
                DOF2_SetString(STG, "Conta1", Nome_Conta(playerid));
                break;
            }
            else if(strfind(string, "Conta2") != -1)
            {
                DOF2_CreateFile(STG);
                DOF2_SetString(STG, "Conta2", Nome_Conta(playerid));
                break;
            }
                else if(strfind(string, "Conta3") != -1)
            {
                DOF2_CreateFile(STG);
                DOF2_SetString(STG, "Conta3", Nome_Conta(playerid));
                break;
            }                      
        }  
    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)