示例#1
0
 /// <summary>
 /// Returns a players <seealso cref="CICommanderClass"/>, if present. Returns <seealso cref="false"/>, and a null commander class if none exist.
 /// </summary>
 /// <param name="ply">The player to get the <seealso cref="CICommanderClass"></seealso>.</param>
 /// <param name="Commander">The <seealso cref="CICommanderClass"/> instance of the player.</param>
 public bool Get(Player ply, out CICommanderClass Commander)
 {
     Commander = null;
     if (!ChaosCommanders.TryGetValue(ply.UserId, out Commander))
     {
         return(false);
     }
     return(true);
 }
示例#2
0
        /// <summary>
        /// Makes a player into a CICommander and returns the CICommander Class.
        /// </summary>
        /// <param name="ply"></param>
        public void MakeCICommander(Player ply, out CICommanderClass comm)
        {
            CICommanderClass com = new CICommanderClass()
            {
                Id = ply.Id
            };

            ply.SetRole(RoleType.ChaosInsurgency, false, false);
            ply.ReferenceHub.nicknameSync.Network_customPlayerInfoString = Plugin.Config.ChaosCommanderPrefix;
            if (!ChaosCommanders.ContainsKey(ply.UserId))
            {
                ChaosCommanders.Add(ply.UserId, com);
            }
            ply.Broadcast(Plugin.Config.ChaosCommanderBroadcastTime, Plugin.Config.ChaosCommanderBroadcast);
            comm = com;
        }
示例#3
0
 /// <summary>
 /// Removes a player from CICommanders.
 /// </summary>
 /// <param name="comm">The player to remove from CICommanders.</param>
 public void RemoveCICommander(CICommanderClass comm)
 {
     comm.Player().ReferenceHub.nicknameSync.Network_customPlayerInfoString = "";
     ChaosCommanders.Remove(comm.Player().UserId);
 }