SA-MP Forums Archive
Checking two things with strcmp and doing the same thing? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Checking two things with strcmp and doing the same thing? (/showthread.php?tid=373807)



Checking two things with strcmp and doing the same thing? - linuxthefish - 31.08.2012

EDIT:

How can I check the whole string, and not just the first word?

pawn Код:
if(!strcmp(message, "bear", false) || !strcmp(message, "dog", false))
    {
        //user said an animal name!
        return 1;
    }



Re: Checking two things with strcmp and doing the same thing? - Misiur - 31.08.2012

pawn Код:
if(!strcmp(message, "bear", false)) || (!strcmp(message, "dog", false))
//Changes to
if(!strcmp(message, "bear", false)) || (!strcmp(message, "dog", false)))



Re: Checking two things with strcmp and doing the same thing? - linuxthefish - 31.08.2012

Fixed, i had a extra )...

pawn Код:
if(!strcmp(message, "bear", false)||!strcmp(message, "dog", false))
    {
        //user said an animal name!
        return 1;
    }



Re: Checking two things with strcmp and doing the same thing? - linuxthefish - 31.08.2012

Updated first post...


Re: Checking two things with strcmp and doing the same thing? - Misiur - 31.08.2012

if(-1 != strfind(message, "bear", false) || -1 != strfind(message, "dog", false))