Script: Fahrzeug Versicherungen
Version: Altis Life 4.4r3/4.5
Schiwerigkeitsgrad: Medium
Funktionen:
~ Fahrzeuge versichern (bei Zerstörung wieder in der Garage)
Rechtliche Hinweise (Copyright):
Dieses Script stammt aus dem altisliferpg.com Forum und wurde dort von Shakir Darwish veröffentlicht. Alle Credits gehen an ihn, ich übersetze das Tutorial lediglich.
Zum ursprünglichen Tutorial: http://www.altisliferpg.com/index.php?/top…insurance-44r3/
Nun zum eigentlichen Teil dieses Posts...
Anleitung:
- Öffnet eure dialog\impound.hpp und fügt nach class SellCar folgendes ein:
- Erstellt eine neue Datei fn_insureCar.sqf im Ordner dialog\function mit folgendem Inhalt:C
Alles anzeigen#include "..\..\script_macros.hpp" /* File: fn_insureCar.sqf Author: Guit0x "Lintox" Description: Insure a vehicle from the garage. */ private["_vehicle","_vehicleLife","_vid","_pid","_unit","_multiplier","_price","_purchasePrice","_insurancePrice"]; disableSerialization; if ((lbCurSel 2802) isEqualTo -1) exitWith {hint localize "STR_Global_NoSelection"}; _vehicle = lbData[2802,(lbCurSel 2802)]; _vehicle = (call compile format["%1",_vehicle]) select 0; _vehicleLife = _vehicle; _vid = lbValue[2802,(lbCurSel 2802)]; _pid = getPlayerUID player; _unit = player; if(isNil "_vehicle") exitWith {hint localize "STR_Garage_Selection_Error"}; if ((time - life_action_delay) < 1.5) exitWith {hint localize "STR_NOTF_ActionDelay";}; if (!isClass (missionConfigFile >> "LifeCfgVehicles" >> _vehicleLife)) then { _vehicleLife = "Default"; //Use Default class if it doesn't exist diag_log format["%1: LifeCfgVehicles class doesn't exist",_vehicle]; }; _price = M_CONFIG(getNumber,"LifeCfgVehicles",_vehicleLife,"price"); switch (playerSide) do { case civilian: { _multiplier = LIFE_SETTINGS(getNumber,"vehicle_insurance_multiplier_CIVILIAN"); _purchasePrice = _price * LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_CIVILIAN"); }; case west: { _multiplier = LIFE_SETTINGS(getNumber,"vehicle_insurance_multiplier_COP"); _purchasePrice = _price * LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_COP"); }; case independent: { _multiplier = LIFE_SETTINGS(getNumber,"vehicle_insurance_multiplier_MEDIC"); _purchasePrice = _price * LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_MEDIC"); }; case east: { _multiplier = LIFE_SETTINGS(getNumber,"vehicle_insurance_multiplier_OPFOR"); _purchasePrice = _price * LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_OPFOR"); }; }; _insurancePrice = _purchasePrice * _multiplier; if(!(_insurancePrice isEqualType 0) || _insurancePrice < 1) then {_insurancePrice = 500}; if(BANK < _insurancePrice) exitWith {hint format[(localize "STR_GNOTF_NotEnoughMoney"),[_insurancePrice] call life_fnc_numberText];}; if (life_HC_isActive) then { [_vid,_pid,_insurancePrice,player,life_garage_type] remoteExecCall ["HC_fnc_insureCar",HC_Life]; } else { [_vid,_pid,_insurancePrice,player,life_garage_type] remoteExecCall ["TON_fnc_insureCar",RSERV]; }; hint localize "STR_InsuranceApply"; BANK = BANK - _insurancePrice; life_action_delay = time; closeDialog 0;
- Geht in eure Functions.hpp und fügt bei class Dialog_Controls folgendes ein:
- Öffnet eure dialog/function/fn_garageLBChange.sqf C
Alles anzeigenprivate["_control","_index","_className","_classNameLife","_dataArr","_vehicleColor","_vehicleInfo","_trunkSpace","_sellPrice","_retrievePrice","_sellMultiplier","_price","_storageFee","_purchasePrice"]; ersetzen mit private["_control","_index","_className","_classNameLife","_dataArr","_vehicleColor","_vehicleInfo","_trunkSpace","_sellPrice","_retrievePrice","_sellMultiplier","_insurance","_insuranceMultiplier","_price","_storageFee","_purchasePrice","_insurancePrice"];
Außerdem:
Und:C
Alles anzeigenswitch (playerSide) do { case civilian: { _purchasePrice = _price * LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_CIVILIAN"); _sellMultiplier = LIFE_SETTINGS(getNumber,"vehicle_sell_multiplier_CIVILIAN"); }; case west: { _purchasePrice = _price * LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_COP"); _sellMultiplier = LIFE_SETTINGS(getNumber,"vehicle_sell_multiplier_COP"); }; case independent: { _purchasePrice = _price * LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_MEDIC"); _sellMultiplier = LIFE_SETTINGS(getNumber,"vehicle_sell_multiplier_MEDIC"); }; case east: { _purchasePrice = _price * LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_OPFOR"); _sellMultiplier = LIFE_SETTINGS(getNumber,"vehicle_sell_multiplier_OPFOR"); }; }; ersetzen mit switch (playerSide) do { case civilian: { _purchasePrice = _price * LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_CIVILIAN"); _sellMultiplier = LIFE_SETTINGS(getNumber,"vehicle_sell_multiplier_CIVILIAN"); _insuranceMultiplier = LIFE_SETTINGS(getNumber,"vehicle_insurance_multiplier_CIVILIAN"); }; case west: { _purchasePrice = _price * LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_COP"); _sellMultiplier = LIFE_SETTINGS(getNumber,"vehicle_sell_multiplier_COP"); _insuranceMultiplier = LIFE_SETTINGS(getNumber,"vehicle_insurance_multiplier_COP"); }; case independent: { _purchasePrice = _price * LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_MEDIC"); _sellMultiplier = LIFE_SETTINGS(getNumber,"vehicle_sell_multiplier_MEDIC"); _insuranceMultiplier = LIFE_SETTINGS(getNumber,"vehicle_insurance_multiplier_MEDIC"); }; case east: { _purchasePrice = _price * LIFE_SETTINGS(getNumber,"vehicle_purchase_multiplier_OPFOR"); _sellMultiplier = LIFE_SETTINGS(getNumber,"vehicle_sell_multiplier_OPFOR"); _insuranceMultiplier = LIFE_SETTINGS(getNumber,"vehicle_insurance_multiplier_OPFOR"); }; };
Sowie:C
Alles anzeigenunter _sellPrice = _purchasePrice * _sellMultiplier; hinzufügen: _insurancePrice = _purchasePrice * _insuranceMultiplier;
Weiterhin:C
Alles anzeigenunter if (!(_retrievePrice isEqualType 0) || _retrievePrice < 1) then {_retrievePrice = 500;}; hinzufügen: if (!(_insurancePrice isEqualType 0) || _insurancePrice < 1) then {_insurancePrice = 500;};
Und:C
Alles anzeigen(CONTROL(2800,2803)) ctrlSetStructuredText parseText format[ (localize "STR_Shop_Veh_UI_RetrievalP")+ " <t color='#8cff9b'>$%1</t><br/> " +(localize "STR_Shop_Veh_UI_SellP")+ " <t color='#8cff9b'>$%2</t><br/> " +(localize "STR_Shop_Veh_UI_Color")+ " %8<br/> " +(localize "STR_Shop_Veh_UI_MaxSpeed")+ " %3 km/h<br/> " +(localize "STR_Shop_Veh_UI_HPower")+ " %4<br/> " +(localize "STR_Shop_Veh_UI_PSeats")+ " %5<br/> " +(localize "STR_Shop_Veh_UI_Trunk")+ " %6<br/> " +(localize "STR_Shop_Veh_UI_Fuel")+ " %7 ", ersetzen durch: (CONTROL(2800,2803)) ctrlSetStructuredText parseText format[ (localize "STR_Shop_Veh_UI_RetrievalP")+ " <t color='#8cff9b'>$%1</t><br/> " +(localize "STR_Shop_Veh_UI_SellP")+ " <t color='#8cff9b'>$%2</t><br/> Prix de l'assurance: <t color='#8cff9b'>$%9</t><br/> Etat de l'assurance: %10<br/> " +(localize "STR_Shop_Veh_UI_Color")+ " <t color='#8cff9b'>%8</t><br/> " +(localize "STR_Shop_Veh_UI_MaxSpeed")+ " <t color='#8cff9b'>%3 km/h</t><br/> " +(localize "STR_Shop_Veh_UI_HPower")+ " <t color='#8cff9b'>%4</t><br/> " +(localize "STR_Shop_Veh_UI_PSeats")+ " <t color='#8cff9b'>%5</t><br/> " +(localize "STR_Shop_Veh_UI_Trunk")+ " <t color='#8cff9b'>%6</t><br/> " +(localize "STR_Shop_Veh_UI_Fuel")+ " <t color='#8cff9b'>%7</t> ",
Weiter gehts:C
Alles anzeigen(_vehicleInfo select 12), _vehicleColor ]; ersetzen durch: (_vehicleInfo select 12), _vehicleColor, [_insurancePrice] call life_fnc_numberText, if(_insurance == 1) then {"<t color='#8cff9b'>Assuré</t>"} else {"<t color='#FF0000'>Pas d'assurance</t>"}, (_vehicleInfo select 9) ]; if(_insurance == 1) then { ctrlShow [97480,False]; }else{ ctrlShow [97480,True]; };
Fertige Datei zum Vergleich: fn_garageLBChange.sqf
- Öffnet eure dialog\function\fn_impoundMenu.sqf
- Öffnet eure CfgRemoteExec.hpp und fügt folgendes unter F(TON_fnc_handleBlastingCharge,SERVER) ein:
Und unter F(HC_fnc_wantedRemove,HC): - Öffnet eure stringtable.xml und fügt folgendes unter <Key ID="STR_pInAct_SellGarage"> ein:C
Alles anzeigen<Key ID="STR_InsuranceApply"> <Original>You just insure your vehicle you are now protected against explosions!</Original> <Czech>Právě jste pojistit své vozidlo se nyní chráněna proti výbuchu!</Czech> <Spanish>Usted acaba de asegurar su vehículo que ahora está protegido contra explosiones!</Spanish> <Italian>Basta assicurare il vostro veicolo si sono ora protetti contro le esplosioni!</Italian> <Polish>Po prostu ubezpieczyć swój pojazd jesteś teraz zabezpieczona przed wybuchem!</Polish> <Russian>Вы просто застраховать свой автомобиль, вы теперь защищены от взрывов!</Russian> <French>Vous venez d'assurer votre véhicule vous êtes maintenant protégé contre les explosions!</French> <Portuguese>Você só segurar o seu veículo que você está actualmente protegida contra explosões!</Portuguese> <German>Sie versichern nur Ihr Fahrzeug, das Sie jetzt vor Explosionen geschützt sind!</German> </Key>
- Öffnet eure Config_Master.hpp und fügt unter Vehicle Sell Prices folgendes ein: C
/* Vehicle Insurance Prices */ vehicle_insurance_multiplier_CIVILIAN = .25; //Civilian Vehicle Insurance Price = Vehicle Buy Price * multiplier vehicle_insurance_multiplier_COP = .1; //Cop Vehicle Insurance Price = Vehicle Buy Price * multiplier vehicle_insurance_multiplier_MEDIC = .1; //Medic Vehicle Insurance Price = Vehicle Buy Price * multiplier vehicle_insurance_multiplier_OPFOR = -1; // -- NOT IN USE -- Simply left in for east support.
Das war es schon an der Mission!