Checking if a string doesn't match, doesn't work?
#4

But he's checking if they 'don't' match, which is the exact opposite. The code you have now is correct, but it will be case sensitive.

So lets say a valid license plate was "ABC123". If you put in 'abc123', it will return true and it will say the license plate does not exist. However if you put 'ABC123', it will return false and the plates will match. To remove this, just change the case sensitivity or 'ignorecase' to true.

If this code doesn't work, then your VehPlate[x] or possibly the loop that you're using it in, is wrong.
pawn Code:
if(strcmp(plate, VehPlate[x], true)) return SendClientMessage(playerid, COLOUR_GREY, "That license plate does not exist.");
Take note, strcmp also returns false if either of the strings is empty.
Reply


Messages In This Thread
Checking if a string doesn't match, doesn't work? - by Dokins - 19.05.2015, 02:11
Re: Checking if a string doesn't match, doesn't work? - by MP2 - 19.05.2015, 02:43
Re: Checking if a string doesn't match, doesn't work? - by Dokins - 19.05.2015, 02:46
Re: Checking if a string doesn't match, doesn't work? - by Threshold - 19.05.2015, 06:59
Re: Checking if a string doesn't match, doesn't work? - by Dokins - 19.05.2015, 09:53

Forum Jump:


Users browsing this thread: 2 Guest(s)