Licence Plate Help
#1

Is there Anyway To Name all Addstaticvehicles Plates to Just [ State ]
I've been trying to figure it Out And There moreless alot I hate to Just do this Statevehicle1 Statevehicle2 and so on..
Is there a simplier way to naming the plates.. on public cars
Reply
#2

I'm not sure what you want, to be honest. Do you want to name all the plates yourself or have random plates for all the static vehicles? If you want random names, you can use this function:
pawn Код:
stock SetRandomVehiclePlates() { // Create a function that'll handle our logic to randomise the plates.
    new szPlate[8]; // Create a variable to hold temperory plate information. (Must be # of chars + 1)

    for(new i; i < MAX_VEHICLES; i++) { // Loop through all the vehicles.
        szPlate[0] = (random(90-65) + 65); // Random between A - Z
        szPlate[1] = (random(90-65) + 65); // Random between A - Z
        szPlate[2] = (random(90-65) + 65); // Random between A - Z
       
        szPlate[3] = ' ';
       
        szPlate[4] = (random(57-48) + 48); // Random between 0 - 9
        szPlate[5] = (random(57-48) + 48); // Random between 0 - 9
        szPlate[6] = (random(57-48) + 48); // Random between 0 - 9
       
        szPlate[7] = '\0'; // State the end of the string.
       
        SetVehicleNumberPlate(i, szPlate); // Set the vehicle's number plate to szPlate.
        SetVehicleToRespawn(i); // Set the vehicle to respawn.
    }
    return 1;
}
You should ideally call it after you finish all your AddStaticVehicles. The output will be like 'ABC 123' but you can customise it easily as I have commented everything.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)