internal void removePlayer(RocketPlayer caller, string playerName)
        {
            RocketPlayer target;

            try
            {
                target = RocketPlayer.FromCSteamID(new CSteamID(Convert.ToUInt64(playerName)));
            }
            catch
            {
                target = RocketPlayer.FromName(playerName);
            }

            if (target != null && players.ContainsKey(target.ToString()))
            {
                removePlayerFromJail(target, players[target.ToString()]);
                RocketChat.Say(target, JailTime.Instance.Translate("jailtime_player_release_msg"));

                if (caller != null)
                {
                    RocketChat.Say(caller, JailTime.Instance.Translate("jailtime_player_released", target.CharacterName));
                }
                players.Remove(target.ToString());
            }
            else
            {
                if (caller != null)
                {
                    RocketChat.Say(caller, JailTime.Instance.Translate("jailtime_player_notfound", playerName));
                }
                return;
            }
        }
Exemplo n.º 2
0
 private void PrintMessageToPlayerList(string _message)
 {
     foreach (ulong sID in playerIDSendToList)
     {
         RocketChat.Say(RocketPlayer.FromCSteamID((CSteamID)sID), parentName + ": " + _message);
     }
 }
Exemplo n.º 3
0
        private void DA_OnPlayerDeath(RocketPlayer player, SDG.Unturned.EDeathCause cause, SDG.Unturned.ELimb limb, Steamworks.CSteamID murderer)
        {
            if (!this.Loaded || !this.Configuration.Enabled)
            {
                return;
            }

            //TODO need proper steamid conversion, this is ugly
            if (murderer.ToString() == "90071992547409920")
            {
                murderer = (Steamworks.CSteamID) 0;
            }
            if (murderer == null)
            {
                murderer = (Steamworks.CSteamID) 0;
            }

            string Killer = string.Empty;

            if (murderer.ToString().Length > 1)
            {
                Killer = RocketPlayer.FromCSteamID(murderer)?.CharacterName;
            }

            string Message = "";

            if (String.IsNullOrEmpty(Killer) && !String.IsNullOrEmpty(CauseLookup[cause].AltMessage))
            {
                Message = CauseLookup[cause].AltMessage.Replace(@"%P", player.CharacterName);
            }
            else
            {
                Message = CauseLookup[cause].Message.Replace(@"%K", Killer);
                Message = Message.Replace(@"%P", player.CharacterName);
            }

            Say(Message, CauseLookup[cause].Color);
        }
        // Fixed Update

        public void FixedUpdate()
        {
            if (this.Loaded && players != null && players.Count != 0)
            {
                foreach (KeyValuePair <string, Sentence> pl in players)
                {
                    if (pl.Value.End <= DateTime.Now)
                    {
                        try
                        {
                            removePlayer(null, pl.Key);
                            break;
                        }
                        catch { }
                    }


                    try
                    {
                        RocketPlayer player = RocketPlayer.FromCSteamID(new CSteamID(Convert.ToUInt64(pl.Key)));

                        if (player != null && Vector3.Distance(player.Position, pl.Value.Cell.Location) > Configuration.WalkDistance)
                        {
                            if (Configuration.KillInsteadOfTeleport)
                            {
                                player.Damage(255, player.Position, EDeathCause.PUNCH, ELimb.SKULL, player.CSteamID);
                            }
                            else
                            {
                                player.Teleport(pl.Value.Cell.Location, player.Rotation);
                            }
                        }
                    }
                    catch  { }
                }
            }
        }
Exemplo n.º 5
0
 public RocketPlayer GetRocketPlayer()
 {
     return(RocketPlayer.FromCSteamID(new CSteamID(Convert.ToUInt64(this.SteamID64))));
 }