SA-MP Forums Archive
[Ajuda] Problema com 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] Problema com Strcmp (/showthread.php?tid=544171)



Problema com Strcmp - caiom1999 - 31.10.2014

Olб pessoal e boa tarde, estou fazendo um fs de sistema de carros, e na verificaзгo se o player й dono do carro, o strcmp estб pegando mesmo se o player for o dono do carro.

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(CarroCriado[i] == true)
        {
            PASTA_DONO
            PASTA_CARROS
            new Str1[30], Str2[30];
            format(Str1, sizeof(Str1), "%s", DOF2_GetString(StringDono, "Senha"));
            format(Str2, sizeof(Str2), "%s", DOF2_GetString(StringCarros, "Senha"));
            if(!strcmp(Str1, Str2, false))
            {
                format(String, sizeof(String), "Vocк nгo й o dono deste veнculo, o dono й %s", Nome(i));
                Msg(playerid, Branco, String);
                return 1;
            }
        }
    }
    return 1;
}

Tanto faz se a senha for igual a que estб salva no arquivo ou se for diferente, tanto faz, o strcmp pega de todo jeito, quem puder me ajudar, ficarei grato

Att.


Re: Problema com Strcmp - PT - 31.10.2014

teste:

pawn Код:
if(!(strcmp(Str1, Str2) == 0))



Re: Problema com Strcmp - caiom1999 - 31.10.2014

Funcionou! Obrigado, agora se vocк puder, poderia me explicar porque nгo ter funcionado do outro jeito?


Re: Problema com Strcmp - PT - 31.10.2014

Estava a usar de forma errada o strcmp, olha:

https://sampwiki.blast.hk/wiki/Strcmp