lundi 18 juillet 2016

Inputtext

Hi, I've just fixed the "View Vehicle" thing in MDC in my script, it seems to work, but the problem is it says "License Plate: OE" for every license plate I scan (inputtext).
Here's the code:

Code:

Dialog:ViewVehicle(playerid, response, listitem, inputtext[])
{
        if (GetFactionType(playerid) != FACTION_POLICE || !IsACruiser(GetPlayerVehicleID(playerid)))
            return 0;

        if (response)
        {
                static
                        query[128];

            if (strlen(inputtext) < 7)
                return Dialog_Show(playerid, ViewVehicle, DIALOG_STYLE_INPUT, "View Vehicle", "Error: Invalid license plate format specified (default format: AAAA000).\n\nPlease enter the license plate of the vehicle:", "Submit", "Back");
                
                for (new carid = 0; carid != MAX_DYNAMIC_CARS; carid ++)
                {
                        if (!strcmp(CarData[carid][carPlate], inputtext))
                        {
                                format(query, sizeof(query), "SELECT `Character` FROM `characters` WHERE `ID` = '%d'", CarData[carid][carOwner]);
                                mysql_tquery(g_iHandle, query, "OnVehicleLookup", "dds", playerid, carid, inputtext);
                        }
                }
        }
        else cmd_mdc(playerid, "\1");
        return 1;
}


forward OnVehicleLookup(extraid, carid, plate);
public OnVehicleLookup(extraid, carid, plate)
{
    new
                rows,
                fields,
                owner[24],
                vehicleinfo[84],
                model = GetVehicleModel(Car_GetRealID(carid));

        cache_get_data(rows, fields, g_iHandle);
                
        if (rows) {
                cache_get_row(0, 0, owner, g_iHandle);
                format(vehicleinfo, sizeof(vehicleinfo), "License Plate: %s\nModel: %s\nOwner: %s", plate, ReturnVehicleModelName(model), owner);
        }
        else format(vehicleinfo, sizeof(vehicleinfo), "License Plate: %s\nVehicle was not found in the database.", plate);
        
        Dialog_Show(extraid, ShowOnly, DIALOG_STYLE_MSGBOX, "View Vehicle", vehicleinfo, "Close", "", plate);
        return 1;
}
What's wrong with it?

Let's block ads! (Why?)



Inputtext

Aucun commentaire:

Enregistrer un commentaire