SA-MP Forums Archive
Checking if a string matches, not working? - 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 if a string matches, not working? (/showthread.php?tid=581785)



Checking if a string matches, not working? - Dokins - 15.07.2015

pawn Код:
for(new x = 0; x < MAX_VEHICLES; x++)
                    {
                        if(strcmp(inputtext, VehPlate[x], true))
                        {
                            id = x;
                            printf("ID %d", x);
                            break;
                        }
                    }
I'm looping through all vehicles to check if the plate that I've typed in matches any, this doesn't work at all, it returns 0.

Thanks for any assistance.


Re: Checking if a string matches, not working? - shadowdog - 15.07.2015

It will return 0 if either string is empty. Vehicle IDs start at 1. So start your loop at 1 with: new x = 1.


Re : Checking if a string matches, not working? - Dokins - 15.07.2015

Didn't resolve it.