Moin NN,
Der XFireFighter und ich haben uns mal hingesetzt und das Nummernschild System von DE100 nutzbar gemacht.
Copy & Paste ist nicht möglich Quellcode durchlesen und verstehen
Schritt 1:
erstelle eine Datei Namens fn_changePlate.sqf
/*
Author: McKenzie
Edit by: Natic
Description: Allows to Customize the Number Plate of any Vehicle.
*/
params[
["_myPlate","",[""]]
];
private["_query"];
private _myVehicle = CursorTarget;
if (!(_myVehicle isKindOf "Car")) exitWith {
hint format["Du kannst nur an Bodenfahrzeuge das Nummernschild verändern!"];
};
if (_myVehicle distance Player > 6) exitWith {
hint format["Du stehst zu weit weg, um das Nummernschild zu verändern!"];
};
if (side player isEqualTo west) exitWith {
hint format["Du bist im Dienst, lasse lieber die Finge davon"];
};
if (_myPlate isEqualTo " ") exitWith {
hint format ["Das Nummernschild ist ungültig"];
};
life_action_inUse = true;
_action = [
format ["Soll das Nummernschild permanent geändert werden?"],
"Nummernschild - Generator",
localize "STR_Global_Yes",
localize "STR_Global_No"
] call BIS_fnc_guiMessage;
private _oldPlate = getPlateNumber _myVehicle;
if (_action) then {
_query = format["SELECT FROM vehicles (plate) WHERE '%1'",_oldPlate];
diag_log format["Query: %1",_query];
waitUntil{!DB_Async_Active};
[_query,1] call DB_fnc_asyncCall;
_query = format["INSERT INTO vehicles WHERE (plate) '%1'",_myplate];
diag_log format["Query: %1",_query];
waitUntil{!DB_Async_Active};
[_query,1] call DB_fnc_asyncCall;
_myVehicle setPlateNumber _myPlate;
hint format["Du hast dein Nummernschild erfolgreich von %1 in %2 umgemeldet",_oldPlate,_myPlate];
} else {
_myVehicle setPlateNumber _myPlate;
hint format["Du hast dein Nummernschild verändert!"];
};
Alles anzeigen
Schritt 2:
erstelle eine Datei Namens fn_requestOwner.sqf
/*
Author: McKenzie
Edit: Natic
Description: Provides the Owner of the NumberPlate
*/
params [
["_PlateNumber","",[""]]
];
private["_query","_owner","_plate"];
if (!(side player in [WEST,INDEPENDENT])) exitWith {
hint format["Du hast keinen Zugang, zu einem Haltersystem"];
};
if (Vehicle player isEqualTo player) exitWith {
hint format ["Du musst in einem Fahrzeug sitzen um den Bordcomputer bedienen zu können"];
};
if (_PlateNumber isEqualTo " ") exitWith {
Hint format ["Ungültiges Nummernschild"];
};
_query = format["SELECT FROM vehicles (plate) WHERE '%1'",_plate];
diag_log format["Query: %1",_query];
waitUntil{!DB_Async_Active};
[_query,1] call DB_fnc_asyncCall;
if (_plate == _PlateNumber) then {
_query = format["SELECT FROM vehicles (owner) WHERE '%1'",_owner];
diag_log format["Query: %1",_query];
waitUntil{!DB_Async_Active};
[_query,1] call DB_fnc_asyncCall;
hint format["Der Halter des Fahrzeuges ist: %1",_owner];
} else {
hint format["Das Kennzeichen ist ungültig"];
};
Alles anzeigen
Schritt 3:
erstelle eine Datei Namens fn_checkPlate.hpp
class checkPlate
{
idd =4001;
movingenable = 0;
class Controlsbackground
{
class TBackground: Life_RscText
{
idc = -1;
x = 0.333298 * safezoneW + safezoneX;
y = 0.346 * safezoneH + safezoneY;
w = 0.335156 * safezoneW;
h = 0.286 * safezoneH;
colorBackground[] = {1,1,1,0.3};
colorActive[] = {1,1,1,0.3};
text = "";
};
class THeader: Life_RscText
{
idc = -1;
text = "Straßenverkehrsamt - Halterabfrage"; //--- ToDo: Localize;
x = 0.42 * safezoneW + safezoneX;
y = 0.379 * safezoneH + safezoneY;
w = 0.228 * safezoneW;
h = 0.044 * safezoneH;
colorText[] = {0,1,0,0.8};
colorBackground[] = {1,1,1,0};
colorActive[] = {1,1,1,0.3};
sizeEx = 0.06;
};
};
class Controls
{
class TButton: Life_RscButton
{
idc = -1;
text = "Schließen"; //--- ToDo: Localize;
x = 0.572187 * safezoneW + safezoneX;
y = 0.577 * safezoneH + safezoneY;
w = 0.0876563 * safezoneW;
h = 0.033 * safezoneH;
colorBorder[] = {0,1,0,0.3};
colorDisabled[] = {0,1,0,0.3};
colorBackground[] = {0,1,0,0.3};
colorBackgroundDisabled[] = {0,1,0,0.3};
colorBackgroundActive[] = {0,1,0,0.3};
colorFocused[] = {0,1,0,0.5};
colorActive[] = {0,1,0,0.5};
action = "closeDialog 0;";
};
class TButton2: Life_RscButton
{
idc = -1;
text = "Überprüfen"; //--- ToDo: Localize;
x = 0.45875 * safezoneW + safezoneX;
y = 0.577 * safezoneH + safezoneY;
w = 0.0876563 * safezoneW;
h = 0.033 * safezoneH;
colorBorder[] = {0,1,0,0.3};
colorDisabled[] = {0,1,0,0.3};
colorBackground[] = {0,1,0,0.3};
colorBackgroundDisabled[] = {0,1,0,0.3};
colorFocused[] = {0,1,0,0.5};
colorBackgroundActive[] = {0,1,0,0.3};
colorActive[] = {0,1,0,0.5};
tooltip = "Bitte beachte, dass das Kennzeichen geklaut sein könnte"; //--- ToDo: Localize;
action = "([ctrlText 5001]) call mis_fnc_requestOwner;closeDialog 0;";
};
class TPlateNumber: Life_RscEdit
{
idc = 5001;
text = "";
x = 0.365937 * safezoneW + safezoneX;
y = 0.467 * safezoneH + safezoneY;
w = 0.273281 * safezoneW;
h = 0.033 * safezoneH;
colorBackground[] = {1,1,1,0.8};
colorActive[] = {1,1,1,0.8};
};
};
};
Alles anzeigen
Schritt 4:
Erstelle eine Datei Namens numberPlate.hpp
class numberPlate
{
idd =4000;
movingenable = 0;
class Controlsbackground
{
class TBackground: Life_RscText
{
idc = 2200;
x = 0.333298 * safezoneW + safezoneX;
y = 0.346 * safezoneH + safezoneY;
w = 0.335156 * safezoneW;
h = 0.286 * safezoneH;
colorBackground[] = {1,1,1,0.3};
colorActive[] = {1,1,1,0.3};
text = "";
};
class THeader: Life_RscText
{
idc = 1000;
text = "Nummernschild Generator"; //--- ToDo: Localize;
x = 0.391094 * safezoneW + safezoneX;
y = 0.379 * safezoneH + safezoneY;
w = 0.228 * safezoneW;
h = 0.044 * safezoneH;
colorText[] = {0,1,0,0.8};
colorBackground[] = {1,1,1,0};
colorActive[] = {1,1,1,0.3};
sizeEx = 0.06;
};
};
class Controls
{
class TButton: Life_RscButton
{
idc = 1600;
text = "Schließen"; //--- ToDo: Localize;
x = 0.572187 * safezoneW + safezoneX;
y = 0.577 * safezoneH + safezoneY;
w = 0.0876563 * safezoneW;
h = 0.033 * safezoneH;
colorBorder[] = {0,1,0,0.3};
colorDisabled[] = {0,1,0,0.3};
colorBackground[] = {0,1,0,0.3};
colorBackgroundDisabled[] = {0,1,0,0.3};
colorBackgroundActive[] = {0,1,0,0.3};
colorFocused[] = {0,1,0,0.5};
colorActive[] = {0,1,0,0.5};
action = "closeDialog 0;";
};
class TButton3: Life_RscButton
{
idc = 1602;
text = "Hilfe"; //--- ToDo: Localize;
x = 0.345313 * safezoneW + safezoneX;
y = 0.577 * safezoneH + safezoneY;
w = 0.0876563 * safezoneW;
h = 0.033 * safezoneH;
colorBorder[] = {0,1,0,0.3};
colorDisabled[] = {0,1,0,0.3};
colorBackground[] = {0,1,0,0.3};
colorBackgroundDisabled[] = {0,1,0,0.3};
colorBackgroundActive[] = {0,1,0,0.3};
colorFocused[] = {0,1,0,0.5};
colorActive[] = {0,1,0,0.5};
action = "Hint format [""mit diesem Werkzeug, kannst du das KFZ-Kennzeichen eines Autos manipulieren, dazu muss du nahe an das Auto heran und das Item nutzen. Beachte, dass du Kennzeichen von anderen Fahrzeugen nutzen kannst um deine Identität zu verschleiern. Leider haben nicht alle Arma 3 Autos ein Kennzeichen""];";
};
class TButton2: Life_RscButton
{
idc = 1601;
text = "Anpassen"; //--- ToDo: Localize;
x = 0.45875 * safezoneW + safezoneX;
y = 0.577 * safezoneH + safezoneY;
w = 0.0876563 * safezoneW;
h = 0.033 * safezoneH;
colorBorder[] = {0,1,0,0.3};
colorDisabled[] = {0,1,0,0.3};
colorBackground[] = {0,1,0,0.3};
colorBackgroundDisabled[] = {0,1,0,0.3};
colorFocused[] = {0,1,0,0.5};
colorBackgroundActive[] = {0,1,0,0.3};
colorActive[] = {0,1,0,0.5};
tooltip = "Bitte beachte, dass das Kennzeichen max 12 - 15 Zeichen haben sollte, weiterhin besitzen nicht alle Fahrzeuge ein sichtbares Kennzeichen!"; //--- ToDo: Localize;
action = "([ctrlText 5000]) call mis_fnc_changePlate;closeDialog 0;";
};
class TPlateNumber: Life_RscEdit
{
idc = 5000;
text = "";
x = 0.365937 * safezoneW + safezoneX;
y = 0.467 * safezoneH + safezoneY;
w = 0.273281 * safezoneW;
h = 0.033 * safezoneH;
colorBackground[] = {1,1,1,0.8};
colorActive[] = {1,1,1,0.8};
};
};
};
Alles anzeigen
Schritt 5:
Erstelle eine Datei namens fn_getPlateNumber.sqf
/*
Author: McKenzie
Edit by: Natic
Description: gets the license Plate Number of Any Vehicle
*/
private _checkVehicle = CursorTarget;
if ((Vehicle player != player) && (_checkVehicle distance player > 25) ) exitWith {
hint format ["Du bist zu weit weg um das Kennzeichen eindeutig zu lesen."];
};
if ((_checkVehicle distance player > 20) && (!(currentWeapon player in ["Binocular", "Rangefinder"])) && (Vehicle player isEqualTo player)) exitWith {
hint format ["Du bist zu weit weg um das Kennzeichen eindeutig zu lesen. Nehme ein Binocular oder einen Rangefinder in die Hand"];
};
if ((_checkVehicle distance player > 50) && (currentWeapon player in ["Binocular", "Rangefinder"]) && (Vehicle player isEqualTo player)) exitWith {
hint format ["Du bist zu weit weg um das Kennzeichen eindeutig zu lesen."];
};
_checkVehiclePlate = getPlateNumber _checkVehicle;
hint format ["Du konntest folgendes Kennzeichen entziffern: %1",_checkVehiclePlate];
Alles anzeigen
Dinge wie Einträge in der Functions.hpp, Master_Handle.hpp und der rest sollte selbsterklärend sein
Weiterentwicklungen wie Items für Manipulation des Nummernschildes und oder das Abfragen via Knopfdruck sollte ebenfalls selbsterklärend sein, wenn man die SuFu von NN nutzt
Fragen?? Erst Sufu dann Kommentar
Mit freundlichen Grüßen Natic & XFireFighter