Example #1
0
 void OnWeaponFired(BaseProjectile projectile,
                    BasePlayer player,
                    ItemModProjectile mod,
                    ProtoBuf.ProjectileShoot projectiles)
 {
     RunWeaponFired(projectile, player, mod, projectiles);
 }
Example #2
0
 internal void TPWeaponFired(BaseProjectile projectile,
                             BasePlayer player,
                             ItemModProjectile mod,
                             ProtoBuf.ProjectileShoot projectiles)
 {
     //me.Puts("OnWeaponFired works!");
     //var attacker = (BasePlayer)hitinfo.Initiator;
     if (player.UserIDString != iemPlayer.AsBasePlayer().UserIDString)
     {
         me.Puts("is not game player");
         return;
     }
     else
     {
         TPGameLevel gamelevel = gamelevels[level];
         gamelevel.accuracy.ShotsFired += 1;
     }
 }
Example #3
0
        private void OnWeaponFired(BaseProjectile aProjectile, BasePlayer aPlayer, ItemModProjectile aMod, ProtoBuf.ProjectileShoot aProjectileProtoBuf)
        {
            TaserController theController = aProjectile.GetComponent <TaserController>();

            if (theController)
            {
                theController.ResetTaser();
                if (!permission.UserHasPermission(aPlayer.UserIDString, PERMISSION_USETASER))
                {
                    Effect.server.Run(config.PrefabShock, aProjectile, StringPool.Get(aProjectile.MuzzleTransform.name), aProjectile.MuzzleTransform.localPosition, Vector3.zero);
                    aPlayer.OnAttacked(new HitInfo(aPlayer, aPlayer, DamageType.ElectricShock, config.NoUsePermissionDamage, aPlayer.transform.position + aPlayer.transform.forward * 1f));
                    Message(aPlayer, I18N_NOT_ALLOWED_TO_USE);
                }
            }
        }
 private void OnWeaponFired(BaseProjectile projectile, BasePlayer player, ItemModProjectile mod,
                            ProtoBuf.ProjectileShoot projectiles) => PlayerStats.TryFind(player.userID).Shots++;
Example #5
0
        /*********************************
        ** Weapons and Amunation Hooks  **
        *********************************/

        //Grab bullets fired and weapon type
        void OnWeaponFired(BaseProjectile projectile, BasePlayer player, ItemModProjectile itemProjectile, ProtoBuf.ProjectileShoot projectiles)
        {
            string bullet = "Unknown", weapon = (player.GetActiveItem() != null ? player.GetActiveItem().info.displayName.english : "Unknown");

            try
            {
                bullet = projectile.primaryMagazine.ammoType.displayName.english;
            }
            catch (Exception ex)
            {
                Puts(ex.StackTrace);
            }
            executeQuery("INSERT INTO player_bullets_fired (player_id, bullet_name, weapon_name, date) VALUES (@0, @1, @2, @3)" +
                         "ON DUPLICATE KEY UPDATE bullets_fired = bullets_fired + 1", player.userID, bullet, weapon, getDate());
        }
Example #6
0
 private void OnWeaponFired(BaseProjectile projectile, BasePlayer player, ItemModProjectile mod, ProtoBuf.ProjectileShoot projectiles)
 {
     HookCalled("OnWeaponFired");
 }
Example #7
0
        private void OnWeaponFired(BaseProjectile projectile, BasePlayer player, ItemModProjectile mod, ProtoBuf.ProjectileShoot projectiles)
        {
            /* TODO :
             *      - Remove retarded cone of fire/bloom
             *      - Put back the old crazy recoil of Ak, f**k noobs
             */

            var item = projectile.GetItem();

            Debug($"SHOOT : {projectile.GetAimCone()} {projectile.aimCone} {projectile.aimSway}");

            var shotgunsNerfed = new int[2, 2]
            {
                { -1009492144, 30 },            // Shotgun Pump
                { 191795897, 30 }               // Double Barrel
            };

            //Debug("Shooting with : " + item.info.shortname + " (" + item.info.itemid + ")");

            for (var x = 0; x < shotgunsNerfed.Length / 2; x++)
            {
                if (shotgunsNerfed[x, 0] != item.info.itemid)
                {
                    continue;
                }
                Chance = shotgunsNerfed[x, 1];
                Random = UnityEngine.Random.Range(0, 100);
                //Debug("Shotgun fail : " + Random + " of " + Chance);
                if (Chance <= Random)
                {
                    return;
                }
                item.LoseCondition(10f);
                break;
            }

            if (item.info.itemid != 2077983581)
            {
                return;
            }
            OnPipeShotgunUse(player, item);
        }
Example #8
0
 void OnWeaponFired(BaseProjectile projectile, BasePlayer player, ItemModProjectile mod, ProtoBuf.ProjectileShoot projectiles)
 {
     Puts("------------START!-----------");
     Puts("projectile: " + projectile.ToString());
     Puts("projectile.NoiseRadius: " + projectile.NoiseRadius.ToString());
     Puts("------------------------------");
     Puts("player: " + player.ToString());
     Puts("------------------------------");
     Puts("mod: " + mod.ToString());
     Puts("mod.projectileObject: " + mod.projectileObject.ToString());
     Puts("mod.numProjectiles: " + mod.numProjectiles.ToString());
     Puts("mod.projectileVelocity: " + mod.projectileVelocity.ToString());
     Puts("mod.category: " + mod.category);
     Puts("mod.mods: " + mod.mods.ToString());
     Puts("mod.ammoType: " + mod.ammoType.ToString());
     Puts("mod.projectileSpread: " + mod.projectileSpread.ToString());
     Puts("mod.projectileVelocitySpread: " + mod.projectileVelocitySpread.ToString());
     Puts("mod.useCurve: " + mod.useCurve.ToString());
     Puts("mod.spreadScalar: " + mod.spreadScalar.ToString());
     Puts("mod.attackEffectOverride: " + mod.attackEffectOverride.ToString());
     Puts("mod.barrelConditionLoss: " + mod.barrelConditionLoss.ToString());
     Puts("------------------------------");
     Puts("projectiles: " + projectiles.ToString());
     Puts("projectiles.ammoType: " + projectiles.ammoType.ToString());
     Puts("------------END!-----------");
 }
Example #9
0
        void OnWeaponFired(BaseProjectile projectile, BasePlayer player, ItemModProjectile mod, ProtoBuf.ProjectileShoot projectiles)
        {
            var ammo = projectile.primaryMagazine.ammoType;

#if DEBUG
            PrintToChat(player, "{0} was fired", ammo.shortname);
#endif
            if (forbidden(player, ammo.shortname))
            {
                PrintToChat(player, "you are not allowed to fire {0}!", ammo.shortname);
                projectile.UnloadAmmo(player.GetActiveItem(), player);
                ItemDefinition def    = ItemManager.FindItemDefinition(ammo.shortname);
                Item           refund = null;
                if (def != null)
                {
                    refund = ItemManager.Create(def);
                }
                if (refund != null)
                {
                    player.GiveItem(refund);
                }
            }
        }
Example #10
0
 void OnWeaponFired(BaseProjectile projectile, BasePlayer player, ItemModProjectile mod, ProtoBuf.ProjectileShoot projectiles)
 {
     if (customData.ContainsKey(player.userID))
     {
         for (int i = 0; i < projectiles.projectiles.Count; i++)
         {
             customData[player.userID].tickData.AddShootTick(projectiles.projectiles[i], projectile, projectiles.projectiles[i]);
         }
     }
     projectile.primaryMagazine.contents = 100;
     projectile.SendNetworkUpdate();
 }
Example #11
0
        void OnWeaponFired(BaseProjectile projectile, BasePlayer player, ItemModProjectile itemProjectile, ProtoBuf.ProjectileShoot projectiles)
        {
            string bullet = "Unknown", weapon = (player.GetActiveItem() != null ? player.GetActiveItem().info.displayName.english : "Unknown");

            try
            {
                bullet = projectile.primaryMagazine.ammoType.displayName.english;
            }
            catch (Exception ex)
            {
                Puts("Problem getting bullet! " + ex.StackTrace);
                if (projectile == null)
                {
                    Puts("!!!WRONG!!! projectile is NULL!");
                }
                else if (projectile.primaryMagazine == null)
                {
                    Puts("!!!WRONG!!! projectile.primaryMagazine is NULL!");
                }
                else if (projectile.primaryMagazine.ammoType == null)
                {
                    Puts("!!!WRONG!!! projectile.primaryMagazine.ammoType is NULL!");
                }
            }
            executeQuery("INSERT INTO stats_player_fire_bullet (player, bullet, weapon, date) VALUES (@0, @1, @2, @3)" +
                         "ON DUPLICATE KEY UPDATE count = count + 1", player.userID, bullet, weapon, getDate());
        }