Licenseplate
#1

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"
Reply
#2

strlen(inputtext)
to
strval(inputtext)
Reply
#3

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

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

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

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 .
Reply
#7

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;
        }
Reply
#8

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
Reply
#9

Also i have a fully working licenseplate system
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)