Vehicle Licence Plates?
#1

Ok, i put this in my gm and it workd great:
pawn Код:
for(new i=1; i<MAX_VEHICLES; i++)
{
    SetVehicleNumberPlate(i, "PARTY");
}
Now i want to add another if statement that says if its a vehicle without a number plate, it skips the vehicle. How can i do this?
Reply
#2

There isn't any function as "GetVehicleNumberPlate", just turn a variable on every "vehicle's plate change" and check in the loop if is true or false (continue).
Reply
#3

thats not what i mean... but... so.. this will only attempt to change the number plate on a vehicle that has 1? what i meant is:
pawn Код:
for(new i=1; i<MAX_VEHICLES; i++)
{
    if(i == 521, 455, etc.)
    {
        SetVehicleNumberPlate(i, "PARTY");
    }
}
something like that...

also... i load my vehicles like this:

pawn Код:
new total_vehicles_from_files;
    // SPECIAL
    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/trains.txt");
    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/pilots.txt");

    // LAS VENTURAS
    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/lv_law.txt");
    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/lv_airport.txt");
    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/lv_gen.txt");

    // SAN FIERRO
    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/sf_law.txt");
    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/sf_airport.txt");
    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/sf_gen.txt");

    // LOS SANTOS
    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/ls_law.txt");
    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/ls_airport.txt");
    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/ls_gen_inner.txt");
    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/ls_gen_outer.txt");

    // OTHER AREAS
    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/whetstone.txt");
    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/bone.txt");
    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/flint.txt");
    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/tierra.txt");
    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/red_county.txt");

    printf("Total vehicles from files: %d",total_vehicles_from_files);
Reply
#4

Quote:
Originally Posted by sciman001
Посмотреть сообщение
thats not what i mean... but... so.. this will only attempt to change the number plate on a vehicle that has 1? what i meant is:
pawn Код:
for(new i=1; i<MAX_VEHICLES; i++)
{
    if(i == 521, 455, etc.)
    {
        SetVehicleNumberPlate(i, "PARTY");
    }
}
something like that...
I didn't get it... this doesn't change on a vehicle ID 1, this starts a loop on all vehicles, starting from ID 1 and so on...
if you want to skip those ids use
pawn Код:
for(new i=1; i<MAX_VEHICLES; i++)
{
    if(i == 521, 455, etc.) continue;
    {
        SetVehicleNumberPlate(i, "PARTY");
    }
}
Reply
#5

so...
pawn Код:
for(new i=1; i<MAX_VEHICLES; i++)
{
    if(!i == 521, 455, etc.) continue;    
    {
        SetVehicleNumberPlate(i, "PARTY");    
    }
}
This will skip whatever vehicle ids i want? by ids, i mean model ids...
Reply
#6

You could use THIS include to check if the vehicle is a Plane, Boat, Helicopter, etc since they don't have plates and use it to add exceptions. Or make a similar system.
Reply
#7

Why not just set it anyway? It's hardly going to crash the server.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)