А приложить ошибку и кусок кода ну вообще невозможно, да?
[RemoteEvent("server.weaponshop.buyComponent")]
public static void Event_WShopComponent(ExtPlayer player, int cat, int index, string componentId)
{
try
{
var sessionData = player.GetSessionData();
if (sessionData == null) return;
var characterData = player.GetCharacterData();
if (characterData == null) return;
if (sessionData.TempBizID == -1 || !BizList.ContainsKey(sessionData.TempBizID)) return;
int bizid = sessionData.TempBizID;
if (!characterData.Licenses[6])
{
Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"У Вас нет лицензии на оружие. Получить её можно в полицейском департаменте.", 10000);
return;
}
Business biz = BizList[bizid];
Product prod = biz.Products.FirstOrDefault(p => p.Name == "Модификации");
string prodName = gunsCat[cat][index];
if (!WeaponComponents.WeaponsComponents.ContainsKey((uint)(Hash) WeaponRepository.GetHash(prodName))) return;
int totalPrice = 0;
uint componentHash = 0;
ItemId wType = ItemId.Debug;
foreach (KeyValuePair<uint, wComponentData> w in WeaponComponents.WeaponsComponents[(uint)(Hash) WeaponRepository.GetHash(prodName)].Components)
{
if (w.Key.ToString() == componentId)
{
totalPrice = Convert.ToInt32(w.Value.Price / 100f * prod.Price);
componentHash = w.Key;
wType = (ItemId)Enum.Parse(typeof(ItemId), "c" + w.Value.Type.ToString("F"));
}
}
if (wType == ItemId.Debug || Chars.Repository.isFreeSlots(player, wType) != 0) return;
if (componentHash == 0) return;
if (UpdateData.CanIChange(player, totalPrice, true) != 255) return;
int amount = Convert.ToInt32(totalPrice * 0.75 / 100);
if (amount <= 0) amount = 1;
if (!takeProd(bizid, amount, prod.Name, totalPrice))
{
Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, LangFunc.GetText(LangType.Ru, DataName.NetTovaraNaSkladeBiza), 3000);
return;
}
biz.BuyItemBusiness(characterData.UUID, prod.Name, totalPrice);
Wallet.Change(player, -totalPrice);
GameLog.Money($"player({characterData.UUID})", $"biz({biz.ID})", totalPrice, $"buyWShop(component({1}))");
Chars.Repository.AddNewItem(player, $"char_{characterData.UUID}", "inventory", wType, 1, $"{(uint)(Hash) WeaponRepository.GetHash(prodName)}_{componentHash}");
Notify.Send(player, NotifyType.Success, NotifyPosition.BottomCenter, $"Вы купили {Chars.Repository.ItemsInfo[wType].Name} за {totalPrice}$", 3000);
BattlePass.Repository.UpdateReward(player, 1);
}
catch (Exception e)
{
Log.Write($"Event_WShopComponent Exception: {e.ToString()}");
}
}
[RemoteEvent("server.weaponshop.buyAmmo")]
public static void Event_WShopAmmo(ExtPlayer player, int category, int ammo)
{
try
{