SA-MP Forums Archive
[Ajuda] STRCMP - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] STRCMP (/showthread.php?tid=605254)



STRCMP - ERICcartmanN - 16.04.2016

to criando um sistema de clan em dialog mas to travado nessa parte alguйm da um help

eu quero verificar se o player digitar o nome de um clг que jб existe manda uma mensagem falando que jб existe, mais qualquer coisa que eu coloco fala que existe.

pawn Code:
for(new x = 0; x < MAX_CLANS; x ++)
    {
   
    if(strcmp(inputtext , PlayerClan[x][NomeClan], true) == 0) return SendClientMessage(playerid, -1, "Esse clг jб existe.");
    }



Re: STRCMP - ERICcartmanN - 17.04.2016

upp


Re: STRCMP - ZEDD666 - 17.04.2016

Fiz em zcmd+sscanf mais ai vocк pode adapta, Funciona normalmente

Code:
CMD:beta(playerid, params[])
{
    if(sscanf(params, "s", params))
        return SendClientMessage(playerid, -1, "/beta [nome do clг]");

    new string[64];
    format(string, 64, "Clan/%s.ini", params);
    new File: hFile = fopen(string, io_read);
    if (hFile)
    {
        SendClientMessage(playerid, -1, "Este nome de clг jб existe!");
        return 1;
    }

    new file[155];
    format(file, sizeof(file), "Clan/%s.ini", params);
    DOF2::CreateFile(file);
    DOF2::SetString(file, "Clг", params);
    DOF2::SaveFile();
    return 1;
}



Re: STRCMP - ERICcartmanN - 17.04.2016

eu salvo em id ou seja
pawn Code:
Clans/%d.ini
por isso o motivo daquele loop


Re: STRCMP - ZEDD666 - 17.04.2016

Quote:
Originally Posted by ERICcartmanN
View Post
eu salvo em id ou seja
pawn Code:
Clans/%d.ini
por isso o motivo daquele loop
Entendi agora jovem


Re: STRCMP - ERICcartmanN - 17.04.2016

assim foi normalmente

mais qual a diferenзa disso

pawn Code:
// metodo 1 funcionou
   
    for(new x; x < MAX_CLANS; x ++)
    {

    format( ClanFile , sizeof( ClanFile ), "Clans/%d.ini", x);

    if(DOF2_FileExists( ClanFile )) if( strcmp ( text , PlayerClan[x][NomeClan] , true ) == 0 ) return SendClientMessage(playerid, -1, "Jб existe esse clan");

    }

    // metodo 2 funcionou tbm
    for(new x; x < MAX_CLANS; x ++)
    {

    format( ClanFile , sizeof( ClanFile ), "Clans/%d.ini", x);

    if(DOF2_FileExists( ClanFile )) if( strcmp ( text , DOF2_GetString(ClanFile,"NomeDoClan") , true ) == 0 ) return SendClientMessage(playerid, -1, "Jб existe esse clan");

    }
algum desses ganha velocidade?