#include "..\script_component.hpp" params ["_price"]; private _paymentData = GVAR(activePayment); private _payment = call compile _paymentData; scopeName "main"; if (count _payment > 3) then { private _authorizedUIDs = _payment select 3; if !(getPlayerUID player in _authorizedUIDs) then { ["You are not authorized to use this payment method!", "warning", 3, "right"] call EFUNC(misc,notify); false breakOut "main"; }; }; private _varType = _payment select 2; private _balance = switch (_varType) do { case "player": { player getVariable [_payment select 1, 0] }; case "mission": { missionNamespace getVariable [_payment select 1, 0] }; default { 0 }; }; if (_balance < _price) exitWith { ["You do not have enough funds!", "warning", 3, "right"] call EFUNC(misc,notify); false }; switch (_varType) do { case "player": { player setVariable [_payment select 1, (_balance - _price), true]; }; case "mission": { missionNamespace setVariable [_payment select 1, (_balance - _price), true]; }; }; true