[QUESTION]How can i make it like this
#1

How can i make it so like when a cop does /mdc they can search the vehicle license plate and once they find the vehicle license plate in mdc it will show all the information of the car.I already got the /mdc part just need to know how to make it so when a cop does /mdc and types the license plate number of the vehicle all information of that car with the license plate number that he types in will pop up??
Reply
#2

i dont think thats possible yet...all i can think of is making every vehicle you have in an unique variable
then the command should open a list of variables/vehicles somehow.
If you wait for the samp update then im sure its easyer
Reply
#3

Ok.thanks for information
Reply
#4

no problem cewl idea by the way are you making a rp gamemode ?
Reply
#5

Ye. it is but its a penls edit but i will make a from scratch gamemode when im not busy.
Reply
#6

You don't need to wait for any update, it is and will be possible with arrays. Yes, you only need to store every license plate in an array, and then use strfind to find which plate matchs with the string you entered.

Something like this:
pawn Код:
#define MAX_LP  9 // let's say 9 characters as maximun license plate length.

new
    VehicleLicensePlate[MAX_VEHICLES][MAX_LP];
   
public OnGameModeInit()
{
    // Let's say we have already created every vehicle, then we need to set a number plate:
    for(new i = 0; MAX_VEHICLES > i; ++ i)
    {
        switch(random(5)) // Sample:
        {
            case 0: SetVehicleNumberPlateEx(i, "abc");
            case 1: SetVehicleNumberPlateEx(i, "acb");
            case 2: SetVehicleNumberPlateEx(i, "bca");
            case 3: SetVehicleNumberPlateEx(i, "cba");
            case 4: SetVehicleNumberPlateEx(i, "bac");
        }
    }
    return 1;
}

stock SetVehicleNumberPlateEx(vehicleid, numberplate[]) // We'd use this function to store numberplates.
{
    SetVehicleNumberPlate(vehicleid, numberplate);
    strcpy(VehicleLicensePlate[vehicleid], numberplate, MAX_LP);
}

CMD:isvalidlp(playerid, cmdtext[])
{
    for(new i = 0; MAX_VEHICLES > i; ++ i) if(strfind(VehicleLicensePlate[i], true) != -1) SendClientMessage(playerid, 0xFFFFFFFF, VehicleLicensePlate[i]);
    return 1;
}
Reply
#7

Nice Miguel im like ..o yea ofcourse why didnt i thought of that.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)