public static void DelayedCommand(string _playerId, string _commands) { try { ClientInfo _cInfo = ConnectionManager.Instance.Clients.ForPlayerId(_playerId); if (_cInfo != null) { string[] _commandsSplit = _commands.Split('^'); for (int i = 0; i < _commandsSplit.Length; i++) { string _commandTrimmed = _commandsSplit[i].Trim(); if (_commandTrimmed.StartsWith("{Delay}")) { if (i < _commandsSplit.Length) { string _commandsRebuilt = ""; for (int j = i + 1; j < _commandsSplit.Length; j++) { string _delayedCommandTrimmed = _commandsSplit[j].Trim(); if (j == i + 1) { _commandsRebuilt = _delayedCommandTrimmed; } else { _commandsRebuilt = _commandsRebuilt + " ^ " + _delayedCommandTrimmed; } } string _timeString = _commandTrimmed.Split(' ').Skip(1).First(); int _time = 5; int.TryParse(_timeString, out _time); Timers.SingleUseTimer(_time, _cInfo.playerId, _commandsRebuilt); } return; } else { CommandExec(_cInfo, _commandTrimmed); } } } } catch (Exception e) { Log.Out(string.Format("[SERVERTOOLS] Error in CustomCommand.DelayedCommand: {0}.", e)); } }
public static void CommandDelay(ClientInfo _cInfo, string _message, int[] _c1) { try { if (_c1[0] < 21 && _c1[1] > 0) { if (_c1[0] == 1) { PersistentContainer.Instance.Players[_cInfo.playerId].CustomCommand1 = DateTime.Now; } else if (_c1[0] == 2) { PersistentContainer.Instance.Players[_cInfo.playerId].CustomCommand2 = DateTime.Now; } else if (_c1[0] == 3) { PersistentContainer.Instance.Players[_cInfo.playerId].CustomCommand3 = DateTime.Now; } else if (_c1[0] == 4) { PersistentContainer.Instance.Players[_cInfo.playerId].CustomCommand4 = DateTime.Now; } else if (_c1[0] == 5) { PersistentContainer.Instance.Players[_cInfo.playerId].CustomCommand5 = DateTime.Now; } else if (_c1[0] == 6) { PersistentContainer.Instance.Players[_cInfo.playerId].CustomCommand6 = DateTime.Now; } else if (_c1[0] == 7) { PersistentContainer.Instance.Players[_cInfo.playerId].CustomCommand7 = DateTime.Now; } else if (_c1[0] == 8) { PersistentContainer.Instance.Players[_cInfo.playerId].CustomCommand8 = DateTime.Now; } else if (_c1[0] == 9) { PersistentContainer.Instance.Players[_cInfo.playerId].CustomCommand9 = DateTime.Now; } else if (_c1[0] == 10) { PersistentContainer.Instance.Players[_cInfo.playerId].CustomCommand10 = DateTime.Now; } else if (_c1[0] == 11) { PersistentContainer.Instance.Players[_cInfo.playerId].CustomCommand11 = DateTime.Now; } else if (_c1[0] == 12) { PersistentContainer.Instance.Players[_cInfo.playerId].CustomCommand12 = DateTime.Now; } else if (_c1[0] == 13) { PersistentContainer.Instance.Players[_cInfo.playerId].CustomCommand13 = DateTime.Now; } else if (_c1[0] == 14) { PersistentContainer.Instance.Players[_cInfo.playerId].CustomCommand14 = DateTime.Now; } else if (_c1[0] == 15) { PersistentContainer.Instance.Players[_cInfo.playerId].CustomCommand15 = DateTime.Now; } else if (_c1[0] == 16) { PersistentContainer.Instance.Players[_cInfo.playerId].CustomCommand16 = DateTime.Now; } else if (_c1[0] == 17) { PersistentContainer.Instance.Players[_cInfo.playerId].CustomCommand17 = DateTime.Now; } else if (_c1[0] == 18) { PersistentContainer.Instance.Players[_cInfo.playerId].CustomCommand18 = DateTime.Now; } else if (_c1[0] == 19) { PersistentContainer.Instance.Players[_cInfo.playerId].CustomCommand19 = DateTime.Now; } else if (_c1[0] == 20) { PersistentContainer.Instance.Players[_cInfo.playerId].CustomCommand20 = DateTime.Now; } PersistentContainer.Instance.Save(); } string[] _r; if (Dict.TryGetValue(_message, out _r)) { string[] _commandsSplit = _r[0].Split('^'); for (int i = 0; i < _commandsSplit.Length; i++) { string _commandTrimmed = _commandsSplit[i].Trim(); if (_commandTrimmed.StartsWith("{Delay}")) { if (i < _commandsSplit.Length) { string _commandsRebuilt = ""; for (int j = i; j < _commandsSplit.Length; j++) { string _delayedCommandTrimmed = _commandsSplit[j].Trim(); if (j == i + 1) { _commandsRebuilt = _delayedCommandTrimmed; } else { _commandsRebuilt = _commandsRebuilt + " ^ " + _delayedCommandTrimmed; } } string _timeString = _commandTrimmed.Split(' ').Skip(1).First(); int _time = 5; int.TryParse(_timeString, out _time); Timers.SingleUseTimer(_time, _cInfo.playerId, _commandsRebuilt); } return; } else { CommandExec(_cInfo, _commandTrimmed); } } } } catch (Exception e) { Log.Out(string.Format("[SERVERTOOLS] Error in CustomCommand.CommandDelay: {0}.", e)); } }