コード例 #1
0
ファイル: Zones.cs プロジェクト: pharrisee/7dtd-ServerTools
 public static void ProcessCommand(ClientInfo _cInfo, string _command)
 {
     try
     {
         if (_command.Contains("^"))
         {
             List <string> _commands = _command.Split('^').ToList();
             for (int i = 0; i < _commands.Count; i++)
             {
                 string _commandTrimmed = _commands[i].Trim();
                 if (_commandTrimmed.StartsWith("{Delay}"))
                 {
                     string[] _commandSplit = _commandTrimmed.Split(' ');
                     if (int.TryParse(_commandSplit[1], out int _time))
                     {
                         _commands.RemoveRange(0, i + 1);
                         Timers.Zone_SingleUseTimer(_time, _cInfo.CrossplatformId.CombinedString, _commands);
                         return;
                     }
                     else
                     {
                         Log.Out(string.Format("[SERVERTOOLS] Zone command error. Unable to commit delay with improper integer: {0}", _command));
                     }
                 }
                 else
                 {
                     Command(_cInfo, _commandTrimmed);
                 }
             }
         }
         else
         {
             Command(_cInfo, _command);
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in Zones.ProcessCommand: {0}", e.Message));
     }
 }
コード例 #2
0
ファイル: Zones.cs プロジェクト: pharrisee/7dtd-ServerTools
 public static void ZoneCommandDelayed(string _playerId, List <string> _commands)
 {
     try
     {
         ClientInfo cInfo = PersistentOperations.GetClientInfoFromNameOrId(_playerId);
         if (cInfo != null)
         {
             for (int i = 0; i < _commands.Count; i++)
             {
                 string _commandTrimmed = _commands[i].Trim();
                 if (_commandTrimmed.StartsWith("{Delay}"))
                 {
                     string[] _commandSplit = _commandTrimmed.Split(' ');
                     if (int.TryParse(_commandSplit[1], out int _time))
                     {
                         _commands.RemoveRange(0, i + 1);
                         Timers.Zone_SingleUseTimer(_time, cInfo.CrossplatformId.CombinedString, _commands);
                         return;
                     }
                     else
                     {
                         Log.Out(string.Format("[SERVERTOOLS] Zone command error. Unable to commit delay with improper integer: {0}", _commands));
                     }
                 }
                 else
                 {
                     Command(cInfo, _commandTrimmed);
                 }
             }
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in Zones.ZoneCommandDelayed: {0}", e.Message));
     }
 }