SA-MP Forums Archive
Licenseplate - 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: Licenseplate (/showthread.php?tid=274011)



Licenseplate - Kenka - 04.08.2011

Hey!)(#
i'm doing a system where you have to write car license plate which is under cars.cfg and last line where i made cPlate ex. ABC 123. When you enter correct text and number (ABC 123) into dialog then something happens.
my little code
pawn Код:
if(dialogid == NEEMO)
        {
            for(new h = 184; h < sizeof(CarInfo); h++)
            {
                new newcar = GetPlayerVehicleID(playerid);
                if(strlen(inputtext) == CarInfo[newcar][cPlate])
                {
                    SendClientMessage(playerid,COLOR_WHITE,"Correct");
                    return 1;
                }
                else
                {
                    SendClientMessage(playerid, COLOR_YELLOW,"Incorrect");
                    return 1;
                }
            }
        }
But when i type correct cPlate (ABC 123) into input dialog it still says me "incorrect"


Re: Licenseplate - PrawkC - 04.08.2011

strlen(inputtext)
to
strval(inputtext)


Re: Licenseplate - Kenka - 04.08.2011

Still says incorrect for every word or number what i write in dialog input.


Re: Licenseplate - iPLEOMAX - 04.08.2011

If cPlate is a string, you should use strcmp();


Re: Licenseplate - MadeMan - 04.08.2011

pawn Код:
if(strcmp(inputtext, CarInfo[newcar][cPlate]) == 0)



Re: Licenseplate - Kenka - 04.08.2011

pawn Код:
if(dialogid == NUMBRIM2RK)
        {
            for(new h = 184; h < sizeof(CarInfo); h++)
            {
                strmid(CarInfo[h][cPlate], inputtext, 0, strlen(string), 255);
                new newcar = GetPlayerVehicleID(playerid);
                if(strcmp(inputtext, CarInfo[newcar][cPlate]) == 0)
                {
                    SendClientMessage(playerid,COLOR_WHITE,"Correct");
                    return 1;
                }
                else
                {
                    SendClientMessage(playerid, COLOR_YELLOW,"Incorrect");
                    return 1;
                }
            }
        }
still not working .


Re: Licenseplate - MadeMan - 04.08.2011

pawn Код:
if(dialogid == NUMBRIM2RK)
        {
            new newcar = GetPlayerVehicleID(playerid);
            if(strcmp(inputtext, CarInfo[newcar][cPlate]) == 0)
            {
                SendClientMessage(playerid,COLOR_WHITE,"Correct");
            }
            else
            {
                SendClientMessage(playerid, COLOR_YELLOW,"Incorrect");
            }
            return 1;
        }



Re: Licenseplate - Kenka - 04.08.2011

Ok, when i open input dialog and just press OK (insert nothing into the dialog)then it says Correct but when i type correct cPlate then it says Incorrect


Re: Licenseplate - Kenka - 04.08.2011

Also i have a fully working licenseplate system