dekela

[Release] XP Tax

12 posts in this topic

What is XP Tax? Well, when a player purchases anything from a trader be it  gear, weapons or vehicles, some of their XP or respect is removed as a tax. The amount of XP Tax is calculated using the quality level and purchase price of the item. Level 1 item/gear is 1% of the purchase price, level 6 is 6% of purchase price.

Why have XP Tax? Many times players reach the respect cap of items and then can sit back and buy as many high tier items as they like. With XP Tax, they will need to maintain their respect in order to continue buying these items. As their respect level drops from purchases, they will need to grind out more XP via missions or sale of vehicles etc. Also, players will no longer buy respect locked items for other players, as they themselves will lose the respect by doing so.

XP Tax is a way to prolong the end game of exile, by adding another element to the game that players need to continually accomplish.

How to install:

MAKE SURE TO BACK UP ALL FILES BEFORE COMMENCING WITH THESE CHANGES!!

If you dont already have one, create an 'overrides' folder in your mission folder

Create the following 4 overwrite files with notepad++ and put them into the 'overrides' folder

ExileClient_system_trading_network_purchaseItemResponse.sqf

Spoiler

/**
 * ExileClient_system_trading_network_purchaseItemResponse
 *
 * 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/.
 Modified by [TAG] dekela for XP Tax
 */
 
private["_responseCode", "_salesPrice", "_itemClassName", "_quantity", "_containerType", "_containerNetID", "_containersBefore", "_containersAfter", "_vehicle", "_dialog", "_storeListBox"];
_responseCode = _this select 0;
_salesPrice = _this select 1;
_itemClassName = _this select 2;
_quantity  = _this select 3;
_containerType = _this select 4;
_containerNetID = _this select 5;
ExileClientIsWaitingForServerTradeResponse = false;
if (_responseCode isEqualTo 0) then
{
    switch (_containerType) do
    {
        case 1:
        {
            _containersBefore = [uniform player, vest player, backpack player];
            [player, _itemClassName] call ExileClient_util_playerCargo_add;
            _containersAfter = [uniform player, vest player, backpack player];
            if !(_containersAfter isEqualTo _containersBefore) then
            {
                call ExileClient_gui_traderDialog_updateInventoryDropdown;
            };
        };
        case 2:
        {
            [(uniformContainer player), _itemClassName] call ExileClient_util_containerCargo_add;
        };
        case 3:
        {
            [(vestContainer player), _itemClassName] call ExileClient_util_containerCargo_add;
        };
        case 4:
        {
            [(backpackContainer player), _itemClassName] call ExileClient_util_containerCargo_add;
        };
        case 5:
        {
            _vehicle = objectFromNetId _containerNetID;
            [_vehicle, _itemClassName] call ExileClient_util_containerCargo_add;
        };
    };
    ["SuccessTitleAndText", ["Item purchased!", format ["Item Cost -%1<img image='\exile_assets\texture\ui\poptab_inline_ca.paa' size='28'/><br/>XP Tax -%2 respect", _salesPrice, respectModifier]]] call ExileClient_gui_toaster_addTemplateToast;
    _dialog = uiNameSpace getVariable ["RscExileTraderDialog", displayNull];
    if !(_dialog isEqualTo displayNull) then
    {
        call ExileClient_gui_traderDialog_updateInventoryListBox;
        call ExileClient_gui_traderDialog_updatePlayerControls;
        call ExileClient_gui_traderDialog_updateStoreListBox;
        _storeListBox = _dialog displayCtrl 4009;
        [_storeListBox, lbCurSel _storeListBox] call ExileClient_gui_traderDialog_event_onStoreListBoxSelectionChanged;
    };
}
else 
{
    ["ErrorTitleAndText", ["Whoops!", format ["Something went really wrong. Please tell a server admin that you have tried to purchase an item and tell them the code '%1'. Thank you!", _responseCode]]] call ExileClient_gui_toaster_addTemplateToast;
};

ExileClient_system_trading_network_purchaseVehicleResponse.sqf

Spoiler

/**
 * ExileClient_system_trading_network_purchaseVehicleResponse
 *
 * 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/.
 Modified by [TAG] dekela for XP Tax
 */
 
private["_responseCode", "_vehicleNetID", "_salesPrice", "_vehicleObject"];
_responseCode = _this select 0;
_vehicleNetID = _this select 1;
_salesPrice = _this select 2;
if (_responseCode isEqualTo 0) then
{
    _vehicleObject = objectFromNetId _vehicleNetID;
    player moveInDriver _vehicleObject;
    ["SuccessTitleAndText", ["Vehicle purchased!", format ["Vehicle Cost -%1<img image='\exile_assets\texture\ui\poptab_inline_ca.paa' size='28'/><br/>XP Tax -%2 respect", _salesPrice, respectModifierVehicle]]] call ExileClient_gui_toaster_addTemplateToast;
}
else 
{
    ["ErrorTitleAndText", ["Whoops!", format ["Something went really wrong. Please tell a server admin that you have tried to purchase a vehicle and tell them the code '%1'. Thank you!", _responseCode]]] call ExileClient_gui_toaster_addTemplateToast;
};

ExileServer_system_trading_network_purchaseItemRequest.sqf

Spoiler

/**
 * ExileServer_system_trading_network_purchaseItemRequest
 *
 * 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/.
 Modified by [TAG] dekela for XP Tax
 */
 
private["_qualityModifier","_playerUID","_respectModifier","_newplayerRespect","_sessionID", "_parameters", "_itemClassName", "_quantity", "_containerType", "_containerNetID", "_playerObject", "_vehicleObject", "_salesPrice", "_playerMoney", "_playerRespect", "_quality", "_requiredRespect", "_logging", "_traderLog", "_responseCode"];
_sessionID = _this select 0;
_parameters = _this select 1;
_itemClassName = _parameters select 0;
_quantity = _parameters select 1;
_containerType = _parameters select 2;
_containerNetID = _parameters select 3;
try 
{
    _playerObject = _sessionID call ExileServer_system_session_getPlayerObject;
    if (_playerObject getVariable ["ExileMutex",false]) then
    {
        throw 12;
    };
    _playerObject setVariable ["ExileMutex",true];
    _vehicleObject = objNull;
    if (isNull _playerObject) then
    {
        throw 1;
    };
    if !(alive _playerObject) then
    {
        throw 2;
    };
    if !(isClass (missionConfigFile >> "CfgExileArsenal" >> _itemClassName) ) then
    {
        throw 3;
    };
    _salesPrice = getNumber (missionConfigFile >> "CfgExileArsenal" >> _itemClassName >> "price");
    if (_salesPrice <= 0) then
    {
        throw 4;
    };
    _playerMoney = _playerObject getVariable ["ExileMoney", 0];
    if (_playerMoney < _salesPrice) then
    {
        throw 5;
    };
    _playerRespect = _playerObject getVariable ["ExileScore", 0];
    _quality = getNumber(missionConfigFile >> "CfgExileArsenal" >> _itemClassName >> "quality");
    _requiredRespect = getNumber(missionConfigFile >> "CfgTrading" >> "requiredRespect" >> format["Level%1",_quality]);
    if (_playerRespect < _requiredRespect) then
    {
        throw 14;
    };
    
    ///-XP Tax-///
    _qualityModifier = (_quality/100);
    _respectModifier = _salesPrice*_qualityModifier;
    missionNamespace setVariable ["respectModifier",_respectModifier];
    publicVariable "respectModifier";
    _newplayerRespect = round (_playerRespect - _respectModifier);
    if (_newplayerRespect < 0) then 
    {
    _newplayerRespect = 0;
    };
    _playerObject setVariable ["ExileScore", _newplayerRespect];
    _playerUID = getPlayerUID _playerObject;
    format["setAccountScore:%1:%2", _newplayerRespect, getPlayerUID _playerObject] call ExileServer_system_database_query_fireAndForget;
    [_playerUID, "purchaseVehicleSkinResponse", [0, str _newplayerRespect]] call ExileServer_system_network_send_to;
    ExileClientPlayerScore = _newplayerRespect;
    (owner _playerObject) publicVariableClient "ExileClientPlayerScore";
    ExileClientPlayerScore = nil;
    ///-XP Tax-///    
    
    _playerMoney = _playerMoney - _salesPrice;
    _playerObject setVariable ["ExileMoney", _playerMoney, true];
    format["setPlayerMoney:%1:%2", _playerMoney, _playerObject getVariable ["ExileDatabaseID", 0]] call ExileServer_system_database_query_fireAndForget;
    [_sessionID, "purchaseItemResponse", [0, _salesPrice, _itemClassName, 1, _containerType, _containerNetID]] call ExileServer_system_network_send_to;
    _logging = getNumber(configFile >> "CfgSettings" >> "Logging" >> "traderLogging");
    if (_logging isEqualTo 1) then
    {
        _traderLog = format ["PLAYER: ( %1 ) %2 PURCHASED ITEM %3 FOR %4 POPTABS | PLAYER TOTAL MONEY: %5",getPlayerUID _playerObject,_playerObject,_itemClassName,_salesPrice,_playerMoney];
        "extDB2" callExtension format["1:TRADING:%1",_traderLog];
    };
    if !(_vehicleObject isEqualTo objNull) then
    {
        _vehicleObject call ExileServer_object_vehicle_database_update;
    }
    else 
    {
        _playerObject call ExileServer_object_player_database_update;
    };
}
catch 
{
    _responseCode = _exception;
    [_sessionID, "purchaseItemResponse", [_responseCode, 0, "", 0, 0, ""]] call ExileServer_system_network_send_to;
};    
_playerObject setVariable ["ExileMutex",false];
true

ExileServer_system_trading_network_purchaseVehicleRequest.sqf

Spoiler

/**
 * ExileServer_system_trading_network_purchaseVehicleRequest
 *
 * 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/.
 *
 * Changes by Xine (Untriel) idea from krwtt and posted by BetterDeadThanZed
 Modified by [TAG] dekela for XP Tax
 */
 
private["_qualityModifier","_playerUID","_respectModifier","_newplayerRespect","_sessionID","_parameters","_vehicleClass","_pinCode","_playerObject","_salesPrice","_playerMoney","_position","_vehicleObject","_logging","_traderLog","_responseCode"];
_sessionID = _this select 0;
_parameters = _this select 1;
_vehicleClass = _parameters select 0;
_pinCode = _parameters select 1;
try 
{
    _playerObject = _sessionID call ExileServer_system_session_getPlayerObject;
    if (isNull _playerObject) then
    {
        throw 1;
    };
    if !(alive _playerObject) then
    {
        throw 2;
    };
    if (_playerObject getVariable ["ExileMutex",false]) then
    {
        throw 12;
    };
    _playerObject setVariable ["ExileMutex", true];
    if !(isClass (missionConfigFile >> "CfgExileArsenal" >> _vehicleClass) ) then
    {
        throw 3;
    };
    _salesPrice = getNumber (missionConfigFile >> "CfgExileArsenal" >> _vehicleClass >> "price");
    if (_salesPrice <= 0) then
    {
        throw 4;
    };
    _playerMoney = _playerObject getVariable ["ExileMoney", 0];
    if (_playerMoney < _salesPrice) then
    {
        throw 5;
    };
    if !((count _pinCode) isEqualTo 4) then
    {
        throw 11;
    };

    _spawnObject     = "Land_HelipadEmpty_F"; // the object you want to use for spawning, can't be a simple object
    _safeRadius     = 5; // radius around the spawn object where it looks for room, must be 5 or higher
    _disableCheck    = 0; // set to 1 if you don't want to check if there is a vehicle near the spawn object
    _disableRadius     = 0; // set to 1 if you want vehicles to only spawn at the exact coords of your spawn object, not recommended better to reduce _safeRadius
    _dirShip        = (random 360); // set rotation of ship vehicle spawning, default = random
    _dirAir            = (random 360); // set rotation of air vehicle spawning, default = random
    _dirOther        = (random 360); // set rotation of all other vehicles spawning, default = random
    _errorMessage     = "There is no room to safely spawn this vehicle!"; // (toast)message to player when there is no room to spawn

    _nObject = nearestObject [(getPosATL _playerObject), _spawnObject];
    _throwError = 0;

    if (isNull _nObject) then
    {
        if (_vehicleClass isKindOf "Ship") then
        {
            _position = [(getPosATL _playerObject), 80, 10] call ExileClient_util_world_findWaterPosition;
            if (_position isEqualTo []) then 
            {
                throw 13;
            };
            _vehicleObject = [_vehicleClass, _position, (random 360), false, _pinCode] call ExileServer_object_vehicle_createPersistentVehicle;
        }
        else
        {
            _position = (getPos _playerObject) findEmptyPosition [10, 175, _vehicleClass];
            if (_position isEqualTo []) then 
            {
                throw 13;
            };
            _vehicleObject = [_vehicleClass, _position, (random 360), true, _pinCode] call ExileServer_object_vehicle_createPersistentVehicle;
        };
    }
    else
    {
        _position = getPos _nObject;

        if (_position isEqualTo []) then 
        {
            [_sessionID, "toastRequest", ["ErrorTitleAndText", ["Error: Unable to get the position of the Spawn Object."]]] call ExileServer_system_network_send_to;
            _throwError = 1;
        };

        if (_disableCheck isEqualTo 1) then
        {
            switch (true) do {
                case (_vehicleClass isKindOf "Ship"): {
                    _vehicleObject = [_vehicleClass, _position, _dirShip, false, _pinCode] call ExileServer_object_vehicle_createPersistentVehicle;
                };
                case (_vehicleClass isKindOf "Air"): {
                    _vehicleObject = [_vehicleClass, _position, _dirAir, true, _pinCode] call ExileServer_object_vehicle_createPersistentVehicle;
                };
                default {
                    _vehicleObject = [_vehicleClass, _position, _dirOther, true, _pinCode] call ExileServer_object_vehicle_createPersistentVehicle;
                };
            };
        }
        else 
        {
            _findEmpty = _position findEmptyPosition [0, _safeRadius, _vehicleClass];
            if (_findEmpty isEqualTo []) then
            {
                [_sessionID, "toastRequest", ["ErrorTitleAndText", [_errorMessage]]] call ExileServer_system_network_send_to;
                _throwError = 1;
            }
            else
            {
                _isEmpty = _findEmpty isFlatEmpty [-1, -1, -1, -1, -1, false, _nObject];
                if (_isEmpty isEqualTo []) then
                {
                    [_sessionID, "toastRequest", ["ErrorTitleAndText", [_errorMessage]]] call ExileServer_system_network_send_to;
                    _throwError = 1;
                }
                else
                {
                    switch (true) do {
                        case (_vehicleClass isKindOf "Ship"): {
                            if (_disableRadius isEqualTo 1) then
                            {
                                _vehicleObject = [_vehicleClass, _position, _dirShip, false, _pinCode] call ExileServer_object_vehicle_createPersistentVehicle;
                            }
                            else
                            {
                                _vehicleObject = [_vehicleClass, _findEmpty, _dirShip, false, _pinCode] call ExileServer_object_vehicle_createPersistentVehicle;
                            };
                        };
                        case (_vehicleClass isKindOf "Air"): {
                            if (_disableRadius isEqualTo 1) then
                            {
                                _vehicleObject = [_vehicleClass, _position, _dirAir, true, _pinCode] call ExileServer_object_vehicle_createPersistentVehicle;
                            }
                            else
                            {
                                _vehicleObject = [_vehicleClass, _findEmpty, _dirAir, true, _pinCode] call ExileServer_object_vehicle_createPersistentVehicle;
                            };
                        };
                        default {
                            if (_disableRadius isEqualTo 1) then
                            {
                                _vehicleObject = [_vehicleClass, _position, _dirOther, true, _pinCode] call ExileServer_object_vehicle_createPersistentVehicle;
                            }
                            else
                            {
                                _vehicleObject = [_vehicleClass, _findEmpty, _dirOther, true, _pinCode] call ExileServer_object_vehicle_createPersistentVehicle;
                            };
                        };
                    };
                };
            };
        };
    };

    if (_throwError isEqualTo 0) then
    {
        _vehicleObject setVariable ["ExileOwnerUID", (getPlayerUID _playerObject)];
        _vehicleObject setVariable ["ExileIsLocked",0];
        _vehicleObject lock 0;
        _vehicleObject call ExileServer_object_vehicle_database_insert;
        _vehicleObject call ExileServer_object_vehicle_database_update;
        
        ///-XP Tax-///
        _playerRespect = _playerObject getVariable ["ExileScore", 0];
        _quality = getNumber(missionConfigFile >> "CfgExileArsenal" >> _vehicleClass >> "quality");
        _qualityModifier = (_quality/100);
        _respectModifierVehicle = _salesPrice*_qualityModifier;
        missionNamespace setVariable ["respectModifierVehicle",_respectModifierVehicle];
        publicVariable "respectModifierVehicle";
        _newplayerRespect = round (_playerRespect - _respectModifierVehicle);
        if (_newplayerRespect < 0) then 
        {
        _newplayerRespect = 0;
        };
        _playerObject setVariable ["ExileScore", _newplayerRespect];
        _playerUID = getPlayerUID _playerObject;
        format["setAccountScore:%1:%2", _newplayerRespect, getPlayerUID _playerObject] call ExileServer_system_database_query_fireAndForget;
        [_playerUID, "purchaseVehicleSkinResponse", [0, str _newplayerRespect]] call ExileServer_system_network_send_to;
        ExileClientPlayerScore = _newplayerRespect;
        (owner _playerObject) publicVariableClient "ExileClientPlayerScore";
        ExileClientPlayerScore = nil;
        ///-XP Tax-///    
        
        _playerMoney = _playerMoney - _salesPrice;
        _playerObject setVariable ["ExileMoney", _playerMoney, true];
        format["setPlayerMoney:%1:%2", _playerMoney, _playerObject getVariable ["ExileDatabaseID", 0]] call ExileServer_system_database_query_fireAndForget;
        [_sessionID, "purchaseVehicleResponse", [0, netId _vehicleObject, _salesPrice]] call ExileServer_system_network_send_to;
        _logging = getNumber(configFile >> "CfgSettings" >> "Logging" >> "traderLogging");
        if (_logging isEqualTo 1) then
        {
            _traderLog = format ["PLAYER: ( %1 ) %2 PURCHASED VEHICLE %3 FOR %4 POPTABS | PLAYER TOTAL MONEY: %5",getPlayerUID _playerObject,_playerObject,_vehicleClass,_salesPrice,_playerMoney];
            "extDB2" callExtension format["1:TRADING:%1",_traderLog];
        };
    };
}
catch 
{
    _responseCode = _exception;
    [_sessionID, "purchaseVehicleResponse", [_responseCode, "", 0]] call ExileServer_system_network_send_to;
};
if !(isNull _playerObject) then 
{
    _playerObject setVariable ["ExileMutex", false];
};
true

If you already have overwrites for these files, you will need to merge the changes

open your config.cpp and edit CfgExileCustomCode to include:

class CfgExileCustomCode 
{
	ExileClient_system_trading_network_purchaseItemResponse = "overrides\ExileClient_system_trading_network_purchaseItemResponse.sqf";
	ExileClient_system_trading_network_purchaseVehicleResponse = "overrides\ExileClient_system_trading_network_purchaseVehicleResponse.sqf";
	ExileServer_system_trading_network_purchaseItemRequest = "overrides\ExileServer_system_trading_network_purchaseItemRequest.sqf";
	ExileServer_system_trading_network_purchaseVehicleRequest = "overrides\ExileServer_system_trading_network_purchaseVehicleRequest.sqf";
};

repbo the mission folder and upload to your server.

Hope you enjoy

6 people like this

Share this post


Link to post
Share on other sites
Advertisement

I love this idea, but OMG players will do nothing but cry about this HAHA

Share this post


Link to post
Share on other sites
6 hours ago, Runewulv said:

I love this idea, but OMG players will do nothing but cry about this HAHA

i wass thinking the same.

i work with millions on my server. wen people reach target max respect the get bored. so now the lose respect and hopefully keep playing ;)
it keeps people busy if the want to buy a jet of 6 mill now the lose 300k respect. and they don't mind

Share this post


Link to post
Share on other sites

I've been running this for some time now and most players are fine with the idea. The only ones who have complained are the one who complain about everything. 

1 person likes this

Share this post


Link to post
Share on other sites

Anyone (other than author) able to get this to work? I tried and it threw an error.. love the Idea, would like to make it work.. I did have to merge one file with one i already had but it seems it was just the toast message and shouldnt have cause this error.

Edited by geekm0nkey

Share this post


Link to post
Share on other sites
1 hour ago, geekm0nkey said:

Anyone (other than author) able to get this to work?

Yes.

1 hour ago, geekm0nkey said:

I tried and it threw an error

 

1 hour ago, geekm0nkey said:

merge one file with one i already

giphy.gif

 

My magicball said, all good...care to share merged files and errors? :o

Edited by WURSTKETTE

Share this post


Link to post
Share on other sites

lol..

Error, issue is its mixed in with another scripts entries.. All other mod have been flawless prior. This error stopped the server at this point. Don't think there is much you can conclude from this.

Spoiler

14:52:01 Error in expression <
private _ZCP_CDG_unit = _ZCP_CDG_units select _i;

private _ZCP_CDG_launcher = >
14:52:01   Error position: <select _i;

private _ZCP_CDG_launcher = >
14:52:01   Error Zero divisor
14:52:01 File x\addons\ZCP\functions\fn_createDMSGroup.sqf [ZCP_fnc_createDMSGroup], line 41
14:52:10 "ExileZ Mod: Monitored Live Zombies    |    0    "
14:52:11 "[OCCUPATION:transport] Running"

ok as for the merge.. That's a bit odd. I'm using the Chernarus Silver Edition Mission file. It came with a folder called. \Overwrites\Fixes\TraderFixes which has an overwrite of ExileServer_system_trading_network_purchaseVehicleRequest.sqf which contains...

Spoiler

/**
 * ExileServer_system_trading_network_purchaseVehicleRequest
 *
 * 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/.
 *
 * Changes by Xine (Untriel) idea from krwtt and posted by BetterDeadThanZed
 */
 
private["_sessionID","_parameters","_vehicleClass","_pinCode","_playerObject","_useInventory","_salesPrice","_playerMoney","_position","_vehicleObject","_logging","_traderLog","_responseCode"];
_sessionID = _this select 0;
_parameters = _this select 1;
_vehicleClass = _parameters select 0;
_pinCode = _parameters select 1;
_useInventory = _parameters select 2;
try
{
    _playerObject = _sessionID call ExileServer_system_session_getPlayerObject;
    if (isNull _playerObject) then
    {
        throw 1;
    };
    if !(alive _playerObject) then
    {
        throw 2;
    };
    if (_playerObject getVariable ["ExileMutex",false]) then
    {
        throw 12;
    };
    _playerObject setVariable ["ExileMutex", true];
    if !(isClass (missionConfigFile >> "CfgExileArsenal" >> _vehicleClass) ) then
    {
        throw 3;
    };
    _salesPrice = getNumber (missionConfigFile >> "CfgExileArsenal" >> _vehicleClass >> "price");
    if (_salesPrice <= 0) then
    {
        throw 4;
    };
    _playerMoney = _playerObject getVariable ["ExileMoney", 0];
    if (_playerMoney < _salesPrice) then
    {
        throw 5;
    };
    if !((count _pinCode) isEqualTo 4) then
    {
        throw 11;
    };
    
    if (_useInventory) then
    {
        _check = [ExileTraderInventory,[_vehicleClass, false]] call ExileClient_util_dictionary_get;
        if (_check isEqualType false) then
        {
            throw 15;
        };
        if ((_check - 1) < 0) then
        {
            throw 16;
        };
        if ((_check - 1) < 1) then
        {
            ExileTraderInventory =
            [ExileTraderInventory,[_vehicleClass]] call ExileClient_util_dictionary_remove;
        }
        else
        {
            ExileTraderInventory =
            [ExileTraderInventory,[_vehicleClass, _check - 1]] call ExileClient_util_dictionary_set;
        };
        ["updateTraderInventoryResponse",[ExileTraderInventory]] call ExileServer_system_network_send_broadcast;
        format["updateItemStock:%1:%2",-1, _vehicleClass] call ExileServer_system_database_query_fireAndForget;
    };

    _spawnObject     = "Land_HelipadEmpty_F"; // the object you want to use for spawning, can't be a simple object
    _safeRadius     = 5; // radius around the spawn object where it looks for room, must be 5 or higher
    _disableCheck    = 0; // set to 1 if you don't want to check if there is a vehicle near the spawn object
    _disableRadius     = 0; // set to 1 if you want vehicles to only spawn at the exact coords of your spawn object, not recommended better to reduce _safeRadius
    _dirShip        = (random 360); // set rotation of ship vehicle spawning, default = random
    _dirAir            = (random 360); // set rotation of air vehicle spawning, default = random
    _dirOther        = (random 360); // set rotation of all other vehicles spawning, default = random
    _errorMessage     = "There is no room to safely spawn this vehicle!"; // (toast)message to player when there is no room to spawn

    _nObject = nearestObject [(getPosATL _playerObject), _spawnObject];
    _throwError = 0;

    if (isNull _nObject) then
    {
        if (_vehicleClass isKindOf "Ship") then
        {
            _position = [(getPosATL _playerObject), 80, 10] call ExileClient_util_world_findWaterPosition;
            if (_position isEqualTo []) then
            {
                throw 13;
            };
            _vehicleObject = [_vehicleClass, _position, (random 360), false, _pinCode] call ExileServer_object_vehicle_createPersistentVehicle;
        }
        else
        {
            _position = (getPos _playerObject) findEmptyPosition [10, 175, _vehicleClass];
            if (_position isEqualTo []) then
            {
                throw 13;
            };
            _vehicleObject = [_vehicleClass, _position, (random 360), true, _pinCode] call ExileServer_object_vehicle_createPersistentVehicle;
        };
    }
    else
    {
        _position = getPos _nObject;

        if (_position isEqualTo []) then
        {
            [_sessionID, "toastRequest", ["ErrorTitleAndText", ["Error: Unable to get the position of the Spawn Object."]]] call ExileServer_system_network_send_to;
            _throwError = 1;
        };

        if (_disableCheck isEqualTo 1) then
        {
            switch (true) do {
                case (_vehicleClass isKindOf "Ship"): {
                    _vehicleObject = [_vehicleClass, _position, _dirShip, false, _pinCode] call ExileServer_object_vehicle_createPersistentVehicle;
                };
                case (_vehicleClass isKindOf "Air"): {
                    _vehicleObject = [_vehicleClass, _position, _dirAir, true, _pinCode] call ExileServer_object_vehicle_createPersistentVehicle;
                };
                default {
                    _vehicleObject = [_vehicleClass, _position, _dirOther, true, _pinCode] call ExileServer_object_vehicle_createPersistentVehicle;
                };
            };
        }
        else
        {
            _findEmpty = _position findEmptyPosition [0, _safeRadius, _vehicleClass];
            if (_findEmpty isEqualTo []) then
            {
                [_sessionID, "toastRequest", ["ErrorTitleAndText", [_errorMessage]]] call ExileServer_system_network_send_to;
                _throwError = 1;
            }
            else
            {
                _isEmpty = _findEmpty isFlatEmpty [-1, -1, -1, -1, -1, false, _nObject];
                if (_isEmpty isEqualTo []) then
                {
                    [_sessionID, "toastRequest", ["ErrorTitleAndText", [_errorMessage]]] call ExileServer_system_network_send_to;
                    _throwError = 1;
                }
                else
                {
                    switch (true) do {
                        case (_vehicleClass isKindOf "Ship"): {
                            if (_disableRadius isEqualTo 1) then
                            {
                                _vehicleObject = [_vehicleClass, _position, _dirShip, false, _pinCode] call ExileServer_object_vehicle_createPersistentVehicle;
                            }
                            else
                            {
                                _vehicleObject = [_vehicleClass, _findEmpty, _dirShip, false, _pinCode] call ExileServer_object_vehicle_createPersistentVehicle;
                            };
                        };
                        case (_vehicleClass isKindOf "Air"): {
                            if (_disableRadius isEqualTo 1) then
                            {
                                _vehicleObject = [_vehicleClass, _position, _dirAir, true, _pinCode] call ExileServer_object_vehicle_createPersistentVehicle;
                            }
                            else
                            {
                                _vehicleObject = [_vehicleClass, _findEmpty, _dirAir, true, _pinCode] call ExileServer_object_vehicle_createPersistentVehicle;
                            };
                        };
                        default {
                            if (_disableRadius isEqualTo 1) then
                            {
                                _vehicleObject = [_vehicleClass, _position, _dirOther, true, _pinCode] call ExileServer_object_vehicle_createPersistentVehicle;
                            }
                            else
                            {
                                _vehicleObject = [_vehicleClass, _findEmpty, _dirOther, true, _pinCode] call ExileServer_object_vehicle_createPersistentVehicle;
                            };
                        };
                    };
                };
            };
        };
    };

    if (_throwError isEqualTo 0) then
    {
        _vehicleObject setVariable ["ExileOwnerUID", (getPlayerUID _playerObject)];
        _vehicleObject setVariable ["ExileIsLocked",0];
        _vehicleObject lock 0;
        _vehicleObject call ExileServer_object_vehicle_database_insert;
        _vehicleObject call ExileServer_object_vehicle_database_update;
        _playerMoney = _playerMoney - _salesPrice;
        _playerObject setVariable ["ExileMoney", _playerMoney, true];
        format["setPlayerMoney:%1:%2", _playerMoney, _playerObject getVariable ["ExileDatabaseID", 0]] call ExileServer_system_database_query_fireAndForget;
        [_sessionID, "purchaseVehicleResponse", [0, netId _vehicleObject, _salesPrice]] call ExileServer_system_network_send_to;
        _logging = getNumber(configFile >> "CfgSettings" >> "Logging" >> "traderLogging");
        if (_logging isEqualTo 1) then
        {
            _traderLog = format ["PLAYER: ( %1 ) %2 PURCHASED VEHICLE %3 FOR %4 POPTABS | PLAYER TOTAL MONEY: %5",getPlayerUID _playerObject,_playerObject,_vehicleClass,_salesPrice,_playerMoney];
            "extDB2" callExtension format["1:TRADING:%1",_traderLog];
        };
    };
}
catch
{
    _responseCode = _exception;
    [_sessionID, "purchaseVehicleResponse", [_responseCode, "", 0]] call ExileServer_system_network_send_to;
};
if !(isNull _playerObject) then
{
    _playerObject setVariable ["ExileMutex", false];
};
true

With me so far? i did check, this file and it is significantly different then the default file.. But work on my server. this is the one I had to merge with this mods file of the same name. My thinking is that being this mod is over a year old that the 4 files in question have been updated?

Update: have a bit more time, will try again with more careful merging. turns out there is a need to merge with 2 other mods not just one.

 

Edited by geekm0nkey

Share this post


Link to post
Share on other sites

That error is being thrown by ZCP,  not XP Tax.  As for the file merge, while the files are different, merging the required code into the same place should work from what I can see. 

 

Just double checking you are merging the right files to each other, response to response,  request to request. 

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.