private void FreezePlayerDeath(UnturnedPlayer player, EDeathCause cause, ELimb limb, CSteamID murderer)
 {
     if (UEssentials.Config.UnfreezeOnDeath && player.GetComponent <FrozenPlayer>() != null)
     {
         UnityEngine.Object.Destroy(player.GetComponent <FrozenPlayer>());
     }
 }
Ejemplo n.º 2
0
 private void disconnect(UnturnedPlayer player)
 {
     if (player.GetComponent <PlayerComponent>().HasBeenStarted)
     {
         player.GetComponent <PlayerComponent>().desconectado(player);
     }
 }
Ejemplo n.º 3
0
        // Al salir de la zona se quite la UI y le quite los permisos de robar
        private void onZoneLeft(UnturnedPlayer player, Zone zone, Vector3 lastPos)
        {
            // Si tiene la flag
            if (zone.hasFlag(robar))
            {
                player.Player.setPluginWidgetFlag(EPluginWidgetFlags.Modal, false);


                if (player.GetComponent <PlayerComponent>().HasBeenStarted)
                {
                    StartCoroutine(player.GetComponent <PlayerComponent>().TerminarRobo(player));
                }
            }
        }
Ejemplo n.º 4
0
        public void Start()
        {
            Stats = new XMLFileAsset <StatKeeper.Stats>(Path.Combine(Plugin.Instance.Directory, "Stats/" + Player.Id + ".xml"));
            Stats.Instance.SteamID = (ulong)Player.CSteamID;

            //TODO: Add tracking of acc when player is in combat

            Player.Events.OnDeath += (UnturnedPlayer player, SDG.Unturned.EDeathCause cause, SDG.Unturned.ELimb limb, Steamworks.CSteamID m) => {
                UnturnedPlayer murderer = UnturnedPlayer.FromCSteamID(m);

                if (murderer != null && PlayerTool.getSteamPlayer(m) != null && cause != SDG.Unturned.EDeathCause.SUICIDE)
                {
                    XMLFileAsset <Stats> killerStats = murderer.GetComponent <StatsPlayerComponent>().Stats;

                    if (limb == SDG.Unturned.ELimb.SKULL)
                    {
                        killerStats.Instance.HeadShots += 1;
                    }

                    killerStats.Instance.Kills += 1;
                    killerStats.Instance.RecalculateStats();
                    killerStats.Save();
                }

                Stats.Instance.Deaths += 1;
                Stats.Instance.RecalculateStats();
                Stats.Save();
                Plugin.Instance.UpdateRank();
            };
            Stats.Instance.RecalculateStats();
            Plugin.Instance.UpdateRank();
        }
Ejemplo n.º 5
0
        public void ItemEffect(UnturnedPlayer p, ushort ID)
        {
            var i = Configuration.Instance.ItemShop.FirstOrDefault(x => x.Id == ID);

            if (i != null)
            {
                TShopComponent cp   = p.GetComponent <TShopComponent>();
                Asset          a    = Assets.find(EAssetType.ITEM, ID);
                string         cost = Translate("Buy_Price") + i.BuyCost + "|" + Translate("Sell_Price") + i.SellCost;
                cost = cost.Replace("|", "" + System.Environment.NewLine);

                string description = ((ItemAsset)a).itemDescription;

                string amt = cp.amt.ToString();
                cp.lookingid = i.Id;
                EffectManager.askEffectClearByID(Configuration.Instance.Main2ID, p.CSteamID);
                EffectManager.askEffectClearByID(Configuration.Instance.Main1ID, p.CSteamID);
                EffectManager.sendUIEffect(Configuration.Instance.BuySellID, 700, p.CSteamID, true, ((ItemAsset)a).itemName.ToString() + " (ID:" + ID + ")", cost, description, amt);
            }
            else
            {
                UnturnedChat.Say(p, Translate("item_isn't_added", Assets.find(EAssetType.ITEM, search).name, search), color: ErrorColor);
                return;
            }
        }
 private void FreezePlayerDisconnect(UnturnedPlayer player)
 {
     if (!UEssentials.Config.UnfreezeOnQuit && player.GetComponent <FrozenPlayer>() != null)
     {
         DisconnectedFrozen.Add(player.CSteamID.m_SteamID);
     }
 }
Ejemplo n.º 7
0
        public void Execute(IRocketPlayer rCaller, string[] Command)
        {
            UnturnedPlayer uPlayer = (UnturnedPlayer)rCaller;

            if (Command.Length > 0)
            {
                UnturnedChat.Say(uPlayer, Syntax, Color.red); return;
            }

            UtilPlayer utilPlayer = uPlayer.GetComponent <UtilPlayer>();

            if (VehicleTeleporter.Instance.HasVehicles(uPlayer.CSteamID) > 0)
            {
                int vehicleCount = 0;
                foreach (InteractableVehicle Vehicle in utilPlayer.vehicleList)
                {
                    vehicleCount++;
                    UnturnedChat.Say(uPlayer, $"[{vehicleCount}/{utilPlayer.vehicleList.Count}] {Vehicle.asset.vehicleName}", Color.yellow);
                }
                return;
            }
            else
            {
                UnturnedChat.Say(uPlayer, "You do not have any locked vehicles!", Color.red);
                return;
            }
        }
Ejemplo n.º 8
0
 public static bool BroadCast(string pluginid, string key, Color color, params object[] parameters)
 {
     foreach (SteamPlayer sp in Provider.clients)
     {
         UnturnedPlayer         player    = UnturnedPlayer.FromSteamPlayer(sp);
         Plugin.PlayerComponent component = player.GetComponent <Plugin.PlayerComponent>();
         string lang = component.lang;
         string text = Instance.Configuration.Instance.PluginTranslate.Find(x => x.pluginid == pluginid).Langs.Find(x => x.LangID == lang).LangString.Find(x => x.id == key).text;
         if (string.IsNullOrEmpty(text))
         {
             return(false);
         }
         if (text.Contains("{") && text.Contains("}") && parameters != null && parameters.Length != 0)
         {
             for (int i = 0; i < parameters.Length; i++)
             {
                 if (parameters[i] == null)
                 {
                     parameters[i] = "NULL";
                 }
             }
             text = string.Format(text, parameters);
         }
         UnturnedChat.Say(player, text, color);
     }
     return(true);
 }
Ejemplo n.º 9
0
        private void onDamageStructureRequested(CSteamID instigatorSteamID, Transform structureTransform, ref ushort pendingTotalDamage, ref bool shouldAllow, EDamageOrigin damageOrigin)
        {
            UnturnedPlayer player = UnturnedPlayer.FromCSteamID(instigatorSteamID);

            UnturnedChat.Say($" DAMAGE {pendingTotalDamage}");
            player.GetComponent <PlayerComponent>().letmeclearcode(player, pendingTotalDamage);
        }
Ejemplo n.º 10
0
 private void OnPlayerConnected(UnturnedPlayer uPlayer)
 {
     if (Configuration.Instance.RocketRegionsSupport)
     {
         uPlayer.GetComponent <SwitchPlayer>().JoinUnix = CurrentUnix();
     }
 }
Ejemplo n.º 11
0
        private void UnturnedPlayerEvents_OnPlayerChatted(UnturnedPlayer player, ref Color color, string message, EChatMode chatMode, ref bool cancel)
        {
            ChatControlPlayerComponent component = player.GetComponent <ChatControlPlayerComponent>();

            if (!player.HasPermission("ChatControl.IgnoreBadwords") && message.ToCharArray()[0] != '/' && chatMode != EChatMode.GROUP)
            {
                foreach (string badword in Instance.Configuration.Instance.Badwords)
                {
                    if (message.ToLower().Contains(badword.ToLower()))
                    {
                        //UnturnedChat.Say(player, Translate("badword_detected", badword, ++component.Warnings), MessageColor);
                        CommandWindow.input.onInputText(Translate("command", player.Id));
                        cancel = true;
                        break;
                    }
                }
            }

            if (component.IsMuted)
            {
                cancel = true;
                UnturnedChat.Say(player, Translate("you_are_muted"), MessageColor);
                return;
            }
        }
Ejemplo n.º 12
0
        //Events for On Player connected

        private void Events_OnPlayerConnected(UnturnedPlayer player)
        {
            if (player.IsAdmin || player.HasPermission("jail.immune"))
            {
                return;
            }

            if (players.ContainsKey(player.ToString()))
            {
                if (JailTime.Instance.Configuration.Instance.BanOnReconnect)
                {
                    //removePlayerFromJail(player, players[player.ToString()]);
                    //players.Remove(player.ToString());

                    //Send player over to Player Component (JailTimePlayer) to handle ban on reconnect.

                    //Debug.
                    Logger.Log("Sending " + player.SteamName + " to ban on reconnect.");
                    Logger.Log("Ping: " + player.Ping);

                    JailTimePlayer jailtimeplayer = player.GetComponent <JailTimePlayer>();
                    jailtimeplayer.SetBan(player);
                    players.Remove(player.ToString());
                }
                else
                {
                    if (!(players[player.ToString()].End <= DateTime.Now))
                    {
                        movePlayerToJail_OnPlayerRevive_Connect(player, players[player.ToString()].Cell);
                        UnturnedChat.Say(player, JailTime.Instance.Translate("jailtime_player_back_msg"));
                    }
                }
            }
        }
Ejemplo n.º 13
0
        public void Execute(IRocketPlayer caller, string[] args)
        {
            if (args.Length == 1)
            {
                UnturnedPlayer other = UnturnedPlayer.FromName(args[0]);

                if (other == null)
                {
                    UnturnedChat.Say(caller, Util.Translate("invalid_player"), Color.red);
                }
                else
                {
                    UnturnedChat.Say(caller, Util.Translate("other", other.DisplayName,
                                                            other.GetComponent <PvpPlayer>().PvpEnabled ? "on" : "off"));
                }
            }
            else
            {
                PvpPlayer p = ((UnturnedPlayer)caller).GetComponent <PvpPlayer>();
                p.PvpEnabled = !p.PvpEnabled;
                UnturnedChat.Say(caller, Util.Translate("pvp_toggled", p.PvpEnabled ? "on" : "off"));

                if (p.IndicatorEnabled)
                {
                    CSteamID id = ((UnturnedPlayer)caller).CSteamID;
                    EffectManager.sendUIEffect(Util.Config().indicatorEffectId, 1201, id, true, p.PvpEnabled ? "PVP" : "PVE");
                }
            }
        }
Ejemplo n.º 14
0
        public void CreateChallenge(UnturnedPlayer p, DateTime expiry, Arena arena)
        {
            ExtraPlayer ep = p.GetComponent <ExtraPlayer>();

            ep.challenges.Add(Player.CSteamID.m_SteamID, new Challenge(Player, p, arena, expiry));
            UnturnedChat.Say(p, Util.Translate("extraduel_challenge", arena.name, Player.DisplayName), Color.yellow);
        }
Ejemplo n.º 15
0
 public void UpdateInfo(UnturnedPlayer player, string lang)
 {
     if (Plugin.Instance.Configuration.Instance.isDB)
     {
         MySqlConnection mySqlConnection = this.createConnection();
         MySqlCommand    mySqlCommand    = mySqlConnection.CreateCommand();
         mySqlCommand.CommandText = string.Concat(new string[]
         {
             "UPDATE ",
             Plugin.Instance.Configuration.Instance.mysqltable,
             " SET Language = '",
             lang,
             "' WHERE Steam64ID = '",
             player.CSteamID.m_SteamID.ToString(),
             "';"
         });
         mySqlConnection.Open();
         mySqlCommand.ExecuteNonQuery();
         mySqlConnection.Close();
     }
     else
     {
         if (Plugin.Instance.Configuration.Instance.Users.Exists(x => x.playerid == player.CSteamID.m_SteamID))
         {
             Plugin.Instance.Configuration.Instance.Users.Find(x => x.playerid == player.CSteamID.m_SteamID).lang = lang;
             Plugin.Instance.Configuration.Save();
         }
     }
     Plugin.PlayerComponent component = player.GetComponent <Plugin.PlayerComponent>();
     component.lang = lang;
 }
Ejemplo n.º 16
0
        // Cuando entre a la zona del robo que se ejecute los comandos
        private void onZoneEnter(UnturnedPlayer player, Zone zone, Vector3 lastPos)
        {
            RocketPlayer rocketPlayer = new RocketPlayer(player.Id);

            if (zone.hasFlag(robar))
            {
                Zone currentzone = AdvancedZones.Instance.getZoneByName(NombreZona = $"{zone.getName()}");

                Zone currentZoneFixed = AdvancedZones.Instance.getZoneByName(Atracos.Instance.NombreZona);

                foreach (var parameter in currentZoneFixed.GetParameters())
                {
                    if (parameter.name.Contains("TitletUI"))
                    {
                        var    TitleUI       = parameter.values.FirstOrDefault().ToString();
                        string TitleUIString = TitleUI;
                        Titulo = TitleUIString;
                    }
                    if (parameter.name.Contains("TextUI"))
                    {
                        var    TextUI       = parameter.values.FirstOrDefault().ToString();
                        string TextUIString = TextUI;
                        Texto = TextUIString;
                    }
                }

                if (!player.GetComponent <PlayerComponent>().HasBeenStarted)
                {
                    player.Player.setPluginWidgetFlag(EPluginWidgetFlags.Modal, true);
                    EffectManager.sendUIEffect(16777, 16778, player.CSteamID, true, Titulo, Texto);
                }

                if (player.GetComponent <PlayerComponent>().HasBeenStarted)
                {
                    StopCoroutine(player.GetComponent <PlayerComponent>().TerminarRobo(player));
                }
            }
            else
            {
                if (rocketPlayer.HasPermission(Atracos.Instance.Configuration.Instance.PolicePermission) && !rocketPlayer.HasPermission("*"))
                {
                    ChatManager.serverSendMessage(Atracos.Instance.Translate("EnterPolice").Replace('(', '<').Replace(')', '>'), Color.white, null, player.SteamPlayer(), EChatMode.WELCOME, Atracos.Instance.Configuration.Instance.iconwarn, true);
                    return;
                }
            }
        }
Ejemplo n.º 17
0
        private void OnPlayerConnected(UnturnedPlayer player)
        {
            PvpPlayer p = player.GetComponent <PvpPlayer>();

            if (p.IndicatorEnabled)
            {
                EffectManager.sendUIEffect(Util.Config().indicatorEffectId, 1201, player.CSteamID, true, p.PvpEnabled ? "PVP" : "PVE");
            }
        }
Ejemplo n.º 18
0
        private void PlayerUpdatedPosition(UnturnedPlayer p, Vector3 pos)
        {
            ExtraPlayer ep = p.GetComponent <ExtraPlayer>();

            if (!ArenaCheck(p, pos, ep.lastPosition))
            {
                ep.lastPosition = pos;
            }
        }
Ejemplo n.º 19
0
        private void OnPlayerRespawn(UnturnedPlayer _player, Vector3 _position, byte _angle)
        {
            tmpComponent = _player.GetComponent <CombatLogPlayerComponent>();

            tmpComponent.Init(this.Configuration.Instance.CombatLogGracePeriod,
                              this.Configuration.Instance.WarningMessageColor,
                              this.Configuration.Instance.ReminderNotifications,
                              this.Configuration.Instance.ReminderNotificationInterval);
        }
Ejemplo n.º 20
0
        private void OnPlayerDisconnected(UnturnedPlayer _player)
        {
            tmpComponent = _player.GetComponent <CombatLogPlayerComponent>();

            if (tmpComponent.InCombat)
            {
                ProcessCombatLogger(_player);
            }
        }
Ejemplo n.º 21
0
        private void OnDamage(Player player, ref EDeathCause cause, ref ELimb limb, ref CSteamID killer, ref Vector3 direction, ref float damage, ref float times, ref bool canDamage)
        {
            if (player == null || killer == Provider.server)
            {
                return;
            }

            UnturnedPlayer p = UnturnedPlayer.FromPlayer(player);
            UnturnedPlayer k = UnturnedPlayer.FromCSteamID(killer);

            if (p?.CSteamID == null || k?.CSteamID == null)
            {
                return;
            }

            if (p.CSteamID == killer)
            {
                return;
            }

            if ((p.IsAdmin || k.IsAdmin) && Util.Config().ignoreAdmins)
            {
                return;
            }

            if (p.GetPermissions().Any(x => x.Name == "pvptoggle.ignore") || k.GetPermissions().Any(x => x.Name == "pvptoggle.ignore"))
            {
                return;
            }

            if (!p.GetComponent <PvpPlayer>().PvpEnabled || !k.GetComponent <PvpPlayer>().PvpEnabled)
            {
                if (Util.Config().enableWarningEffect&& (DateTime.Now - k.GetComponent <PvpPlayer>().LastWarned).TotalSeconds > Util.Config().warningCooldown)
                {
                    EffectManager.sendUIEffect(Util.Config().warningEffectId, 1200, killer, true);
                    CSteamID attacker = killer;
                    StartCoroutine(DelayedInvoke(Util.Config().warningScreentime,
                                                 () => EffectManager.askEffectClearByID(Util.Config().warningEffectId, attacker)));
                    k.GetComponent <PvpPlayer>().LastWarned = DateTime.Now;
                }
                damage    = 0;
                canDamage = false;
            }
        }
Ejemplo n.º 22
0
        public void Execute(IRocketPlayer caller, string[] args)
        {
            if (args.Length != 1)
            {
                UnturnedChat.Say(caller, Syntax, Color.red);
                return;
            }

            UnturnedPlayer uPlayer = (UnturnedPlayer)caller;

            if (Int32.TryParse(args[0], out int posNumber))
            {
                switch (posNumber)
                {
                case 1:
                {
                    Vector3     position = uPlayer.Position;
                    ExtraPlayer player   = uPlayer.GetComponent <ExtraPlayer>();
                    player.selectedPos1 = position;
                    UnturnedChat.Say(Util.Translate("extraduel_setposition_success", 1, position.ToString()),
                                     Color.green);
                    break;
                }

                case 2:
                {
                    Vector3     position = uPlayer.Position;
                    ExtraPlayer player   = uPlayer.GetComponent <ExtraPlayer>();
                    player.selectedPos2 = position;
                    UnturnedChat.Say(Util.Translate("extraduel_setposition_success", 2, position.ToString()),
                                     Color.green);
                    break;
                }

                default:
                    UnturnedChat.Say(caller, Syntax, Color.red);
                    break;
                }
            }
            else
            {
                UnturnedChat.Say(caller, Syntax, Color.red);
            }
        }
Ejemplo n.º 23
0
        private void OnPlayerDeath(UnturnedPlayer uVictim, EDeathCause Cause, ELimb Limb, CSteamID Murderer)
        {
            if (UnturnedPlayer.FromCSteamID(Murderer).HasPermission("killlimiter.ignore"))
            {
                return;
            }

            UnturnedPlayer uKiller = UnturnedPlayer.FromCSteamID(Murderer);

            uKiller.GetComponent <PlayerUtil>().Kills++;

            if (uKiller.GetComponent <PlayerUtil>().Kills == Instance.Configuration.Instance.KillLimit)
            {
                uKiller.GetComponent <PlayerUtil>().CanKillTime = GetLongTime();
                uKiller.GetComponent <PlayerUtil>().canKill     = false;
                UnturnedChat.Say(uKiller, $"You can no longer damage other players for {Instance.Configuration.Instance.LimitCooldown} seconds!", Color.red);
            }
            return;
        }
Ejemplo n.º 24
0
        public IEnumerator TerminarRobo(UnturnedPlayer player)
        {
            RocketPlayer rocketPlayer = new RocketPlayer(player.Id);

            if (rocketPlayer.HasPermission("advancedrobs") && !rocketPlayer.HasPermission("*"))
            {
                yield return(new WaitForSeconds(Atracos.Instance.Configuration.Instance.LeaveRobSecondsForGoBack));

                StopCoroutine(player.GetComponent <PlayerComponent>().RobarIniciar(player, player.GetComponent <PlayerComponent>().TimeRob, player.GetComponent <PlayerComponent>().Reward));
                {
                    player.GetComponent <PlayerComponent>().HasBeenStarted = false;
                    // Enviar el mensaje de que el robo a sido cancelado
                    Robo.Remove(Atracos.Instance.NombreZona);
                    ChatManager.serverSendMessage(Atracos.Instance.Translate("leaverob", player.DisplayName, Atracos.Instance.NombreZona).Replace('(', '<').Replace(')', '>'), Color.white, null, null, EChatMode.SAY, Atracos.Instance.Configuration.Instance.leavearearobmessageicon, true);
                    // Borrar el UI del reward
                    EffectManager.askEffectClearByID(Atracos.Instance.Configuration.Instance.UIReward, player.CSteamID);
                }
            }
        }
Ejemplo n.º 25
0
        public void Execute(IRocketPlayer caller, string[] command)
        {
            if (command.Length == 0 || command.Length > 1)
            {
                UnturnedChat.Say(caller, Syntax + " - " + Help);
                return;
            }
            UnturnedPlayer player     = (UnturnedPlayer)caller;
            PVirtStorage   pComponent = player.GetComponent <PVirtStorage>();


            Dictionary <string, object[]> containers = VirtualStorage.Database.GetContainerList(player.CSteamID);
            string defaultContainer = VirtualStorage.Database.GetDefaultContainer(player.CSteamID);

            object[] container = containers.Values.FirstOrDefault(contents => contents[2].ToString().ToLower() == command[0].ToLower().Trim());
            if (container == null)
            {
                UnturnedChat.Say(caller, VirtualStorage.Instance.Translate("container_name_not_found"), Color.red);
                return;
            }


            ContainerManager cData = null;

            // Load the container data, if it isn't already loaded.
            if (VirtualStorage.Containers.ContainsKey(player.CSteamID) && VirtualStorage.Containers[player.CSteamID].ContainerName.ToLower() == container[2].ToString().Trim().ToLower())
            {
                cData = VirtualStorage.Containers[player.CSteamID];
                VirtualStorage.Containers.Remove(player.CSteamID);
            }

            if (cData == null)
            {
                object[] cObject = VirtualStorage.Database.GetContainerData(player.CSteamID, container[2].ToString());
                cData = new ContainerManager(player);
                if (!cData.SetContainer((ushort)cObject[0], (byte[])cObject[1], player, (string)cObject[2], (byte)cObject[3], (byte)cObject[4]))
                {
                    if (!cData.SetContainer(VirtualStorage.Instance.Configuration.Instance.FallbackAssetID, (byte[])cObject[1], player, (string)cObject[2], (byte)cObject[3], (byte)cObject[4]))
                    {
                        UnturnedChat.Say(caller, VirtualStorage.Instance.Translate("open_invalid"), Color.red);
                        return;
                    }
                }
            }

            if (!string.IsNullOrEmpty(defaultContainer))
            {
                if (defaultContainer.ToLower() == command[0].Trim().ToLower())
                {
                    VirtualStorage.Database.SaveDefaultContainer(player.CSteamID, string.Empty);
                }
            }
            VirtualStorage.Database.RemoveContainerFromDB(player.CSteamID, container[2].ToString());
            cData.Break();
        }
Ejemplo n.º 26
0
        public void Execute(IRocketPlayer caller, string[] command)
        {
            UnturnedPlayer   player           = (UnturnedPlayer)caller;
            PVirtStorage     pComponent       = player.GetComponent <PVirtStorage>();
            string           DefaultContainer = VirtualStorage.Database.GetDefaultContainer(player.CSteamID);
            ContainerManager cData            = null;

            if (string.IsNullOrEmpty(DefaultContainer))
            {
                UnturnedChat.Say(caller, VirtualStorage.Instance.Translate("no_default_set"), Color.red);
                return;
            }

            object[] cInfo = VirtualStorage.Database.GetContainerData(player.CSteamID, DefaultContainer);
            if (cInfo == null)
            {
                UnturnedChat.Say(caller, VirtualStorage.Instance.Translate("open_data_not_found"), Color.red);
                return;
            }
            if (VirtualStorage.Containers.ContainsKey(player.CSteamID) && VirtualStorage.Containers[player.CSteamID].ContainerName == DefaultContainer)
            {
                cData = VirtualStorage.Containers[player.CSteamID];
            }
            else
            {
                if (VirtualStorage.Containers.ContainsKey(player.CSteamID))
                {
                    VirtualStorage.Containers[player.CSteamID].Cleanup();
                }
                cData = new ContainerManager(player);
                if (!cData.SetContainer((ushort)cInfo[0], (byte[])cInfo[1], player, (string)cInfo[2], (byte)cInfo[3], (byte)cInfo[4]))
                {
                    UnturnedChat.Say(caller, VirtualStorage.Instance.Translate("open_invalid"), Color.red);
                    return;
                }
            }
            if (VirtualStorage.TryCharge(caller, VirtualStorage.Instance.Configuration.Instance.OpenChargeCost, "vs.overrideopencost"))
            {
                if (!VirtualStorage.Containers.ContainsKey(player.CSteamID))
                {
                    VirtualStorage.Containers.Add(player.CSteamID, cData);
                }
                if (!caller.HasPermission("vs.overrideopencost"))
                {
                    UnturnedChat.Say(caller, VirtualStorage.Instance.Translate("open_charged", Math.Round(VirtualStorage.Instance.Configuration.Instance.OpenChargeCost, 2), fr34kyn01535.Uconomy.Uconomy.Instance.Configuration.Instance.MoneyName), Color.cyan);
                }
                pComponent.cData = cData;
                cData.Open();
            }
            else
            {
                UnturnedChat.Say(caller, VirtualStorage.Instance.Translate("not_enough_credits", fr34kyn01535.Uconomy.Uconomy.Instance.Configuration.Instance.MoneyName), Color.red);
            }
        }
Ejemplo n.º 27
0
        private void OnDamageVehicle(CSteamID instigatorSteamID, InteractableVehicle vehicle, ref ushort pendingTotalDamage, ref bool canRepair, ref bool shouldAllow, EDamageOrigin damageOrigin)
        {
            UnturnedPlayer player = UnturnedPlayer.FromCSteamID(instigatorSteamID);

            // uff zombie detector and player -_-
            if (pendingTotalDamage <= 2)
            {
                return;
            }

            if (player == null)
            {
                return;
            }

            // need to do some changes here, with health update, because when u hit a player still working this function, nelson nigger don't want to fix this...
            if (damageOrigin.ToString() == "Vehicle_Collision_Self_Damage")
            {
                if (player.CurrentVehicle.asset.engine == EEngine.CAR)
                {
                    if (player.CurrentVehicle.health < VehicleCrash.Instance.Configuration.Instance.ifvehiclehasXhealthStopWork)
                    {
                        burn_Fuel(player.CurrentVehicle);

                        vehicle.forceRemoveAllPlayers();

                        if (VehicleCrash.Instance.Configuration.Instance.autowarnmechanic)
                        {
                            ChatManager.serverSendMessage(VehicleCrash.Instance.Translate("warning", player.DisplayName).Replace('(', '<').Replace(')', '>'), Color.white, null, null, EChatMode.SAY, VehicleCrash.Instance.Translate("iconwarning", player.DisplayName), true);
                        }
                    }
                    else
                    {
                        tire_Damage(player, UnityEngine.Random.Range(1, 2), UnityEngine.Random.value);

                        foreach (var passenger in vehicle.passengers)
                        {
                            UnturnedPlayer jugador = UnturnedPlayer.FromSteamPlayer(passenger.player);

                            if (jugador != null && !jugador.GetComponent <PlayerComponent>().niggagetwork)
                            {
                                StartCoroutine(crash(jugador));
                            }
                            // break; my cucumber idk, for prevent bugs
                            break;
                        }
                    }
                }
            }
        }
Ejemplo n.º 28
0
        public void Execute(IRocketPlayer caller, string[] bed)
        {
            UnturnedPlayer playerId   = (UnturnedPlayer)caller;
            HomePlayer     homePlayer = playerId.GetComponent <HomePlayer>();

            object[] cont = ZaupHomeCommand.CheckConfig(playerId);
            if (!(bool)cont[0])
            {
                return;
            }
            // A bed was found, so let's run a few checks.
            HomePlayer.CurrentHomePlayers.Add(playerId, homePlayer);
            homePlayer.GoHome((Vector3)cont[1], (byte)cont[2], playerId);
        }
Ejemplo n.º 29
0
        public static bool SendChat(UnturnedPlayer player, string pluginid, string key, Color color)
        {
            Plugin.PlayerComponent component = player.GetComponent <Plugin.PlayerComponent>();
            string lang = component.lang;
            string text = Instance.Configuration.Instance.PluginTranslate.Find(x => x.pluginid == pluginid).Langs.Find(x => x.LangID == lang).LangString.Find(x => x.id == key).text;

            if (string.IsNullOrEmpty(text))
            {
                UnturnedChat.Say(player, key, color);
                return(false);
            }
            UnturnedChat.Say(player, text, color);
            return(true);
        }
Ejemplo n.º 30
0
        private void Instance_OnBalanceUpdate(UnturnedPlayer player, decimal amt)
        {
            if (player == null)
            {
                return;
            }
            if (player.Player == null)
            {
                return;
            }
            if (player.GetComponent <UconomyUIComponent>() == null)
            {
                return;
            }
            if (player.GetComponent <UconomyUIComponent>().Disabled)
            {
                return;
            }

            EffectManager.sendUIEffect(Configuration.Instance.EffectId, (short)Configuration.Instance.EffectId,
                                       player.CSteamID, true,
                                       $"<color=#{Configuration.Instance.colorBalance}>${Uconomy.Instance.Database.GetBalance(player.CSteamID.ToString()).ToString()}</color>");
        }