Moin Leute!
Mir ging es schon immer auf die Nerven das der Fahrzeugpreis einen Wert nimmt und dieser dann *1.5 gerechnet wird...
Deshalb hab ich das ganze mal umgeschrieben und hiermit könnt ihr ganz einfach die Preise getrennt eintragen.
ihr müsst nur 2 Dateien ersetzten und eine Kleinigkeit in der Vehicleliste abändern.
Navigiert zu mpmissions\Altis_Life.Altis\core\shops
und ersetzt folgende Dateien..
fn_vehicleShopBuy und fn_vehicleShopLBChange
fn_vehicleShopLBChange
Spoiler anzeigen
Code
#include <macro.h>
/*
File: fn_vehicleShopLBChange.sqf
Author: Bryan "Tonic" Boardwine
Description:
Called when a new selection is made in the list box and
displays various bits of information about the vehicle.
*/
disableSerialization;
private["_control","_index","_className","_basePrice","_rentPrice","_vehicleInfo","_colorArray","_ctrl"];
_control = _this select 0;
_index = _this select 1;
//Fetch some information.
_className = _control lbData _index;
_vIndex = _control lbValue _index;
_vehicleList = [life_veh_shop select 0] call life_fnc_vehicleListCfg;
_basePrice = (_vehicleList select _vIndex) select 1;
_rentPrice = (_vehicleList select _vIndex) select 2;
_vehicleInfo = [_className] call life_fnc_fetchVehInfo;
_trunkSpace = [_className] call life_fnc_vehicleWeightCfg;
ctrlShow [2330,true];
(getControl(2300,2303)) ctrlSetStructuredText parseText format[
(localize "STR_Shop_Veh_UI_Rental")+ " <t color='#8cff9b'>$%1</t><br/>" +(localize "STR_Shop_Veh_UI_Ownership")+ " <t color='#8cff9b'>$%2</t><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<br/>" +(localize "STR_Shop_Veh_UI_Armor")+ " %8",
[_rentPrice] call life_fnc_numberText,
[_basePrice] call life_fnc_numberText,
_vehicleInfo select 8,
_vehicleInfo select 11,
_vehicleInfo select 10,
if(_trunkSpace == -1) then {"None"} else {_trunkSpace},
_vehicleInfo select 12,
_vehicleInfo select 9
];
_ctrl = getControl(2300,2304);
lbClear _ctrl;
_colorArray = [_className] call life_fnc_vehicleColorCfg;
for "_i" from 0 to count(_colorArray)-1 do {
if((_colorArray select _i) select 1 == (life_veh_shop select 2)) then {
_temp = [_className,_i] call life_fnc_vehicleColorStr;
_ctrl lbAdd format["%1",_temp];
_ctrl lbSetValue [(lbSize _ctrl)-1,_i];
};
};
if(_className in (__GETC__(life_vShop_rentalOnly))) then {
ctrlEnable [2309,false];
} else {
if(!(life_veh_shop select 3)) then {
ctrlEnable [2309,true];
};
};
lbSetCurSel[2304,0];
if((lbSize _ctrl)-1 != -1) then {
ctrlShow[2304,true];
} else {
ctrlShow[2304,false];
};
true;
Alles anzeigen
fn_vehicleShopBuy
Spoiler anzeigen
Code
/*
File: fn_vehicleShopBuy.sqf
Author: Bryan "Tonic" Boardwine
Description:
Does something with vehicle purchasing.
*/
private["_mode","_spawnPoints","_className","_basePrice","_rentPrice","_colorIndex","_spawnPoint","_vehicle"];
_mode = _this select 0;
if((lbCurSel 2302) == -1) exitWith {hint localize "STR_Shop_Veh_DidntPick"};
_className = lbData[2302,(lbCurSel 2302)];
_vIndex = lbValue[2302,(lbCurSel 2302)];
_vehicleList = [life_veh_shop select 0] call life_fnc_vehicleListCfg;
_basePrice = (_vehicleList select _vIndex) select 1;
_rentPrice = (_vehicleList select _vIndex) select 2;
_colorIndex = lbValue[2304,(lbCurSel 2304)];
//Series of checks (YAY!)
if(_basePrice < 0) exitWith {}; //Bad price entry
if(_rentPrice < 0) exitWith {}; //Bad price entry
if(life_cash < _basePrice) exitWith {hint format[localize "STR_Shop_Veh_NotEnough",[_basePrice - life_cash] call life_fnc_numberText];};
if(life_cash < _rentPrice) exitWith {hint format[localize "STR_Shop_Veh_NotEnough",[_rentPrice - life_cash] call life_fnc_numberText];};
if(!([_className] call life_fnc_vehShopLicenses) && _className != "B_MRAP_01_hmg_F") exitWith {hint localize "STR_Shop_Veh_NoLicense"};
_spawnPoints = life_veh_shop select 1;
_spawnPoint = "";
if((life_veh_shop select 0) == "med_air_hs") then {
if(count(nearestObjects[(getMarkerPos _spawnPoints),["Air"],35]) == 0) exitWith {_spawnPoint = _spawnPoints};
} else {
//Check if there is multiple spawn points and find a suitable spawnpoint.
if(typeName _spawnPoints == typeName []) then {
//Find an available spawn point.
{if(count(nearestObjects[(getMarkerPos _x),["Car","Ship","Air"],5]) == 0) exitWith {_spawnPoint = _x};} foreach _spawnPoints;
} else {
if(count(nearestObjects[(getMarkerPos _spawnPoints),["Car","Ship","Air"],5]) == 0) exitWith {_spawnPoint = _spawnPoints};
};
};
if(_spawnPoint == "") exitWith {hint localize "STR_Shop_Veh_Block";};
if(_mode) then {
life_cash = life_cash - _basePrice;
hint format[localize "STR_Shop_Veh_Bought",getText(configFile >> "CfgVehicles" >> _className >> "displayName"),[_basePrice] call life_fnc_numberText];
}else{
life_cash = life_cash - _rentPrice;
hint format[localize "STR_Shop_Veh_Bought",getText(configFile >> "CfgVehicles" >> _className >> "displayName"),[_rentPrice] call life_fnc_numberText];
};
//Spawn the vehicle and prep it.
if((life_veh_shop select 0) == "ichwilldichnicht") then {
_vehicle = createVehicle [_className,[0,0,999],[], 0, "NONE"];
waitUntil {!isNil "_vehicle"}; //Wait?
_vehicle allowDamage false;
_hs = nearestObjects[getMarkerPos _spawnPoint,["Land_Hospital_side2_F"],50] select 0;
_vehicle setPosATL (_hs modelToWorld [-0.4,-4,12.65]);
_vehicle lock 2;
[[_vehicle,_colorIndex],"life_fnc_colorVehicle",true,false] spawn life_fnc_MP;
[_vehicle] call life_fnc_clearVehicleAmmo;
[[_vehicle,"trunk_in_use",false,true],"TON_fnc_setObjVar",false,false] spawn life_fnc_MP;
[[_vehicle,"vehicle_info_owners",[[getPlayerUID player,profileName]],true],"TON_fnc_setObjVar",false,false] spawn life_fnc_MP;
_vehicle disableTIEquipment true; //No Thermals.. They're cheap but addictive.
player moveInDriver _vehicle;
} else {
_vehicle = createVehicle [_className, (getMarkerPos _spawnPoint), [], 0, "NONE"];
waitUntil {!isNil "_vehicle"}; //Wait?
_vehicle allowDamage false; //Temp disable damage handling..
_vehicle lock 2;
_vehicle setVectorUp (surfaceNormal (getMarkerPos _spawnPoint));
_vehicle setDir (markerDir _spawnPoint);
_vehicle setPos (getMarkerPos _spawnPoint);
[[_vehicle,_colorIndex],"life_fnc_colorVehicle",true,false] spawn life_fnc_MP;
[_vehicle] call life_fnc_clearVehicleAmmo;
[[_vehicle,"trunk_in_use",false,true],"TON_fnc_setObjVar",false,false] spawn life_fnc_MP;
[[_vehicle,"vehicle_info_owners",[[getPlayerUID player,profileName]],true],"TON_fnc_setObjVar",false,false] spawn life_fnc_MP;
_vehicle disableTIEquipment true; //No Thermals.. They're cheap but addictive.
player moveInDriver _vehicle;
};
//Side Specific actions.
switch(playerSide) do {
case west: {
[_vehicle,"cop_offroad",true] spawn life_fnc_vehicleAnimate;
};
case civilian: {
if((life_veh_shop select 2) == "civ" && {_className == "B_Heli_Light_01_F"}) then {
[_vehicle,"civ_littlebird",true] spawn life_fnc_vehicleAnimate;
};
};
case independent: {
[_vehicle,"med_offroad",true] spawn life_fnc_vehicleAnimate;
};
case east: {
[_vehicle,"atac_offroad",true] spawn life_fnc_vehicleAnimate;
};
};
_vehicle allowDamage true;
//life_vehicles set[count life_vehicles,_vehicle]; //Add err to the chain.
life_vehicles pushBack _vehicle;
[[getPlayerUID player,playerSide,_vehicle,1],"TON_fnc_keyManagement",false,false] spawn life_fnc_MP;
_fuel = fuel _vehicle;
_body = _vehicle getHitPointDamage "HitBody";
_engine = _vehicle getHitPointDamage "HitEngine";
_tank = _vehicle getHitPointDamage "HitFuel";
_FrontLeftWheel = _vehicle getHitPointDamage "HitLFWheel";
_FrontRightWheel = _vehicle getHitPointDamage "HitRFWheel";
_FrontLeftWheelZwei = _vehicle getHitPointDamage "HitLF2Wheel";
_FrontRightWheelZwei = _vehicle getHitPointDamage "HitRF2Wheel";
_MiddleLeftWheel = _vehicle getHitPointDamage "HitLMWheel";
_MiddleRightWheel = _vehicle getHitPointDamage "HitRMWheel";
_BackLeftWheel = _vehicle getHitPointDamage "HitLBWheel";
_BackRightWheel = _vehicle getHitPointDamage "HitRBWheel";
if(_mode) then {
if(!(_className in ["B_G_Offroad_01_armed_F","B_MRAP_01_hmg_F"])) then {
[[(getPlayerUID player),playerSide,_vehicle,_colorIndex,_fuel,_body,_engine,_tank,_FrontLeftWheel,_FrontRightWheel,_FrontLeftWheelZwei,_FrontRightWheelZwei,_MiddleLeftWheel,_MiddleRightWheel,_BackLeftWheel,_BackRightWheel],"TON_fnc_vehicleCreate",false,false] spawn life_fnc_MP;
};
};
[0] call SOCK_fnc_updatePartial;
closeDialog 0; //Exit the menu.
true;
Alles anzeigen
und die fn_vehicleListCfg...
Code
case "civ_car":
{
_return =
[
["Classname",KaufPreis,MietPreis],
["B_Quadbike_01_F",2500,1000],
["C_Hatchback_01_F",9500,5000],
["C_Offroad_01_F",12500,8000],
["C_SUV_01_F",35000,20000],
["C_Van_01_transport_F",40000,25000]
];
};
Alles anzeigen
Viel Spaß