SA-MP Forums Archive
LSPD can find the Vehicle Plate(strcmp problem) - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: LSPD can find the Vehicle Plate(strcmp problem) (/showthread.php?tid=223942)



LSPD can find the Vehicle Plate(strcmp problem) - SkizzoTrick - 10.02.2011

Hello everyone,
I just made the dialog wich helps the LSPD to find peoples by Vehicle Plates(intelexe's RP)

pawn Код:
if(dialogid == 6)
    {
        for(new i=1; i<MAX_VEHICLES; i++)
        {
            if(strcmp(inputtext,CarInfo[i][cPlate],true))
            {
                if(CarInfo[i][cOwned] == 1)
                {
                    SendClientMessage(playerid,COLOR_GREEN,"|_________Vehicle Information(plate)________|");
                    format(string,sizeof(string),"Vehicle Owner:%s   Ticket:%d",CarInfo[i][cOwner],CarInfo[i][cParkTicket]);
                    SendClientMessage(playerid, COLOR_GRAD2,string);
                    format(string, sizeof(string), "Vehicle Ticket Value : $%d  Ticket Officer:%s",CarInfo[i][cParkTicket], CarInfo[i][cTicketer]);
                    SendClientMessage(playerid, COLOR_GRAD2,string);
                }
            }
        }
    }
It is working perfectly but it shows all the vehicles,not the one wich was requested by the plate.


Re: LSPD can find the Vehicle Plate(strcmp problem) - Kwarde - 10.02.2011

Try replacing "if(strcmp(inputtext,CarInfo[i][cPlate],true))" for

pawn Код:
if(!strcmp(inputtext, CarInfo[i][cPlate]))



Re: LSPD can find the Vehicle Plate(strcmp problem) - SkizzoTrick - 10.02.2011

I guess it is gonna work xD
I'll test it later cuz i g2g now,thanks alot


Re: LSPD can find the Vehicle Plate(strcmp problem) - Kwarde - 10.02.2011

Jo.

btw, I suggest you to read this: https://sampforum.blast.hk/showthread.php?tid=199796
Quote:

If the two strings that you are comparing match, strcmp will return 0. If they dont match, they will return either -1 or 1, depending on the way you have your strings postioned (first or second place).

So, the code looked like this:

if(strcmp(inputtext,CarInfo[i][cPlate],true)) RETURN 0

That's why to put an explaination mark in front of it:
RETURN FALSE FALSE. (math: -- is +, so FALSE FALSE is TRUE).
Do you understand it? - If you use strcmp, use 'if(!strcmp(string1, string2))' and if you check if it is EXACT the same (with intensive case too) use 'if(!strcmp(string1, string2, false))'

- Kevin


Re: LSPD can find the Vehicle Plate(strcmp problem) - SkizzoTrick - 11.02.2011

Quote:
Originally Posted by Kwarde
Посмотреть сообщение
Jo.

btw, I suggest you to read this: https://sampforum.blast.hk/showthread.php?tid=199796


So, the code looked like this:

if(strcmp(inputtext,CarInfo[i][cPlate],true)) RETURN 0

That's why to put an explaination mark in front of it:
RETURN FALSE FALSE. (math: -- is +, so FALSE FALSE is TRUE).
Do you understand it? - If you use strcmp, use 'if(!strcmp(string1, string2))' and if you check if it is EXACT the same (with intensive case too) use 'if(!strcmp(string1, string2, false))'

- Kevin
Thanks xD
It worked