private void OnPickup(Synapse.Api.Events.SynapseEventArguments.PlayerPickUpItemEventArgs ev)
 {
     if (ev.Item.ID == PluginClass.TranquilizerID)
     {
         ev.Player.SendBroadcast(7, PluginClass.GetTranslation("pickuptranq"));
     }
 }
        private void OnDrop(Synapse.Api.Events.SynapseEventArguments.PlayerDropItemEventArgs ev)
        {
            if (!ev.Player.GetComponent <TranquilizerPlayerScript>().Stuned)
            {
                return;
            }

            ev.Allow = false;
            ev.Player.GiveTextHint(PluginClass.GetTranslation("stuneddrop"));
        }
Beispiel #3
0
        private IEnumerator <float> _stun()
        {
            if (Player.CustomRole != null && PluginClass.Config.BlockedIDs.Any(x => x == Player.CustomRole.GetRoleID()))
            {
                yield break;
            }
            if (PluginClass.Config.BlockedIDs.Any(x => x == (int)Player.RoleType))
            {
                yield break;
            }

            Player.SendBroadcast(5, PluginClass.GetTranslation("stun"));

            Synapse.Api.Ragdoll rag = null;
            if (PluginClass.Config.SpawnRagdoll)
            {
                rag = Map.Get.CreateRagdoll(Player.RoleType, Player.Position, Quaternion.identity, Vector3.zero, new PlayerStats.HitInfo(), false, Player);
            }

            if (PluginClass.Config.DropInventory)
            {
                Player.Inventory.DropAll();
            }

            var pos = Player.Position;

            Player.GodMode  = true;
            Player.Position = Vector3.up;

            Stuned = true;

            yield return(Timing.WaitForSeconds(UnityEngine.Random.Range(PluginClass.Config.MinStunTime, PluginClass.Config.MaxStunTime)));

            if (rag != null)
            {
                rag.Destroy();
            }
            Player.GodMode  = false;
            Player.Position = pos;
            Stuned          = false;
        }
        private void OnReload(Synapse.Api.Events.SynapseEventArguments.PlayerReloadEventArgs ev)
        {
            if (ev.Item.ID != PluginClass.TranquilizerID)
            {
                return;
            }

            if (!PluginClass.Config.Reloadable)
            {
                ev.Allow = false;
                ev.Player.GiveTextHint(PluginClass.GetTranslation("noreload"));
                return;
            }

            if (ev.Player.Ammo9 >= 18)
            {
                return;
            }

            ev.Allow = false;
            ev.Player.GiveTextHint(PluginClass.GetTranslation("noammo"));
        }
Beispiel #5
0
        public override void Load()
        {
            pclass = this;
            Server.Get.ItemManager.RegisterCustomItem(new Synapse.Api.Items.CustomItemInformation()
            {
                BasedItemType = ItemType.GunUSP,
                ID            = TranquilizerID,
                Name          = "Tranquilizer"
            });

            var trans = new Dictionary <string, string>
            {
                { "pickuptranq", "<b>You picked up a <color=blue>Tranquilizer</color>!\nThis Weapon will stun your enemys</b>" },
                { "stun", "<b>You are stuned by a <color=blue>Tranquilizer</color></b>" },
                { "noammo", "You dont have enough Ammo to Reload your Tranquilizer" },
                { "stuneddrop", "You cant drop any Item while you are stuned!" },
                { "noreload", "You cant Reload the Tranquilizer on this Server" }
            };

            Translation.CreateTranslations(trans);

            new EventHandlers();
        }