Beispiel #1
0
 public WeaponInfo(WeaponHash hash, WeaponComponent[] components, WeaponTint tint, int ammo)
 {
     Hash       = hash;
     Components = components;
     Tint       = tint;
     Ammo       = ammo;
 }
Beispiel #2
0
        public HouseWeapon(WeaponHash hash, int ammo, WeaponTint tint, WeaponComponent[] components)
        {
            Hash = hash;
            Ammo = ammo;

            Tint       = tint;
            Components = components;
        }
Beispiel #3
0
        public async Task <WeaponTint> InsertWeaponTint(WeaponTint weaponTint)
        {
            using (var db = new DbConnection(m_connectionString))
            {
                weaponTint.Id = await db.Connection.InsertAsync(weaponTint);

                return(weaponTint);
            }
        }
Beispiel #4
0
 public Weapon(WeaponHash weaponhash, WeaponTint weapontint, bool isplayerweapon, bool isadminweapon, bool isgroupweapon, Group group)
 {
     WeaponHash     = weaponhash;
     WeaponTint     = weapontint;
     IsPlayerWeapon = isplayerweapon;
     IsAdminWeapon  = isadminweapon;
     IsGroupWeapon  = isgroupweapon;
     GroupId        = group.Id;
 }
Beispiel #5
0
        public static void CreateWeapon(Client player, WeaponHash weaponhash, WeaponTint weapontint = WeaponTint.Normal,
                                        bool isplayerweapon = false, bool isadminweapon = false, bool isgroupweapon = false)
        {
            Character character = player.GetCharacter();

            Weapon weapon = new Weapon(weaponhash, weapontint, isplayerweapon,
                                       isadminweapon, isgroupweapon, character.Group);

            GivePlayerWeapon(player, weapon);
        }
Beispiel #6
0
        public static void SetWeaponTint(Client player, WeaponHash weaponhash, WeaponTint weapontint)
        {
            Character character = player.GetCharacter();

            foreach (Weapon weapon in InventoryManager.DoesInventoryHaveItem <Weapon>(character))
            {
                if (weapon.WeaponHash == weaponhash)
                {
                    weapon.WeaponTint = weapontint;
                    API.Shared.SetPlayerWeaponTint(player, weaponhash, weapontint);
                }
            }
        }
Beispiel #7
0
        [Command("settint", Alias = "tint")] //Waffen Farbe ändern
        public void SetTint(Client player, string target1, WeaponHash weapon, WeaponTint tint)
        {
            if (!PlayerCommands.CheckAdminPermission(player, 2))
            {
                return;
            }

            Client target = PlayerCommands.FindPlayer(player, target1);

            if (target == null)
            {
                return;
            }

            API.SetPlayerWeaponTint(target, weapon, tint);

            API.SendChatMessageToPlayer(target, string.Format("~b~{0} hat die Färbung von {1} auf {2} geändert.", player.Name, weapon, tint));
            API.SendChatMessageToPlayer(player, string.Format("~b~Du hast {0}'s Färbung von {1} auf {2} geändert.", target.Name, weapon, tint));
        }
Beispiel #8
0
        public GunRackWeapon(Guid rackID, int index, WeaponHash hash, int ammo, WeaponTint tint, WeaponComponent[] components, bool initCall = true)
        {
            RackID = rackID;
            Index  = index;

            WeaponName = AllowedWeapons.RackWeaponData[hash].Name;
            Hash       = hash;
            Ammo       = ammo;

            Tint       = tint;
            Components = components;

            if (!initCall)
            {
                GunRackEntity rack = Main.GunRacks.FirstOrDefault(gr => gr.ID == RackID);
                if (rack == null)
                {
                    return;
                }

                GunObject = API.shared.createObject(API.shared.getHashKey(AllowedWeapons.RackWeaponData[hash].Model), new Vector3(), new Vector3());
                GunObject.attachTo(rack.RackObject, null, new Vector3(AllowedWeapons.RackOffsets[index] + AllowedWeapons.RackWeaponData[hash].Offset.X, -0.015 + AllowedWeapons.RackWeaponData[hash].Offset.Y, 0.05 + AllowedWeapons.RackWeaponData[hash].Offset.Z), new Vector3(0.0, 270.0, 270.0));
            }
        }
Beispiel #9
0
 public SpecifiedValueWeapon()
 {
     Ammo       = 0;
     WeaponTint = WeaponTint.Normal;
 }
Beispiel #10
0
 public void SetWeaponTintCmd(Client sender, WeaponTint tint)
 {
     API.setPlayerWeaponTint(sender, API.getPlayerCurrentWeapon(sender), tint);
 }
        public static void SetPlayerWeapon(Client player, Character character, int check)
        {
            // First registration of character clothes
            if (check == 0)
            {
                var weapon = new Data.Weapon {
                    CharacterId = character.Id
                };
                ContextFactory.Instance.Weapon.Add(weapon);
                ContextFactory.Instance.SaveChanges();
            }

            var characterWeapons = ContextFactory.Instance.Weapon.FirstOrDefault(x => x.CharacterId == character.Id);

            if (characterWeapons == null)
            {
                return;
            }

            // Respawn with weapons from DB
            if (check == 1)
            {
                var weaponTint = new WeaponTint();
                if (CharacterController.IsCharacterInArmy(character))
                {
                    weaponTint = WeaponTint.Army;
                }
                if (CharacterController.IsCharacterInFbi(character) ||
                    CharacterController.IsCharacterInPolice(character))
                {
                    weaponTint = WeaponTint.LSPD;
                }
                if (CharacterController.IsCharacterInGang(character))
                {
                    weaponTint = WeaponTint.Gold;
                }

                if (characterWeapons.Revolver != 0)
                {
                    GiveWeapon(player, 1, characterWeapons.RevolverPt);
                }
                API.shared.setPlayerWeaponTint(player, WeaponHash.Revolver, weaponTint);
                if (characterWeapons.CarbineRifle != 0)
                {
                    GiveWeapon(player, 2, characterWeapons.CarbineRiflePt);
                }
                API.shared.setPlayerWeaponTint(player, WeaponHash.CarbineRifle, weaponTint);
                if (characterWeapons.SniperRifle != 0)
                {
                    GiveWeapon(player, 3, characterWeapons.SniperRiflePt);
                }
                API.shared.setPlayerWeaponTint(player, WeaponHash.SniperRifle, weaponTint);
                if (characterWeapons.SmokeGrenade != 0)
                {
                    GiveWeapon(player, 4, characterWeapons.SmokeGrenadePt);
                }
                API.shared.setPlayerWeaponTint(player, WeaponHash.SmokeGrenade, weaponTint);
                if (characterWeapons.FlareGun != 0)
                {
                    GiveWeapon(player, 5, characterWeapons.FlareGunPt);
                }
                API.shared.setPlayerWeaponTint(player, WeaponHash.FlareGun, weaponTint);
                if (characterWeapons.CompactRifle != 0)
                {
                    GiveWeapon(player, 6, characterWeapons.CompactRiflePt);
                }
                API.shared.setPlayerWeaponTint(player, WeaponHash.CompactRifle, weaponTint);
                if (characterWeapons.PumpShotgun != 0)
                {
                    GiveWeapon(player, 7, characterWeapons.PumpShotgunPt);
                }
                API.shared.setPlayerWeaponTint(player, WeaponHash.PumpShotgun, weaponTint);
                if (characterWeapons.BZGas != 0)
                {
                    GiveWeapon(player, 8, characterWeapons.BZGasPt);
                }
                API.shared.setPlayerWeaponTint(player, WeaponHash.BZGas, weaponTint);
                if (characterWeapons.Nightstick != 0)
                {
                    GiveWeapon(player, 9, 1);
                }
                API.shared.setPlayerWeaponTint(player, WeaponHash.Nightstick, weaponTint);
                if (characterWeapons.StunGun != 0)
                {
                    GiveWeapon(player, 10, characterWeapons.StunGunPt);
                }
                API.shared.setPlayerWeaponTint(player, WeaponHash.StunGun, weaponTint);
                if (characterWeapons.HeavyPistol != 0)
                {
                    GiveWeapon(player, 11, characterWeapons.HeavyPistolPt);
                }
                API.shared.setPlayerWeaponTint(player, WeaponHash.HeavyPistol, weaponTint);
                if (characterWeapons.BullpupRifle != 0)
                {
                    GiveWeapon(player, 12, characterWeapons.BullpupRiflePt);
                }
                API.shared.setPlayerWeaponTint(player, WeaponHash.BullpupRifle, weaponTint);
                if (characterWeapons.HeavyShotgun != 0)
                {
                    GiveWeapon(player, 13, characterWeapons.HeavyShotgunPt);
                }
                API.shared.setPlayerWeaponTint(player, WeaponHash.HeavyShotgun, weaponTint);
            }
            // After players death
            if (check == 2)
            {
                characterWeapons.Revolver     = 0; characterWeapons.RevolverPt = 0;
                characterWeapons.CarbineRifle = 0; characterWeapons.CarbineRiflePt = 0;
                characterWeapons.SniperRifle  = 0; characterWeapons.SniperRiflePt = 0;
                characterWeapons.SmokeGrenade = 0; characterWeapons.SmokeGrenadePt = 0;
                characterWeapons.FlareGun     = 0; characterWeapons.FlareGunPt = 0;
                characterWeapons.CompactRifle = 0; characterWeapons.CompactRiflePt = 0;
                characterWeapons.PumpShotgun  = 0; characterWeapons.PumpShotgunPt = 0;
                characterWeapons.BZGas        = 0; characterWeapons.BZGasPt = 0;
                characterWeapons.Nightstick   = 0;
                characterWeapons.StunGun      = 0; characterWeapons.StunGunPt = 0;
                characterWeapons.HeavyPistol  = 0; characterWeapons.HeavyPistolPt = 0;
                characterWeapons.BullpupRifle = 0; characterWeapons.BullpupRiflePt = 0;
                characterWeapons.HeavyShotgun = 0; characterWeapons.HeavyShotgunPt = 0;
            }
            // After players disconnect (bullet and weapons saving)
            if (check == 3)
            {
                characterWeapons.RevolverPt     = API.shared.getPlayerWeaponAmmo(player, WeaponHash.Revolver);
                characterWeapons.CarbineRiflePt = API.shared.getPlayerWeaponAmmo(player, WeaponHash.CarbineRifle);
                characterWeapons.SniperRiflePt  = API.shared.getPlayerWeaponAmmo(player, WeaponHash.SniperRifle);
                characterWeapons.SmokeGrenadePt = API.shared.getPlayerWeaponAmmo(player, WeaponHash.SmokeGrenade);
                characterWeapons.FlareGunPt     = API.shared.getPlayerWeaponAmmo(player, WeaponHash.FlareGun);
                characterWeapons.CompactRiflePt = API.shared.getPlayerWeaponAmmo(player, WeaponHash.CompactRifle);
                characterWeapons.PumpShotgunPt  = API.shared.getPlayerWeaponAmmo(player, WeaponHash.PumpShotgun);
                characterWeapons.BZGasPt        = API.shared.getPlayerWeaponAmmo(player, WeaponHash.BZGas);
                characterWeapons.StunGunPt      = API.shared.getPlayerWeaponAmmo(player, WeaponHash.StunGun);
                characterWeapons.HeavyPistolPt  = API.shared.getPlayerWeaponAmmo(player, WeaponHash.HeavyPistol);
                characterWeapons.BullpupRiflePt = API.shared.getPlayerWeaponAmmo(player, WeaponHash.BullpupRifle);
                characterWeapons.HeavyShotgunPt = API.shared.getPlayerWeaponAmmo(player, WeaponHash.HeavyShotgun);
            }
            ContextFactory.Instance.SaveChanges();
        }
Beispiel #12
0
 public void setWeaponTint(WeaponHash weapon, WeaponTint tint)
 {
     API.shared.setPlayerWeaponTint(this, weapon, tint);
 }
Beispiel #13
0
        public async Task FirstTick()
        {
            try
            {
                await Delay(0);

                if (!m_firstTick)
                {
                    return;
                }

                m_firstTick = false;

                var toInsertOutfit = new Outfit
                {
                    CreatedAt        = DateTime.UtcNow,
                    Discount         = 0.0f,
                    Enabled          = true,
                    RequiredXp       = 0,
                    Price            = 0,
                    DonatorExclusive = false,
                    Name             = "Scarecrow (Halloween 2020)",
                    Components       = new List <PedComponent>
                    {
                        new PedComponent(1, 138, 2, 0),
                        new PedComponent(3, 17, 0, 0),
                        new PedComponent(4, 107, 9, 0),
                        new PedComponent(6, 84, 0, 0),
                        new PedComponent(7, 0, 0, 0),
                        new PedComponent(8, 15, 0, 0),
                        new PedComponent(9, 0, 0, 0),
                        new PedComponent(10, 0, 0, 0),
                        new PedComponent(11, 275, 2, 0),
                    },
                    Description    = "LIMITED EDITION Halloween",
                    TebexPackageId = 0,
                    Image          = "scarecrow_hw2020.png"
                };

                //var insertedOutfit = await m_database.InsertOutfit(toInsertOutfit);
                //Debug.WriteLine($"Inserted Outfit [{insertedOutfit.Name}] with ID [{insertedOutfit.Id}]");

                toInsertOutfit = new Outfit
                {
                    CreatedAt        = DateTime.UtcNow,
                    Discount         = 0.0f,
                    Enabled          = false,
                    RequiredXp       = 10000,
                    Price            = 5000,
                    DonatorExclusive = false,
                    Name             = "Oldschool Pilot",
                    Components       = new List <PedComponent>
                    {
                        new PedComponent(1, 27, 0, 0),
                        new PedComponent(3, 16, 0, 0),
                        new PedComponent(4, 8, 0, 0),
                        new PedComponent(6, 27, 0, 0),
                        new PedComponent(7, 0, 0, 0),
                        new PedComponent(8, 15, 0, 0),
                        new PedComponent(9, 0, 0, 0),
                        new PedComponent(10, 0, 0, 0),
                        new PedComponent(11, 48, 0, 0),
                    },
                    Description    = "Fly high in the sky to victory with this old school pilot outfit.",
                    TebexPackageId = 0
                };

                //insertedOutfit = await m_database.InsertOutfit(toInsertOutfit);
                //Debug.WriteLine($"Inserted Outfit [{insertedOutfit.Name}] with ID [{insertedOutfit.Id}]");


                toInsertOutfit = new Outfit
                {
                    CreatedAt  = DateTime.UtcNow,
                    Discount   = 0.0f,
                    Enabled    = false,
                    RequiredXp = 0,
                    Price      = 29999,
                    Name       = "Fighter (White)",
                    Components = new List <PedComponent>
                    {
                        new PedComponent(1, 16, 6, 0),
                        new PedComponent(3, 44, 0, 0),
                        new PedComponent(4, 31, 2, 0),
                        new PedComponent(6, 25, 0, 0),
                        new PedComponent(7, 0, 0, 0),
                        new PedComponent(8, 56, 0, 0),
                        new PedComponent(9, 0, 0, 0),
                        new PedComponent(10, 0, 0, 0),
                        new PedComponent(11, 53, 0, 0),
                    },
                    Description    = "Don't fight me",
                    TebexPackageId = 0
                };

                //insertedOutfit = await m_database.InsertOutfit(toInsertOutfit);
                //Debug.WriteLine($"Inserted Outfit [{insertedOutfit.Name}] with ID [{insertedOutfit.Id}]");

                toInsertOutfit = new Outfit
                {
                    CreatedAt  = DateTime.UtcNow,
                    Discount   = 0.0f,
                    Enabled    = false,
                    RequiredXp = 0,
                    Price      = 6449,
                    Name       = "Vagos Masked",
                    Components = new List <PedComponent>
                    {
                        new PedComponent(1, 50, 1, 0),
                        new PedComponent(3, 5, 0, 0),
                        new PedComponent(4, 7, 1, 0),
                        new PedComponent(6, 12, 0, 0),
                        new PedComponent(7, 17, 2, 0),
                        new PedComponent(8, 15, 0, 0),
                        new PedComponent(9, 0, 0, 0),
                        new PedComponent(10, 0, 0, 0),
                        new PedComponent(11, 5, 0, 0),
                    },
                    Description    = "Don't f**k wid me putto",
                    TebexPackageId = 0
                };

                //insertedOutfit = await m_database.InsertOutfit(toInsertOutfit);
                //Debug.WriteLine($"Inserted Outfit [{insertedOutfit.Name}] with ID [{insertedOutfit.Id}]");

                toInsertOutfit = new Outfit
                {
                    CreatedAt        = DateTime.UtcNow,
                    Discount         = 0.0f,
                    Enabled          = true,
                    RequiredXp       = 0,
                    Price            = 0,
                    Name             = "Death Pilot",
                    DonatorExclusive = true,
                    Components       = new List <PedComponent>
                    {
                        new PedComponent(1, 29, 4, 0),
                        new PedComponent(3, 33, 0, 0),
                        new PedComponent(4, 9, 0, 0),
                        new PedComponent(6, 12, 6, 0),
                        new PedComponent(7, 0, 0, 0),
                        new PedComponent(8, 15, 0, 0),
                        new PedComponent(9, 0, 0, 0),
                        new PedComponent(10, 0, 0, 0),
                        new PedComponent(11, 48, 0, 0),
                    },
                    Description    = "The sky is not the limit for this death masked pilot. Exclusive for Sponsors.",
                    TebexPackageId = 0
                };

                //insertedOutfit = await m_database.InsertOutfit(toInsertOutfit);
                //Debug.WriteLine($"Inserted Outfit [{insertedOutfit.Name}] with ID [{insertedOutfit.Id}]");

                toInsertOutfit = new Outfit
                {
                    CreatedAt  = DateTime.UtcNow,
                    Discount   = 0.0f,
                    Enabled    = true,
                    RequiredXp = 0,
                    Price      = 600,
                    Name       = "Gangsta (Common)",
                    Components = new List <PedComponent>
                    {
                        new PedComponent(1, 0, 0, 0),
                        new PedComponent(3, 4, 0, 0),
                        new PedComponent(4, 7, 6, 0),
                        new PedComponent(6, 14, 9, 0),
                        new PedComponent(7, 0, 0, 0),
                        new PedComponent(8, 15, 0, 0),
                        new PedComponent(9, 0, 0, 0),
                        new PedComponent(10, 0, 0, 0),
                        new PedComponent(11, 14, 13, 0),
                    },
                    Description    = "This man is from the streets and shouldn't be messed with!",
                    TebexPackageId = 0
                };

                //insertedOutfit = await m_database.InsertOutfit(toInsertOutfit);
                //Debug.WriteLine($"Inserted Outfit [{insertedOutfit.Name}] with ID [{insertedOutfit.Id}]");

                toInsertOutfit = new Outfit
                {
                    CreatedAt  = DateTime.UtcNow,
                    Discount   = 0.0f,
                    Enabled    = true,
                    RequiredXp = 18202,
                    Price      = 999,
                    Name       = "Red Vagos",
                    Components = new List <PedComponent>
                    {
                        new PedComponent(1, 50, 1, 0),
                        new PedComponent(3, 4, 0, 0),
                        new PedComponent(4, 1, 15, 0),
                        new PedComponent(6, 7, 0, 0),
                        new PedComponent(7, 0, 0, 0),
                        new PedComponent(8, 0, 0, 0),
                        new PedComponent(9, 0, 0, 0),
                        new PedComponent(10, 0, 0, 0),
                        new PedComponent(11, 7, 1, 0),
                    },
                    Description    = "Does the red indicate how many people this man has killed? Probably.",
                    TebexPackageId = 0
                };

                //insertedOutfit = await m_database.InsertOutfit(toInsertOutfit);
                //Debug.WriteLine($"Inserted Outfit [{insertedOutfit.Name}] with ID [{insertedOutfit.Id}]");

                var newWeaponTint = new WeaponTint
                {
                    CreatedAt      = DateTime.UtcNow,
                    Discount       = 0.0f,
                    Enabled        = true,
                    RequiredXp     = 0,
                    Price          = 0,
                    Name           = "Black (Default)",
                    TintId         = 0,
                    Description    = "Black Weapon Tint for Non-MK2 weapons.",
                    TebexPackageId = 0
                };

                //var insertedWeaponTint = await m_database.InsertWeaponTint(newWeaponTint);
                //Debug.WriteLine($"Inserted WeaponTint [{insertedWeaponTint.Name}] with ID [{insertedWeaponTint.Id}]");

                Cache.Outfits = await m_database.GetOutfits();

                Cache.GeneralItems = await m_database.GetGeneralItems();

                Cache.WeaponTints = await m_database.GetWeaponTints();

                //Outfits.ForEach(outfit => Debug.WriteLine(JsonConvert.SerializeObject(outfit)));
                //GeneralItems.ForEach(item => Debug.WriteLine(JsonConvert.SerializeObject(item)));
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
            finally
            {
                Tick -= FirstTick;
            }
        }
Beispiel #14
0
 public static void Tint(PedHandle ent, WeaponHash weap, WeaponTint value) => Call <WeaponTint>(SET_PED_WEAPON_TINT_INDEX, ent, weap, value);