Нужна помощь?
Создайте тему в соответствующем разделе
Не нужно писать всё в чат!Загляните на торговую площадку
Там вы можете купить
всё что касается игровых серверовНе хотите бан?
Пожалуйста, ознакомьтесь с нашими правилами
Не нарушайте порядок!Продаёте или покупаете?
Пользуйтесь услугами гаранта
Мы сделаем вашу сделку безопасной
Таблица лидеров
Популярные публикации
Отображаются публикации с наибольшей репутацией на 10/10/24 во всех областях
-
1 баллОбновил скрипт 28.02.2021. - Теперь можно добавить каждый тип коробок отдельно( задать ему минимальное \ максимальное кол-во патронов от состояния коробки). - Теперь можно запретить или добавить выпадения бумажки при распаковке той или иной пачки. - Возможно добавление моддовских пачек патронов и их регулирования количества. ======== Конфиг на мой взгляд для данного скрипта смысла делать вообще нету, потому что все параметры добавляются \ меняются \ удаляются через один файл + мод является СЕРВЕРНЫМ enum BoxTypes { NAIL, // Перечислены коробки которые мы хотим сделать рандомное выпадения AMMO556X45, AMMO556X45T, AMMO308WIN, AMMO308WINT, AMMO762X54, AMMO762X54T, AMMO762X39, AMMO762X39T, AMMO22, AMMO357, AMMO45ACP, AMMO9X19, AMMO380, AMMO00BUCK, AMMO12GASLUG, AMMO12GARUBBERSLUG, AMMO12GABEANBAG, AMMO545X39, AMMO545X39T, AMMO9X39AP, AMMO9X39 } modded class ActionUnpackBox: ActionContinuousBase { override void OnFinishProgressServer( ActionData action_data ) { if ( action_data.m_MainItem && action_data.m_MainItem.GetHierarchyRootPlayer() == action_data.m_Player ) { int boxType = GetBoxType(action_data.m_MainItem.GetType()); float quantityMinBD; float quantityMaxBD; float quantityMinD; float quantityMaxD; float quantityMinW; float quantityMaxW; float quantityMinP; float quantityMaxP; bool hasPaper; switch(boxType) { case BoxTypes.NAIL: // Добавляем тут тип тот же что и в ENUM quantityMinBD = 0.10;//Минимальный процент количества в стадии сильно поврежденного quantityMaxBD = 0.15;//Максимальный процент количества в стадии сильно поврежденного quantityMinD = 0.20;//Минимальный процент количества в стадии поврежденного quantityMaxD = 0.30;//Максимальный процент количества в стадии поврежденного quantityMinW = 0.30;//Минимальный процент количества в стадии поношенного quantityMaxW = 0.65;//Максимальный процент количества в стадии поношенного quantityMinP = 0.70;//Минимальный процент количества в стадии нетронутого quantityMaxP = 0.85;//Максимальный процент количества в стадии нетронутого hasPaper = true;//Будет ли бумажка при распаковке true \ false break; case BoxTypes.AMMO556X45: quantityMinBD = 0.10; quantityMaxBD = 0.15; quantityMinD = 0.20; quantityMaxD = 0.30; quantityMinW = 0.30; quantityMaxW = 0.65; quantityMinP = 0.70; quantityMaxP = 0.85; hasPaper = true; break; case BoxTypes.AMMO556X45T: quantityMinBD = 0.10; quantityMaxBD = 0.15; quantityMinD = 0.20; quantityMaxD = 0.30; quantityMinW = 0.30; quantityMaxW = 0.65; quantityMinP = 0.70; quantityMaxP = 0.85; hasPaper = true; break; case BoxTypes.AMMO308WIN: quantityMinBD = 0.10; quantityMaxBD = 0.15; quantityMinD = 0.20; quantityMaxD = 0.30; quantityMinW = 0.30; quantityMaxW = 0.65; quantityMinP = 0.70; quantityMaxP = 0.85; hasPaper = true; break; case BoxTypes.AMMO308WINT: quantityMinBD = 0.10; quantityMaxBD = 0.15; quantityMinD = 0.20; quantityMaxD = 0.30; quantityMinW = 0.30; quantityMaxW = 0.65; quantityMinP = 0.70; quantityMaxP = 0.85; hasPaper = true; break; case BoxTypes.AMMO762X54: quantityMinBD = 0.10; quantityMaxBD = 0.15; quantityMinD = 0.20; quantityMaxD = 0.30; quantityMinW = 0.30; quantityMaxW = 0.65; quantityMinP = 0.70; quantityMaxP = 0.85; hasPaper = true; break; case BoxTypes.AMMO762X54T: quantityMinBD = 0.10; quantityMaxBD = 0.15; quantityMinD = 0.20; quantityMaxD = 0.30; quantityMinW = 0.30; quantityMaxW = 0.65; quantityMinP = 0.70; quantityMaxP = 0.85; hasPaper = true; break; case BoxTypes.AMMO762X39: quantityMinBD = 0.10; quantityMaxBD = 0.15; quantityMinD = 0.20; quantityMaxD = 0.30; quantityMinW = 0.30; quantityMaxW = 0.65; quantityMinP = 0.70; quantityMaxP = 0.85; hasPaper = true; break; case BoxTypes.AMMO762X39T: quantityMinBD = 0.10; quantityMaxBD = 0.15; quantityMinD = 0.20; quantityMaxD = 0.30; quantityMinW = 0.30; quantityMaxW = 0.65; quantityMinP = 0.70; quantityMaxP = 0.85; hasPaper = true; break; case BoxTypes.AMMO22: quantityMinBD = 0.10; quantityMaxBD = 0.15; quantityMinD = 0.20; quantityMaxD = 0.30; quantityMinW = 0.30; quantityMaxW = 0.65; quantityMinP = 0.70; quantityMaxP = 0.85; hasPaper = true; break; case BoxTypes.AMMO357: quantityMinBD = 0.10; quantityMaxBD = 0.15; quantityMinD = 0.20; quantityMaxD = 0.30; quantityMinW = 0.30; quantityMaxW = 0.65; quantityMinP = 0.70; quantityMaxP = 0.85; hasPaper = true; break; case BoxTypes.AMMO45ACP: quantityMinBD = 0.10; quantityMaxBD = 0.15; quantityMinD = 0.20; quantityMaxD = 0.30; quantityMinW = 0.30; quantityMaxW = 0.65; quantityMinP = 0.70; quantityMaxP = 0.85; hasPaper = true; break; case BoxTypes.AMMO9X19: quantityMinBD = 0.10; quantityMaxBD = 0.15; quantityMinD = 0.20; quantityMaxD = 0.30; quantityMinW = 0.30; quantityMaxW = 0.65; quantityMinP = 0.70; quantityMaxP = 0.85; hasPaper = true; break; case BoxTypes.AMMO380: quantityMinBD = 0.10; quantityMaxBD = 0.15; quantityMinD = 0.20; quantityMaxD = 0.30; quantityMinW = 0.30; quantityMaxW = 0.65; quantityMinP = 0.70; quantityMaxP = 0.85; hasPaper = true; break; case BoxTypes.AMMO00BUCK: quantityMinBD = 0.10; quantityMaxBD = 0.15; quantityMinD = 0.20; quantityMaxD = 0.30; quantityMinW = 0.30; quantityMaxW = 0.65; quantityMinP = 0.70; quantityMaxP = 0.85; hasPaper = true; break; case BoxTypes.AMMO12GASLUG: quantityMinBD = 0.10; quantityMaxBD = 0.15; quantityMinD = 0.20; quantityMaxD = 0.30; quantityMinW = 0.30; quantityMaxW = 0.65; quantityMinP = 0.70; quantityMaxP = 0.85; hasPaper = true; break; case BoxTypes.AMMO12GARUBBERSLUG: quantityMinBD = 0.10; quantityMaxBD = 0.15; quantityMinD = 0.20; quantityMaxD = 0.30; quantityMinW = 0.30; quantityMaxW = 0.65; quantityMinP = 0.70; quantityMaxP = 0.85; hasPaper = true; break; case BoxTypes.AMMO12GABEANBAG: quantityMinBD = 0.10; quantityMaxBD = 0.15; quantityMinD = 0.20; quantityMaxD = 0.30; quantityMinW = 0.30; quantityMaxW = 0.65; quantityMinP = 0.70; quantityMaxP = 0.85; hasPaper = true; break; case BoxTypes.AMMO545X39: quantityMinBD = 0.10; quantityMaxBD = 0.15; quantityMinD = 0.20; quantityMaxD = 0.30; quantityMinW = 0.30; quantityMaxW = 0.65; quantityMinP = 0.70; quantityMaxP = 0.85; hasPaper = true; break; case BoxTypes.AMMO545X39T: quantityMinBD = 0.10; quantityMaxBD = 0.15; quantityMinD = 0.20; quantityMaxD = 0.30; quantityMinW = 0.30; quantityMaxW = 0.65; quantityMinP = 0.70; quantityMaxP = 0.85; hasPaper = true; break; case BoxTypes.AMMO9X39AP: quantityMinBD = 0.10; quantityMaxBD = 0.15; quantityMinD = 0.20; quantityMaxD = 0.30; quantityMinW = 0.30; quantityMaxW = 0.65; quantityMinP = 0.70; quantityMaxP = 0.85; hasPaper = true; break; case BoxTypes.AMMO9X39: quantityMinBD = 0.10; quantityMaxBD = 0.15; quantityMinD = 0.20; quantityMaxD = 0.30; quantityMinW = 0.30; quantityMaxW = 0.65; quantityMinP = 0.70; quantityMaxP = 0.85; hasPaper = true; break; default: quantityMinBD = 1; quantityMaxBD = 1; quantityMinD = 1; quantityMaxD = 1; quantityMinW = 1; quantityMaxW = 1; quantityMinP = 1; quantityMaxP = 1; hasPaper = true; break; } string path = "CfgVehicles " + action_data.m_MainItem.GetType(); string child_name = ""; int count; array<string> resources = new array<string>; if( GetGame().ConfigIsExisting( path ) && GetGame().ConfigIsExisting( path + " Resources") ) { path = path + " Resources"; count = GetGame().ConfigGetChildrenCount ( path ); for (int i = 0; i < count; i++) { GetGame().ConfigGetChildName ( path, i, child_name ); if ( GetGame().ConfigGetInt( path + " " + child_name + " value" ) ) { resources.Insert( child_name ); } } string itemType = resources.Get(0); string itemPath = "CfgVehicles " + itemType; int quantityMax; int itemCount = GetGame().ConfigGetInt( path + " " + itemType + " value" ); if (GetGame().ConfigIsExisting(itemPath + " varQuantityMax")) { quantityMax = GetGame().ConfigGetInt(itemPath + " varQuantityMax"); } else { quantityMax = Math.Round(GetGame().ConfigGetFloat( CFG_MAGAZINESPATH + " " + itemType + " count" )); } int healthLevel = action_data.m_MainItem.GetHealthLevel(); switch(healthLevel) { case GameConstants.STATE_BADLY_DAMAGED://Стадия сильно поврежденного itemCount = Math.Round(Math.RandomFloat(quantityMinBD,quantityMaxBD) * quantityMax); break; case GameConstants.STATE_DAMAGED://Стадия поврежденного itemCount = Math.Round(Math.RandomFloat(quantityMinD,quantityMaxD) * quantityMax); break; case GameConstants.STATE_WORN://Стадия поношенного itemCount = Math.Round(Math.RandomFloat(quantityMinW,quantityMaxW) * quantityMax); break; case GameConstants.STATE_PRISTINE://Стадия нетронуто itemCount = Math.Round(Math.RandomFloat(quantityMinP,quantityMaxP) * quantityMax); break; } UnboxLambda lambda = new UnboxLambda(action_data.m_MainItem, itemType, action_data.m_Player, itemCount); action_data.m_Player.ServerReplaceItemInHandsWithNew(lambda); //spawns wrapping Paper if (hasPaper) ItemBase paper = ItemBase.Cast( GetGame().CreateObjectEx("Paper", action_data.m_Player.GetPosition(), ECE_PLACE_ON_SURFACE) ); action_data.m_Player.GetSoftSkillsManager().AddSpecialty( m_SpecialtyWeight ); } } } int GetBoxType(string name) { int type = -1; if (name == "NailBox") type = BoxTypes.NAIL; // Тут тоже добавляем что и в ENUM else if (name == "AmmoBox_556x45_20Rnd") type = BoxTypes.AMMO556X45; else if (name == "AmmoBox_556x45Tracer_20Rnd") type = BoxTypes.AMMO556X45T; else if (name == "AmmoBox_308Win_20Rnd") type = BoxTypes.AMMO308WIN; else if (name == "AmmoBox_308WinTracer_20Rnd") type = BoxTypes.AMMO308WINT; else if (name == "AmmoBox_762x54_20Rnd") type = BoxTypes.AMMO762X54; else if (name == "AmmoBox_762x54Tracer_20Rnd") type = BoxTypes.AMMO762X54T; else if (name == "AmmoBox_762x39_20Rnd") type = BoxTypes.AMMO762X39; else if (name == "AmmoBox_762x39Tracer_20Rnd") type = BoxTypes.AMMO762X39T; else if (name == "AmmoBox_22_50Rnd") type = BoxTypes.AMMO22; else if (name == "AmmoBox_357_20Rnd") type = BoxTypes.AMMO357; else if (name == "AmmoBox_45ACP_25rnd") type = BoxTypes.AMMO45ACP; else if (name == "AmmoBox_9x19_25rnd") type = BoxTypes.AMMO9X19; else if (name == "AmmoBox_380_35rnd") type = BoxTypes.AMMO380; else if (name == "AmmoBox_00buck_10rnd") type = BoxTypes.AMMO00BUCK; else if (name == "AmmoBox_12gaSlug_10Rnd") type = BoxTypes.AMMO12GASLUG; else if (name == "AmmoBox_12gaRubberSlug_10Rnd") type = BoxTypes.AMMO12GARUBBERSLUG; else if (name == "AmmoBox_12gaBeanbag_10Rnd") type = BoxTypes.AMMO12GABEANBAG; else if (name == "AmmoBox_545x39_20Rnd") type = BoxTypes.AMMO545X39; else if (name == "AmmoBox_545x39Tracer_20Rnd") type = BoxTypes.AMMO545X39T; else if (name == "AmmoBox_9x39AP_20Rnd") type = BoxTypes.AMMO9X39AP; else if (name == "AmmoBox_9x39_20Rnd") type = BoxTypes.AMMO9X39; return type; } };
-
Рассылка

thessend