Вот вам, скажем так, ориентир
// выполнить при инициализации игрока, можно из любого места, например из того же init.sqf, добавить в секцию if !(isDedicated)
// Переменная содержащая список разрешённых классов для конкретного класса юнита
WhiteListAmmonition = switch (typeOf player) do {
case "class_unit_1": {["class_uniform", "class_weapon"]}; // Перечисляете классы разрешённых униформ и оружия
case "class_unit_2": {["class_uniform", "class_weapon"]};
default {[]};
};
// Цикл сохраняющий текущее состаяние
[] spawn {
while {alive player} do {
_uniform = uniform player;
_magazines = magazinesAmmoCargo uniformContainer player;
_uniformItems = [];
_weapons = [
[(primaryWeapon player), (primaryWeaponItems player), (primaryWeaponMagazine player)],
[(secondaryWeapon player), (secondaryWeaponItems player), (secondaryWeaponMagazine player)],
[(handgunWeapon player), (handgunItems player), (handgunMagazine player)]
];
{
if !(isClass(configFile/"CfgMagazines"/_x)) then {_uniformItems set [count _uniformItems, _x]};
} foreach (uniformItems player);
player setVariable ["MyTag_inventory", [_uniform, _uniformItems, _magazines, _weapons]];
sleep 0.01;
};
};
// Добавляем юниту обработку события
_EHTakeIdx = player addEventHandler ["take", {
// Triggers when a unit takes an item from a container.
// Здесь вы можете либо полностью запретить, либо устроить что то вроде фильтра, что можно, что нельзя, брать игроку. При смене униформы это событие по моему тоже должно срабатывать.
_unit = _this select 0; // Unit to which the event handler is assigned
_container = _this select 1; // The container from which the item was taken (vehicle, box, etc.)
_item = _this select 2; // The class name of the taken item
// Далее ваш код, проверки, перепроверки, откаты, штрафы, расстрелы.
}];
Сообщение отредактировал SteelRat: 08 September 2014 - 15:10