Jump to content
Sign in to follow this  
El' Rabito

Vehicle Trader - DLC vehicle buy restriction

Recommended Posts

If you don't own the DLC you can't buy the vehicle. Prevents inexperienced players from buying DLC vehicles by mistake.

unknown.png?width=1604&height=677

 

1. Make a CfgExileCustomCode override for ExileClient_gui_vehicleTraderDialog_event_onPurchaseButtonClick.sqf with the following code.
> This only works if you use default classnames, if you use your own custom classnames it wont work properly!

 

/**
 * ExileClient_gui_vehicleTraderDialog_event_onPurchaseButtonClick
 *
 * Exile Mod
 * www.exilemod.com
 * © 2015 Exile Mod Team
 *
 * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. 
 * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
 */
 
private["_vehicleClass", "_salesPrice", "_quality", "_requiredRespect", "_pin","_VehicleClassIsOwnedDLC","_configPath","_source"];
_vehicleClass = uiNameSpace getVariable ["RscExileVehicleTraderDialogVehicleClass", ""];
_VehicleClassIsOwnedDLC = getAssetDLCInfo [_vehicleClass] select 1;
_salesPrice = getNumber(missionConfigFile >> "CfgExileArsenal" >> _vehicleClass >> "price");
_quality = getNumber(missionConfigFile >> "CfgExileArsenal" >> _vehicleClass >> "quality");
_requiredRespect = getNumber(missionConfigFile >> "CfgTrading" >> "requiredRespect" >> format["Level%1",_quality]);
_pin = ctrlText ((uiNamespace getVariable ["RscExileVehicleTraderDialog",displayNull]) displayCtrl 4008);
closeDialog 0;

if !(_VehicleClassIsOwnedDLC) exitWith {
    ["ErrorTitleAndText", ["MISSING DLC", "You don't own the required DLC for this Vehicle!"]] call ExileClient_gui_toaster_addTemplateToast;
};
if (count _pin != 4) exitWith {
	["ErrorTitleAndText", ["Vehicle Purchase Aborted", "Pin not 4 characters."]] call ExileClient_gui_toaster_addTemplateToast;
};
if (_salesPrice > (player getVariable ["ExileMoney", 0])) exitWith {
	["ErrorTitleAndText", ["Vehicle Purchase Aborted", "Not enough money."]] call ExileClient_gui_toaster_addTemplateToast;
};
if (_requiredRespect > ExileClientPlayerScore) exitWith {
	["ErrorTitleAndText", ["Vehicle Purchase Aborted", "Not enough respect."]] call ExileClient_gui_toaster_addTemplateToast;
};
["purchaseVehicleRequest", [_vehicleClass,_pin]] call ExileClient_system_network_send;

Support Me: www.buymeacoffee.com/ElRabito

  • Like 3

Share this post


Link to post
Share on other sites
Sign in to follow this  

×