Перейти к публикации
Поиск в
  • Дополнительно...
Искать результаты, содержащие...
Искать результаты в...
  • Нужна помощь?

    Создайте тему в соответствующем разделе
    Не нужно писать всё в чат!
  • Загляните на торговую площадку

    Там вы можете купить
    всё что касается игровых серверов
  • Не хотите бан?

    Пожалуйста, ознакомьтесь с нашими правилами
    Не нарушайте порядок!
  • Продаёте или покупаете?

    Пользуйтесь услугами гаранта
    Мы сделаем вашу сделку безопасной

Подскажите как сделать в файле maintain_area.sqf подсчет объектов велся по одному а не сразу да 10, 50 или 100.

private ["_newWealth","_missing","_missingQty","_proceed","_itemIn","_countIn","_target","_objectClasses","_range","_objects","_requirements","_count","_cost","_option"];
 
if (DZE_ActionInProgress) exitWith { cutText [(localize "STR_EPOCH_ACTIONS_2") , "PLAIN DOWN"]; };
 
DZE_ActionInProgress = true;
 
player removeAction s_player_maintain_area;
s_player_maintain_area = 1;
player removeAction s_player_maintain_area_preview;
s_player_maintain_area_preview = 1;
 
_target = cursorTarget;
_objectClasses = DZE_maintainClasses;
_range = DZE_maintainRange;
_objects = nearestObjects [_target, _objectClasses, _range];
_objects_filtered = [];
 
{
    if (damage _x >= DZE_DamageBeforeMaint) then {
        _objects_filtered set [count _objects_filtered, _x];
   };
} count _objects;
 
_objects = _objects_filtered;
_count = count _objects;
 
if (_count == 0) exitWith {
	cutText [format[(localize "STR_EPOCH_ACTIONS_22"), _count], "PLAIN DOWN"];
	DZE_ActionInProgress = false;
	s_player_maintain_area = -1;
	s_player_maintain_area_preview = -1;
};
 
_requirements = [];
switch true do {
	case (_count <= 10): {_requirements = [[CurrencyName,5000]]};
	case (_count <= 20): {_requirements = [[CurrencyName,10000]]};
	case (_count <= 35): {_requirements = [[CurrencyName,17500]]};
	case (_count <= 50): {_requirements = [[CurrencyName,25000]]};
	case (_count <= 75): {_requirements = [[CurrencyName,37500]]};
	case (_count <= 100): {_requirements = [[CurrencyName,50000]]};
	case (_count <= 175): {_requirements = [[CurrencyName,87500]]};
	case (_count <= 250): {_requirements = [[CurrencyName,125000]]};
	case (_count <= 325): {_requirements = [[CurrencyName,162500]]};
	case (_count <= 400): {_requirements = [[CurrencyName,200000]]};
	case (_count <= 475): {_requirements = [[CurrencyName,237500]]};
	case (_count <= 550): {_requirements = [[CurrencyName,275000]]};
	case (_count <= 625): {_requirements = [[CurrencyName,312500]]};
	case (_count <= 750): {_requirements = [[CurrencyName,375000]]};
	case (_count <= 875): {_requirements = [[CurrencyName,437500]]};
	case (_count <= 1000): {_requirements = [[CurrencyName,500000]]};
	case (_count <= 1500): {_requirements = [[CurrencyName,750000]]};
};
_option = _this select 3;
 
switch _option do {
 
	case "maintain": {
 
		_wealth = player getVariable["cashMoney",0];
		_missing = "";
		_missingQty = 0;
		_proceed = true;
 
		{
			_itemIn = _x select 0;
			_countIn = _x select 1;
			if (_wealth < _countIn) exitWith { _missing = _itemIn; _missingQty = (_countIn - _wealth); _proceed = false; };
		} count _requirements;
 
		if (_proceed) then {
 
			_newWealth = (_wealth - _countIn);
 
			player playActionNow "Medic";
			[player,_range,true,(getPosATL player)] spawn player_alertZombies;
 
			player setVariable["cashMoney",_newWealth,true];
 
			PVDZE_plr_Save = [player,(magazines player),true,true];
			publicVariableServer "PVDZE_plr_Save";
 
			PVDZE_maintainArea = [player,1,_target];
			publicVariableServer "PVDZE_maintainArea";
 
			cutText [format[(localize "STR_EPOCH_ACTIONS_4"), _count], "PLAIN DOWN", 5];	
 
		} else {
 
			cutText [format[(localize "STR_EPOCH_ACTIONS_6"), _missingQty, CurrencyName], "PLAIN DOWN"];
 
		};
	};
	
	case "preview": {
 
		_cost = "";
 
		{
			_itemIn = _x select 0;
			_countIn = _x select 1;
			if (_cost != "") then {
				_cost = _cost + " and ";
			};
			_cost = _cost + (str(_countIn) + " " + CurrencyName);
		} count _requirements;
 
		cutText [format[(localize "STR_EPOCH_ACTIONS_7"), _count, _cost], "PLAIN DOWN"];
 
	};
};
 
DZE_ActionInProgress = false;
s_player_maintain_area = -1;
s_player_maintain_area_preview = -1;

Может как то вот так?
 

case (_count = 1): {_requirements = [[CurrencyName,5000]]};

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

Рекомендованные сообщения

  • 0

switch do вообще убирай

_requirements = [[CurrencyName,(5000 * _count)]]
Изменено пользователем dimquea (история изменений)

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах
MagicByte MagicByte MagicByte
  • 0


if (_count > 0) then {

    _requirements = [[CurrencyName,(_count * 5000)]]

};

 

Изменено пользователем JustBullet (история изменений)

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

Создайте аккаунт или войдите в него для комментирования

Вы должны быть пользователем, чтобы оставить комментарий

Создать аккаунт

Зарегистрируйтесь для получения аккаунта. Это просто!

Зарегистрировать аккаунт

Войти

Уже зарегистрированы? Войдите здесь.

Войти сейчас

×
×
  • Создать...

Важная информация

Используя этот сайт, вы автоматически обязуетесь соблюдать наши Правила и Политика конфиденциальности.
Чтобы сделать этот веб-сайт лучше, мы разместили cookies на вашем устройстве. Вы можете изменить свои настройки cookies, в противном случае мы будем считать, что вы согласны с этим.

Поддержка