strcmp problem. [Unsolved]
#1

Basically, I'm trying to use the strcmp function in a 'for' loop until it finds what it's looking for. I was making a vehicle MDC system using registration plates and such and I'm having a problem with strcmp. If I enter the correct registration it will show the correct vehicle registration. If I don't, it show's the same thing as if it was correct just with empty variables, as I will show below.

pawn Код:
Dialog:VehicleMDC(playerid, response, listitem, inputtext[])
{
    if(response)
    {
        for(new i=0;i<MAX_CARS;i++)
        {
            if(strcmp(VehicleData[i][vPlate], inputtext, true) == 0)
            {
                new string[64];
                //IC INFO (I haven't finished this yet, I was just testing it and it doesn't work)
                format(string,sizeof(string),"Vehicle Registration: %s\n\n\n",VehicleData[i][vPlate]);
                ShowDialog(playerid, MDC_VehicleShow, DIALOG_STYLE_MSGBOX,"MDC: Vehicle Database",string,"Continue","Back");
                break;
            }
        }
    }
    else return 1;
}
Here are some screenshots of the problem.

WHEN I TYPE A VALID REGISTRATION:



WHEN I TYPE AN INVALID REGISTRATION:



Basically it shows the dialog when it shouldn't. It should just stop the loop and then nothing else should happen.
Reply


Messages In This Thread
strcmp problem. [Unsolved] - by TheCoopster - 31.12.2014, 15:50
Re: strcmp problem. [Unsolved] - by TheCoopster - 31.12.2014, 16:24
Re: strcmp problem. [Unsolved] - by Vince - 31.12.2014, 16:47
Re: strcmp problem. [Unsolved] - by TheCoopster - 31.12.2014, 19:18

Forum Jump:


Users browsing this thread: 2 Guest(s)