コード例 #1
0
        private void NUIDropItem(ExpandoObject obj)
        {
            Dictionary <string, dynamic> aux = Utils.expandoProcessing(obj);
            string itemname = aux["item"];
            string type     = aux["type"].ToString();

            if (type == "item_money")
            {
                TriggerServerEvent("vorpinventory:serverDropMoney", double.Parse(aux["number"].ToString()));
            }
            else if (type == "item_standard")
            {
                if (int.Parse(aux["number"].ToString()) > 0 && vorp_inventoryClient.useritems[itemname].getCount() >= int.Parse(aux["number"].ToString()))
                {
                    TriggerServerEvent("vorpinventory:serverDropItem", itemname, int.Parse(aux["number"].ToString()), 1);
                    vorp_inventoryClient.useritems[itemname].quitCount(int.Parse(aux["number"].ToString()));
                    //Debug.Write(vorp_inventoryClient.useritems[itemname].getCount().ToString());
                    if (vorp_inventoryClient.useritems[itemname].getCount() == 0)
                    {
                        vorp_inventoryClient.useritems.Remove(itemname);
                    }
                }
            }
            else
            {
                //Function.Call((Hash) 0x4899CB088EDF59B8, API.PlayerPedId(), (uint) int.Parse(aux["hash"]),false,false);
                TriggerServerEvent("vorpinventory:serverDropWeapon", int.Parse(aux["id"].ToString()));
                if (vorp_inventoryClient.userWeapons.ContainsKey(int.Parse(aux["id"].ToString())))
                {
                    WeaponClass wp = vorp_inventoryClient.userWeapons[int.Parse(aux["id"].ToString())];
                    if (wp.getUsed())
                    {
                        wp.setUsed(false);
                        API.RemoveWeaponFromPed(API.PlayerPedId(), (uint)API.GetHashKey(wp.getName()),
                                                true, 0);
                    }
                    vorp_inventoryClient.userWeapons.Remove(int.Parse(aux["id"].ToString()));
                }
            }
            LoadInv();
        }
コード例 #2
0
ファイル: Pickups.cs プロジェクト: americanvenom/mer1dian
        public async Task dropallPlease()
        {
            await Delay(200);

            if (GetConfig.Config["DropOnRespawn"]["Items"].ToObject <bool>())
            {
                Dictionary <string, ItemClass> items = vorp_inventoryClient.useritems.ToDictionary(p => p.Key, p => p.Value);
                foreach (var item in items.Values)
                {
                    TriggerServerEvent("vorpinventory:serverDropItem", item.getName(), item.getCount(), 1);
                    vorp_inventoryClient.useritems[item.getName()].quitCount(item.getCount());
                    //Debug.Write(vorp_inventoryClient.useritems[itemname].getCount().ToString());
                    if (vorp_inventoryClient.useritems[item.getName()].getCount() == 0)
                    {
                        vorp_inventoryClient.useritems.Remove(item.getName());
                    }
                    await Delay(200);
                }
            }

            if (GetConfig.Config["DropOnRespawn"]["Weapons"].ToObject <bool>())
            {
                Dictionary <int, WeaponClass> weapons = vorp_inventoryClient.userWeapons.ToDictionary(p => p.Key, p => p.Value);
                foreach (var weapon in weapons)
                {
                    TriggerServerEvent("vorpinventory:serverDropWeapon", weapon.Key);
                    if (vorp_inventoryClient.userWeapons.ContainsKey(weapon.Key))
                    {
                        WeaponClass wp = vorp_inventoryClient.userWeapons[weapon.Key];
                        if (wp.getUsed())
                        {
                            wp.setUsed(false);
                            API.RemoveWeaponFromPed(API.PlayerPedId(), (uint)API.GetHashKey(wp.getName()),
                                                    true, 0);
                        }
                        vorp_inventoryClient.userWeapons.Remove(weapon.Key);
                    }
                    await Delay(200);
                }
            }
            await Delay(800);

            dropAll = false;
        }