Jump to content
Hyper4u.'<3

[Tutorial] Vehicle License Plate

Recommended Posts

Version: Only tested with 5.0

Difficulty: Easy

Note: This will not replace already existing vehicles number plates with new ones.

 

Open fn_vehicleShopBuy.sqf and add this code under _vehicle disableTIEquipment true; //No Thermals.. They're cheap but addictive.

_select1 = selectRandom ["A","B","C","D","E","F","G","H","J","K","L","M","N","O","P","R","S","T","U","W","X","Y","Z"];
_select2 = selectRandom ["A","B","C","D","E","F","G","H","J","K","L","M","N","O","P","R","S","T","U","W","X","Y","Z"];
_select3 = selectRandom ["A","B","C","D","E","F","G","H","J","K","L","M","N","O","P","R","S","T","U","W","X","Y","Z"];
_select4 = selectRandom ["1","2","3","4","5","6","7","8","9","0"];
_select5 = selectRandom ["1","2","3","4","5","6","7","8","9","0"];
_select6 = selectRandom ["1","2","3","4","5","6","7","8","9","0"];
private _plate = format["%1%2%3 %4%5%6",_select1,_select2,_select3,_select4,_select5,_select6];
_vehicle setPlateNumber _plate;

and in the same file scroll down further til you find if (_mode) then { then add _plate after _colorIndex in the arrays remember to separate with a comma.

 

Go to fn_vehicleCreate.sqf in life_server and comment out _plate = round(random(1000000)); 

in the same file add _plate = [_this,4,"",[""]] call BIS_fnc_param;

 

Go to fn_insertVehicle.sqf in life_server and replace ["_plate",-1,[0]] with "_plate"

and in the same file find || _plate isEqualTo -1) exitWith {}; and change it to || _plate isEqualTo "") exitWith {};

 

Go to fn_spawnVehicle.sqf in life_server and find private _wasIllegal = _vInfo select 13; and add private _plateNumber = _vInfo select 7; directly under.

in the same file go to //Reskin the vehicle and add _vehicle setPlateNumber _plateNumber; directly under.

 

Now go back to the mission file and go to fn_impoundMenu.sqf and find _tmp = [(_x select 2),(_x select 8)]; and add (_x select 7) to the array and remember to separate with a comma.

 

Now go to fn_garageLBChange.sqf and find " +(localize "STR_Shop_Veh_UI_Color")+ " %8<br/> and add " +("License Plate:")+ " %9<br/> directly under.

in the same file find _vehicleColor add a comma after _vehicleColor and then add _numberPlate directly under.

now again in the same file find _classNameLife = className; and add _numberPlate = (_dataArr select 2); under.

and make sure to add "_numberPlate" to the private array and REMEMBER to separate by a comma.

 

Last but not least run this code in your database:

ALTER TABLE vehicles MODIFY plate varchar(7) NOT NULL

 

 

Edited by Hyper4u.'<3
  • Like 1

Share this post


Link to post
Share on other sites

As mentioned in another topic, why not just use the Arma generated plates instead of creating your own? It requires less code, runs faster, and is done for you.

Edited by Fawks

Share this post


Link to post
Share on other sites
5 minutes ago, Fawks said:

As mentioned in another topic, why not just use the Arma generated plates instead of creating your own? It requires less code, runs faster, and is done for you.

If you dislike the way the script is made feel free to make your own tutorial, nobody is stopping you.

Share this post


Link to post
Share on other sites

I never said I disliked it (I mentioned it was a good script in the other conversation). You answered the question of "why use this instead of that" in the other conversation after I typed here. In any case, not trying to bash your script just saying that there are other ways of doing it that don't require as much scripting.

Edited by Fawks
  • Like 2

Share this post


Link to post
Share on other sites

Hi, i have some prob with the script, i've made and check 3 times that everithing is in order, on a vanilla 5.0, but i can't access to sql now, give the log of extDB3 here, think that may u can help me, ty!

Spoiler


extDB3: https://bitbucket.org/torndeco/extdb3/wiki/Home
extDB3: Version: 1.025
extDB3: Windows Version
Message: All development for extDB3 is done on a Linux Dedicated Server
Message: If you would like to Donate to extDB3 Development
Message: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2SUEFTGABTAM2
Message: Also leave a message if there is any particular feature you would like to see added.
Message: Thanks for all the people that have donated.
Message: Torndeco: 18/05/15


extDB3: Found extdb3-conf.ini
extDB3: Detected 8 Cores, Setting up 6 Worker Threads
extDB3: ...
extDB3: ...
extDB3: ...
extDB3: ...
extDB3: ...
extDB3: ...


[01:59:51:421705 -03:00] [Thread 16648] extDB3: SQL: Initialized: Add Quotes around TEXT Datatypes mode: 2
[01:59:51:422142 -03:00] [Thread 16648] extDB3: SQL: Initialized: NULL = ""
[01:59:51:422202 -03:00] [Thread 16648] extDB3: Locked

 

 

Share this post


Link to post
Share on other sites

Those errors wouldn't cause his issue. Those are (I assume) caused by him using A3L stuff. @Nezel did you follow the last step of modifying your database? If you are trying to use this on modded cars they may use a different license plate system than default Arma if so this script won't work.

Edited by Fawks

Share this post


Link to post
Share on other sites

Yeah my prob is not on the strings, cause i've the sv working before this, i leave the plate state, i think is fine. Plate is varchar and Lenght 7, and obviously not null.

1507753175_Sinttulo.png.7886bbfe6be1cc655d2f3f564234417e.png

Share this post


Link to post
Share on other sites

Change this

[_uid,_side,_type,_classname,_color,_plate] call DB_fnc_insertVehicle;

_plate = [_this,4,"",[""]] call BIS_fnc_param;

To

_plate = [_this,4,"",[""]] call BIS_fnc_param;
[_uid,_side,_type,_classname,_color,_plate] call DB_fnc_insertVehicle;

In your fn_vehicleCreate.sqf

Share this post


Link to post
Share on other sites

Not working, now in my rtp says this

Quote

Error in expression <"STR_Shop_Veh_UI_Color")+ " %8<br/>
    " + ("Lice nse Plate:")+ " %9< br/>
  Error position: < ("Lice nse Plate:")+ " %9< br/>
  Error Invalid number in expression
File dialog\function\fn_garageLBChange.sqf [life_fnc_garageLBChange]..., line 118
Error in expression <"STR_Shop_Veh_UI_Color")+ " %8<br/>
    " + ("Lice nse Plate:")+ " %9< br/>
  Error position: < ("Lice nse Plate:")+ " %9< br/>
  Error Invalid number in expression
File dialog\function\fn_garageLBChange.sqf [life_fnc_garageLBChange]..., line 118
Error in expression <);
_tmp = [(_x select 2),(_x select 8),( _x sele ct 7 )];
_tmp = str(_t>
  Error position: < _x sele ct 7 )];
_tmp = str(_t>
  Error Invalid number in expression
File dialog\function\fn_impoundMenu.sqf [life_fnc_impoundMenu]..., line 83
Error in expression <);
_tmp = [(_x select 2),(_x select 8),( _x sele ct 7 )];
_tmp = str(_t>
  Error position: < _x sele ct 7 )];
_tmp = str(_t>
  Error Invalid number in expression
File dialog\function\fn_impoundMenu.sqf [life_fnc_impoundMenu]..., line 83

On 8/9/2019 at 4:38 PM, Fawks said:

Change this

[_uid,_side,_type,_classname,_color,_plate] call DB_fnc_insertVehicle;

_plate = [_this,4,"",[""]] call BIS_fnc_param;

To

_plate = [_this,4,"",[""]] call BIS_fnc_param;
[_uid,_side,_type,_classname,_color,_plate] call DB_fnc_insertVehicle;

In your fn_vehicleCreate.sqf

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...