private static bool Checks(ClientInfo _cInfo) { EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId]; if (_player != null) { Vector3 _position = _player.GetPosition(); int x = (int)_position.x; int y = (int)_position.y; int z = (int)_position.z; Vector3i _vec3i = new Vector3i(x, y, z); if (Teleportation.VehicleCheck(_cInfo)) { return(false); } if (PvP_Check) { if (Teleportation.PCheck(_cInfo, _player)) { return(false); } } if (Zombie_Check) { if (Teleportation.ZCheck(_cInfo, _player)) { return(false); } } } return(true); }
public static void Checks(ClientInfo _cInfo, string _message) { EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId]; if (PvP_Check) { if (Teleportation.PCheck(_cInfo, _player)) { return; } } if (Zombie_Check) { if (Teleportation.ZCheck(_cInfo, _player)) { return; } } ClientInfo _friend = ConsoleHelper.ParseParamIdOrName(_message); if (_friend != null) { EntityPlayer _friendPlayer = GameManager.Instance.World.Players.dict[_friend.entityId]; if (_player.IsFriendsWith(_friendPlayer)) { DateTime _lastFriendTele = DateTime.Now; if (PersistentContainer.Instance.Players[_cInfo.playerId].LastFriendTele != null) { _lastFriendTele = PersistentContainer.Instance.Players[_cInfo.playerId].LastFriendTele; } TimeSpan varTime = DateTime.Now - _lastFriendTele; double fractionalMinutes = varTime.TotalMinutes; int _timepassed = (int)fractionalMinutes; if (ReservedSlots.IsEnabled && ReservedSlots.Reduced_Delay) { if (ReservedSlots.Dict.ContainsKey(_cInfo.playerId)) { DateTime _dt; ReservedSlots.Dict.TryGetValue(_cInfo.playerId, out _dt); if (DateTime.Now < _dt) { int _delay = Delay_Between_Uses / 2; Time(_cInfo, _message, _timepassed, _delay); return; } } } Time(_cInfo, _message, _timepassed, Delay_Between_Uses); } else { string _phrase633; if (!Phrases.Dict.TryGetValue(633, out _phrase633)) { _phrase633 = "This player is not your friend. You can not request teleport to them."; } ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase633 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } } }
private static void Checks(ClientInfo _cInfo, string _waypoint) { World world = GameManager.Instance.World; EntityPlayer _player = PersistentOperations.GetEntityPlayer(_cInfo.playerId); if (_player != null) { if (Vehicle) { Entity _attachedEntity = _player.AttachedToEntity; if (_attachedEntity != null) { string _phrase587; if (!Phrases.Dict.TryGetValue(587, out _phrase587)) { _phrase587 = " you can not teleport to a waypoint with a vehicle."; ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase587 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } return; } } if (PvP_Check) { if (Teleportation.PCheck(_cInfo, _player)) { return; } } if (Zombie_Check) { if (Teleportation.ZCheck(_cInfo, _player)) { return; } } } Vector3 _position = _player.GetPosition(); int x = (int)_position.x; int y = (int)_position.y; int z = (int)_position.z; Vector3i _vec3i = new Vector3i(x, y, z); if (PersistentOperations.ClaimedByNone(_cInfo.playerId, _vec3i)) { CommandCost(_cInfo, _waypoint); } else { string _phrase576; if (!Phrases.Dict.TryGetValue(576, out _phrase576)) { _phrase576 = " you can only use a waypoint that is outside of a claimed space."; } ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase576 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } }
private static void FExec(ClientInfo _cInfo, string _waypoint, EntityPlayer _player) { string _sql = string.Format("SELECT position FROM Waypoints WHERE steamid = '{0}' AND wayPointName = '{1}'", _cInfo.playerId, _waypoint); DataTable _result = SQL.TQuery(_sql); string _position = _result.Rows[0].ItemArray.GetValue(0).ToString(); if (_result.Rows.Count > 0) { if (PvP_Check) { if (Teleportation.PCheck(_cInfo, _player)) { return; } } if (Zombie_Check) { if (Teleportation.ZCheck(_cInfo, _player)) { return; } } FriendInvite(_cInfo, _player.position, _position); int x, y, z; string[] _cordsplit = _position.Split(','); int.TryParse(_cordsplit[0], out x); int.TryParse(_cordsplit[1], out y); int.TryParse(_cordsplit[2], out z); Players.NoFlight.Add(_cInfo.entityId); _cInfo.SendPackage(new NetPackageTeleportPlayer(new Vector3(x, y, z), null, false)); Wallet.SubtractCoinsFromWallet(_cInfo.playerId, Command_Cost); _sql = string.Format("UPDATE Players SET lastWaypoint = '{0}' WHERE steamid = '{1}'", DateTime.Now, _cInfo.playerId); SQL.FastQuery(_sql); string _phrase577; if (!Phrases.Dict.TryGetValue(577, out _phrase577)) { _phrase577 = " traveling to waypoint {Waypoint}."; } _phrase577 = _phrase577.Replace("{Waypoint}", _waypoint); ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase577 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } else { string _phrase578; if (!Phrases.Dict.TryGetValue(578, out _phrase578)) { _phrase578 = " you have not saved this waypoint."; } ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase578 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } _result.Dispose(); }
private static void Checks(ClientInfo _cInfo, string _waypoint, bool _friends) { EntityPlayer _player = PersistentOperations.GetEntityPlayer(_cInfo.playerId); if (_player != null) { if (Vehicle) { Entity _attachedEntity = _player.AttachedToEntity; if (_attachedEntity != null) { Phrases.Dict.TryGetValue(281, out string _phrase281); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase281 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); return; } } if (PvP_Check) { if (Teleportation.PCheck(_cInfo, _player)) { return; } } if (Zombie_Check) { if (Teleportation.ZCheck(_cInfo, _player)) { return; } } Vector3 _position = _player.GetPosition(); int _x = (int)_position.x; int _y = (int)_position.y; int _z = (int)_position.z; Vector3i _vec3i = new Vector3i(_x, _y, _z); // BPPR: allow player to teleport regardless of where they are //if (PersistentOperations.ClaimedByNone(_cInfo.playerId, _vec3i)) //{ CommandCost(_cInfo, _waypoint, _position, _friends); //} //else //{ // Phrases.Dict.TryGetValue(272, out string _phrase272); // ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase272 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); //} } }
private static void FChecks(ClientInfo _cInfo, string _waypoint) { World world = GameManager.Instance.World; EntityPlayer _player = world.Players.dict[_cInfo.entityId]; if (PvP_Check) { if (Teleportation.PCheck(_cInfo, _player)) { return; } } if (Zombie_Check) { if (Teleportation.ZCheck(_cInfo, _player)) { return; } } Vector3 _position = _player.GetPosition(); int x = (int)_position.x; int y = (int)_position.y; int z = (int)_position.z; Vector3i _vec3i = new Vector3i(x, y, z); if (PersistentOperations.ClaimedByNone(_cInfo.playerId, _vec3i)) { FCommandCost(_cInfo, _waypoint, _position); } else { string _phrase576; if (!Phrases.Dict.TryGetValue(576, out _phrase576)) { _phrase576 = " you can only use a waypoint that is outside of a claimed space."; } ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase576 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } }
private static void Checks(ClientInfo _cInfo, string _homeName, bool _friends) { try { EntityPlayer _player = PersistentOperations.GetEntityPlayer(_cInfo.playerId); if (_player != null) { if (Vehicle_Check) { Entity _attachedEntity = _player.AttachedToEntity; if (_attachedEntity != null) { Phrases.Dict.TryGetValue(853, out string _phrase853); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase853 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); return; } } if (PvP_Check) { if (Teleportation.PCheck(_cInfo, _player)) { return; } } if (Zombie_Check) { if (Teleportation.ZCheck(_cInfo, _player)) { return; } } CommandCost(_cInfo, _homeName, _player.GetPosition(), _friends); } } catch (Exception e) { Log.Out(string.Format("[SERVERTOOLS] Error in Homes.Checks: {0}", e.Message)); } }
private static void Checks(ClientInfo _cInfo, string _waypoint, bool _friends) { EntityPlayer _player = PersistentOperations.GetEntityPlayer(_cInfo.playerId); if (_player != null) { if (Vehicle) { Entity _attachedEntity = _player.AttachedToEntity; if (_attachedEntity != null) { Phrases.Dict.TryGetValue(853, out string _phrase853); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase853 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); return; } } if (Player_Check) { if (Teleportation.PCheck(_cInfo, _player)) { return; } } if (Zombie_Check) { if (Teleportation.ZCheck(_cInfo, _player)) { return; } } Vector3 _position = _player.GetPosition(); int _x = (int)_position.x; int _y = (int)_position.y; int _z = (int)_position.z; Vector3i _vec3i = new Vector3i(_x, _y, _z); CommandCost(_cInfo, _waypoint, _position, _friends); } }
public static void Tele(ClientInfo _cInfo) { if (GameManager.Instance.World.Players.dict.ContainsKey(_cInfo.entityId)) { EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId]; if (_player != null) { if (Box.Count > 0) { int _playerX = (int)_player.position.x; int _playerY = (int)_player.position.y; int _playerZ = (int)_player.position.z; int xMin, yMin, zMin, xMax, yMax, zMax, xDest, yDest, zDest; string[] _xyzCorner1 = { }, _xyzCorner2 = { }, _xyzDestCords = { }; foreach (KeyValuePair <string, string[]> kvpCorners in Box) { _xyzCorner1 = kvpCorners.Value[0].Split(','); int.TryParse(_xyzCorner1[0], out xMin); int.TryParse(_xyzCorner1[1], out yMin); int.TryParse(_xyzCorner1[2], out zMin); _xyzCorner2 = kvpCorners.Value[1].Split(','); int.TryParse(_xyzCorner2[0], out xMax); int.TryParse(_xyzCorner2[1], out yMax); int.TryParse(_xyzCorner2[2], out zMax); _xyzDestCords = kvpCorners.Value[2].Split(','); int.TryParse(_xyzDestCords[0], out xDest); int.TryParse(_xyzDestCords[1], out yDest); int.TryParse(_xyzDestCords[2], out zDest); if (xMin >= 0 & xMax >= 0) { if (xMin < xMax) { if (_playerX >= xMin) { _xMinCheck = 1; } else { _xMinCheck = 0; } if (_playerX <= xMax) { _xMaxCheck = 1; } else { _xMaxCheck = 0; } } else { if (_playerX <= xMin) { _xMinCheck = 1; } else { _xMinCheck = 0; } if (_playerX >= xMax) { _xMaxCheck = 1; } else { _xMaxCheck = 0; } } } else if (xMin <= 0 & xMax <= 0) { if (xMin < xMax) { if (_playerX >= xMin) { _xMinCheck = 1; } else { _xMinCheck = 0; } if (_playerX <= xMax) { _xMaxCheck = 1; } else { _xMaxCheck = 0; } } else { if (_playerX <= xMin) { _xMinCheck = 1; } else { _xMinCheck = 0; } if (_playerX >= xMax) { _xMaxCheck = 1; } else { _xMaxCheck = 0; } } } else if (xMin <= 0 & xMax >= 0) { if (_playerX >= xMin) { _xMinCheck = 1; } else { _xMinCheck = 0; } if (_playerX <= xMax) { _xMaxCheck = 1; } else { _xMaxCheck = 0; } } else if (xMin >= 0 & xMax <= 0) { if (_playerX <= xMin) { _xMinCheck = 1; } else { _xMinCheck = 0; } if (_playerX >= xMax) { _xMaxCheck = 1; } else { _xMaxCheck = 0; } } if (yMin >= 0 & yMax >= 0) { if (yMin < yMax) { if (_playerY >= yMin) { _yMinCheck = 1; } else { _yMinCheck = 0; } if (_playerY <= yMax) { _yMaxCheck = 1; } else { _yMaxCheck = 0; } } else { if (_playerY <= yMin) { _yMinCheck = 1; } else { _yMinCheck = 0; } if (_playerY >= yMax) { _yMaxCheck = 1; } else { _yMaxCheck = 0; } } } else if (yMin <= 0 & yMax <= 0) { if (yMin < yMax) { if (_playerY >= yMin) { _yMinCheck = 1; } else { _yMinCheck = 0; } if (_playerY <= yMax) { _yMaxCheck = 1; } else { _yMaxCheck = 0; } } else { if (_playerY <= yMin) { _yMinCheck = 1; } else { _yMinCheck = 0; } if (_playerY >= yMax) { _yMaxCheck = 1; } else { _yMaxCheck = 0; } } } else if (yMin <= 0 & yMax >= 0) { if (_playerY >= yMin) { _yMinCheck = 1; } else { _yMinCheck = 0; } if (_playerY <= yMax) { _yMaxCheck = 1; } else { _yMaxCheck = 0; } } else if (yMin >= 0 & yMax <= 0) { if (_playerY <= yMin) { _yMinCheck = 1; } else { _yMinCheck = 0; } if (_playerY >= yMax) { _yMaxCheck = 1; } else { _yMaxCheck = 0; } } if (zMin >= 0 & zMax >= 0) { if (zMin < zMax) { if (_playerZ >= zMin) { _zMinCheck = 1; } else { _zMinCheck = 0; } if (_playerZ <= zMax) { _zMaxCheck = 1; } else { _zMaxCheck = 0; } } else { if (_playerZ <= zMin) { _zMinCheck = 1; } else { _zMinCheck = 0; } if (_playerZ >= zMax) { _zMaxCheck = 1; } else { _zMaxCheck = 0; } } } else if (zMin <= 0 & zMax <= 0) { if (zMin < zMax) { if (_playerZ >= zMin) { _zMinCheck = 1; } else { _zMinCheck = 0; } if (_playerZ <= zMax) { _zMaxCheck = 1; } else { _zMaxCheck = 0; } } else { if (_playerZ <= zMin) { _zMinCheck = 1; } else { _zMinCheck = 0; } if (_playerZ >= zMax) { _zMaxCheck = 1; } else { _zMaxCheck = 0; } } } else if (zMin <= 0 & zMax >= 0) { if (_playerZ >= zMin) { _zMinCheck = 1; } else { _zMinCheck = 0; } if (_playerZ <= zMax) { _zMaxCheck = 1; } else { _zMaxCheck = 0; } } else if (zMin >= 0 & zMax <= 0) { if (_playerY <= zMin) { _zMinCheck = 1; } else { _zMinCheck = 0; } if (_playerY >= zMax) { _zMaxCheck = 1; } else { _zMaxCheck = 0; } } if (_xMinCheck == 1 & _yMinCheck == 1 & _zMinCheck == 1 & _xMaxCheck == 1 & _yMaxCheck == 1 & _zMaxCheck == 1) { if (PvP_Check) { if (Teleportation.PCheck(_cInfo, _player)) { return; } } if (Zombie_Check) { if (Teleportation.ZCheck(_cInfo, _player)) { return; } } _cInfo.SendPackage(NetPackageManager.GetPackage <NetPackageTeleportPlayer>().Setup(new Vector3(xDest, yDest, zDest), null, false)); if (Wallet.IsEnabled && Command_Cost >= 1) { Wallet.SubtractCoinsFromWallet(_cInfo.playerId, Command_Cost); } PersistentContainer.Instance.Players[_cInfo.playerId].LastTravel = DateTime.Now; Phrases.Dict.TryGetValue(311, out string _phrase311); _phrase311 = _phrase311.Replace("{Destination}", kvpCorners.Key); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase311 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); return; } } Phrases.Dict.TryGetValue(312, out string _phrase312); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase312 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); return; } } } }
public static void MessageFriend(ClientInfo _cInfo, string _message) { EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId]; if (PvP_Check) { if (Teleportation.PCheck(_cInfo, _player)) { return; } } if (Zombie_Check) { if (Teleportation.ZCheck(_cInfo, _player)) { return; } } int _Id; if (!int.TryParse(_message, out _Id)) { string _phrase626; if (!Phrases.Dict.TryGetValue(626, out _phrase626)) { _phrase626 = "this {EntityId} is not valid. Only integers accepted."; } _phrase626 = _phrase626.Replace("{EntityId}", _Id.ToString()); ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase626 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null); return; } ClientInfo _cInfo3 = ConnectionManager.Instance.Clients.ForEntityId(_Id); if (_cInfo3 != null) { string _phrase627; if (!Phrases.Dict.TryGetValue(627, out _phrase627)) { _phrase627 = "sent your friend {PlayerName} a teleport request."; } _phrase627 = _phrase627.Replace("{PlayerName}", _cInfo3.playerName); ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase627 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null); string _phrase628; if (!Phrases.Dict.TryGetValue(628, out _phrase628)) { _phrase628 = "would like to teleport to you. Type /accept in chat to accept the request."; } _phrase628 = _phrase628.Replace("{PlayerName}", _cInfo.playerName); ChatHook.ChatMessage(_cInfo3, LoadConfig.Chat_Response_Color + _cInfo3.playerName + _phrase628 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null); if (Dict.ContainsKey(_cInfo3.entityId)) { Dict.Remove(_cInfo3.entityId); Dict1.Remove(_cInfo3.entityId); Dict.Add(_cInfo3.entityId, _cInfo.entityId); Dict1.Add(_cInfo3.entityId, DateTime.Now); } else { Dict.Add(_cInfo3.entityId, _cInfo.entityId); Dict1.Add(_cInfo3.entityId, DateTime.Now); } } else { string _phrase629; if (!Phrases.Dict.TryGetValue(629, out _phrase629)) { _phrase629 = "did not find EntityId {EntityId}. No teleport request sent."; } _phrase629 = _phrase629.Replace("{EntityId}", _Id.ToString()); ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase629 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } }
public static void Exec(ClientInfo _cInfo, string _playerName) { if (SetLobby.Lobby_Position != "0,0,0" || SetLobby.Lobby_Position != "0 0 0" || SetLobby.Lobby_Position != "") { int x, y, z; string _sql; if (Return) { EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId]; Vector3 _position = _player.GetPosition(); x = (int)_position.x; y = (int)_position.y; z = (int)_position.z; if (PvP_Check) { if (Teleportation.PCheck(_cInfo, _player)) { return; } } if (Zombie_Check) { if (Teleportation.ZCheck(_cInfo, _player)) { return; } } string _pposition = x + "," + y + "," + z; LobbyPlayers.Add(_cInfo.entityId); _sql = string.Format("UPDATE Players SET lobbyReturn = '{0}' WHERE steamid = '{1}'", _pposition, _cInfo.playerId); SQL.FastQuery(_sql); string _phrase552; if (!Phrases.Dict.TryGetValue(552, out _phrase552)) { _phrase552 = "you can go back by typing /lobbyback when you are ready to leave the lobby."; } ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase552 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } string[] _cords = SetLobby.Lobby_Position.Split(','); int.TryParse(_cords[0], out x); int.TryParse(_cords[1], out y); int.TryParse(_cords[2], out z); Players.NoFlight.Add(_cInfo.entityId); _cInfo.SendPackage(new NetPackageTeleportPlayer(new Vector3(x, y, z), null, false)); string _phrase553; if (!Phrases.Dict.TryGetValue(553, out _phrase553)) { _phrase553 = "sending you to the lobby."; } ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase553 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null); if (Wallet.IsEnabled && Command_Cost >= 1) { Wallet.SubtractCoinsFromWallet(_cInfo.playerId, Command_Cost); } _sql = string.Format("UPDATE Players SET lastLobby = '{0}' WHERE steamid = '{1}'", DateTime.Now, _cInfo.playerId); SQL.FastQuery(_sql); } else { string _phrase554; if (!Phrases.Dict.TryGetValue(554, out _phrase554)) { _phrase554 = "the lobby position is not set."; } ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase554 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } }
private static void Checks(ClientInfo _cInfo, string _waypoint, bool _friends) { try { EntityPlayer player = PersistentOperations.GetEntityPlayer(_cInfo.entityId); if (player != null) { if (Vehicle) { Entity attachedEntity = player.AttachedToEntity; if (attachedEntity != null && attachedEntity is EntityVehicle) { Phrases.Dict.TryGetValue("Teleport3", out string phrase); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); return; } } if (Player_Check) { if (Teleportation.PCheck(_cInfo, player)) { return; } } if (Zombie_Check) { if (Teleportation.ZCheck(_cInfo, player)) { return; } } if (No_POI) { if (GameManager.Instance.World.IsPositionWithinPOI(player.position, 3)) { Phrases.Dict.TryGetValue("Waypoints6", out string phrase); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); return; } } Vector3 position = player.GetPosition(); int x = (int)position.x; int y = (int)position.y; int z = (int)position.z; Vector3i vec3i = new Vector3i(x, y, z); if (PersistentContainer.Instance.Players[_cInfo.CrossplatformId.CombinedString].Waypoints != null && PersistentContainer.Instance.Players[_cInfo.CrossplatformId.CombinedString].Waypoints.ContainsKey(_waypoint)) { CommandCost(_cInfo, _waypoint, position, _friends, Command_Cost); } else if (Dict.ContainsKey(_waypoint)) { Dict.TryGetValue(_waypoint, out string[] waypointData); int.TryParse(waypointData[1], out int cost); CommandCost(_cInfo, _waypoint, position, _friends, cost); } } } catch (Exception e) { Log.Out(string.Format("[SERVERTOOLS] Error in Waypoints.Checks: {0}", e.Message)); } }
public static void Tele(ClientInfo _cInfo, bool _announce) { EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId]; Flag.Clear(); int _playerX = (int)_player.position.x; int _playerY = (int)_player.position.y; int _playerZ = (int)_player.position.z; if (Box.Count > 0) { foreach (KeyValuePair <string, string[]> kvpCorners in Box) { string[] _xyzCorner1 = { }; if (kvpCorners.Value[0].Contains(",")) { _xyzCorner1 = kvpCorners.Value[0].Split(','); } else { _xyzCorner1 = kvpCorners.Value[0].Split(' '); } int xMin, yMin, zMin; int.TryParse(_xyzCorner1[0], out xMin); int.TryParse(_xyzCorner1[1], out yMin); int.TryParse(_xyzCorner1[2], out zMin); string[] _xyzCorner2 = { }; if (kvpCorners.Value[1].Contains(",")) { _xyzCorner2 = kvpCorners.Value[1].Split(','); } else { _xyzCorner2 = kvpCorners.Value[1].Split(' '); } int xMax, yMax, zMax; int.TryParse(_xyzCorner2[0], out xMax); int.TryParse(_xyzCorner2[1], out yMax); int.TryParse(_xyzCorner2[2], out zMax); string[] _xyzDestCords = { }; if (kvpCorners.Value[2].Contains(",")) { _xyzDestCords = kvpCorners.Value[2].Split(','); } else { _xyzDestCords = kvpCorners.Value[2].Split(' '); } int xDest, yDest, zDest; int.TryParse(_xyzDestCords[0], out xDest); int.TryParse(_xyzDestCords[1], out yDest); int.TryParse(_xyzDestCords[2], out zDest); if (xMin >= 0 & xMax >= 0) { if (xMin < xMax) { if (_playerX >= xMin) { _xMinCheck = 1; } else { _xMinCheck = 0; } if (_playerX <= xMax) { _xMaxCheck = 1; } else { _xMaxCheck = 0; } } else { if (_playerX <= xMin) { _xMinCheck = 1; } else { _xMinCheck = 0; } if (_playerX >= xMax) { _xMaxCheck = 1; } else { _xMaxCheck = 0; } } } else if (xMin <= 0 & xMax <= 0) { if (xMin < xMax) { if (_playerX >= xMin) { _xMinCheck = 1; } else { _xMinCheck = 0; } if (_playerX <= xMax) { _xMaxCheck = 1; } else { _xMaxCheck = 0; } } else { if (_playerX <= xMin) { _xMinCheck = 1; } else { _xMinCheck = 0; } if (_playerX >= xMax) { _xMaxCheck = 1; } else { _xMaxCheck = 0; } } } else if (xMin <= 0 & xMax >= 0) { if (_playerX >= xMin) { _xMinCheck = 1; } else { _xMinCheck = 0; } if (_playerX <= xMax) { _xMaxCheck = 1; } else { _xMaxCheck = 0; } } else if (xMin >= 0 & xMax <= 0) { if (_playerX <= xMin) { _xMinCheck = 1; } else { _xMinCheck = 0; } if (_playerX >= xMax) { _xMaxCheck = 1; } else { _xMaxCheck = 0; } } if (yMin >= 0 & yMax >= 0) { if (yMin < yMax) { if (_playerY >= yMin) { _yMinCheck = 1; } else { _yMinCheck = 0; } if (_playerY <= yMax) { _yMaxCheck = 1; } else { _yMaxCheck = 0; } } else { if (_playerY <= yMin) { _yMinCheck = 1; } else { _yMinCheck = 0; } if (_playerY >= yMax) { _yMaxCheck = 1; } else { _yMaxCheck = 0; } } } else if (yMin <= 0 & yMax <= 0) { if (yMin < yMax) { if (_playerY >= yMin) { _yMinCheck = 1; } else { _yMinCheck = 0; } if (_playerY <= yMax) { _yMaxCheck = 1; } else { _yMaxCheck = 0; } } else { if (_playerY <= yMin) { _yMinCheck = 1; } else { _yMinCheck = 0; } if (_playerY >= yMax) { _yMaxCheck = 1; } else { _yMaxCheck = 0; } } } else if (yMin <= 0 & yMax >= 0) { if (_playerY >= yMin) { _yMinCheck = 1; } else { _yMinCheck = 0; } if (_playerY <= yMax) { _yMaxCheck = 1; } else { _yMaxCheck = 0; } } else if (yMin >= 0 & yMax <= 0) { if (_playerY <= yMin) { _yMinCheck = 1; } else { _yMinCheck = 0; } if (_playerY >= yMax) { _yMaxCheck = 1; } else { _yMaxCheck = 0; } } if (zMin >= 0 & zMax >= 0) { if (zMin < zMax) { if (_playerZ >= zMin) { _zMinCheck = 1; } else { _zMinCheck = 0; } if (_playerZ <= zMax) { _zMaxCheck = 1; } else { _zMaxCheck = 0; } } else { if (_playerZ <= zMin) { _zMinCheck = 1; } else { _zMinCheck = 0; } if (_playerZ >= zMax) { _zMaxCheck = 1; } else { _zMaxCheck = 0; } } } else if (zMin <= 0 & zMax <= 0) { if (zMin < zMax) { if (_playerZ >= zMin) { _zMinCheck = 1; } else { _zMinCheck = 0; } if (_playerZ <= zMax) { _zMaxCheck = 1; } else { _zMaxCheck = 0; } } else { if (_playerZ <= zMin) { _zMinCheck = 1; } else { _zMinCheck = 0; } if (_playerZ >= zMax) { _zMaxCheck = 1; } else { _zMaxCheck = 0; } } } else if (zMin <= 0 & zMax >= 0) { if (_playerZ >= zMin) { _zMinCheck = 1; } else { _zMinCheck = 0; } if (_playerZ <= zMax) { _zMaxCheck = 1; } else { _zMaxCheck = 0; } } else if (zMin >= 0 & zMax <= 0) { if (_playerY <= zMin) { _zMinCheck = 1; } else { _zMinCheck = 0; } if (_playerY >= zMax) { _zMaxCheck = 1; } else { _zMaxCheck = 0; } } if (_xMinCheck == 1 & _yMinCheck == 1 & _zMinCheck == 1 & _xMaxCheck == 1 & _yMaxCheck == 1 & _zMaxCheck == 1) { if (PvP_Check) { if (Teleportation.PCheck(_cInfo, _player)) { return; } } if (Zombie_Check) { if (Teleportation.ZCheck(_cInfo, _player)) { return; } } Players.NoFlight.Add(_cInfo.entityId); _cInfo.SendPackage(new NetPackageTeleportPlayer(new Vector3(xDest, yDest, zDest), null, false)); string _sql; if (Wallet.IsEnabled && Command_Cost >= 1) { Wallet.SubtractCoinsFromWallet(_cInfo.playerId, Command_Cost); } _sql = string.Format("UPDATE Players SET lastTravel = '{0}' WHERE steamid = '{1}'", DateTime.Now, _cInfo.playerId); SQL.FastQuery(_sql); string _phrase603; if (!Phrases.Dict.TryGetValue(603, out _phrase603)) { _phrase603 = " you have traveled to {Destination}."; } _phrase603 = _phrase603.Replace("{Destination}", kvpCorners.Key); ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase603 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } else { Flag.Add(_cInfo.entityId + 1); if (Flag.Count == Box.Count) { string _phrase604; if (!Phrases.Dict.TryGetValue(604, out _phrase604)) { _phrase604 = " you are not in a travel location."; } ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase604 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } } } } }
private static void LobbyTele(ClientInfo _cInfo) { if (Lobby.Lobby_Position != "0,0,0" && Lobby.Lobby_Position != "0 0 0" && Lobby.Lobby_Position != "") { EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId]; if (_player != null) { if (!Lobby.LobbyPlayers.Contains(_cInfo.entityId)) { if (Player_Check) { if (Teleportation.PCheck(_cInfo, _player)) { return; } } if (Zombie_Check) { if (Teleportation.ZCheck(_cInfo, _player)) { return; } } if (!Teleportation.Teleporting.Contains(_cInfo.entityId)) { Teleportation.Teleporting.Add(_cInfo.entityId); } int x, y, z; if (Return) { Vector3 _position = _player.GetPosition(); x = (int)_position.x; y = (int)_position.y; z = (int)_position.z; string _pposition = x + "," + y + "," + z; LobbyPlayers.Add(_cInfo.entityId); PersistentContainer.Instance.Players[_cInfo.playerId].LobbyReturnPos = _pposition; PersistentContainer.DataChange = true; Phrases.Dict.TryGetValue(243, out string _phrase243); _phrase243 = _phrase243.Replace("{CommandPrivate}", ChatHook.Chat_Command_Prefix1); _phrase243 = _phrase243.Replace("{Command53}", Command53); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase243 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); } string[] _cords = Lobby.Lobby_Position.Split(',').ToArray(); if (int.TryParse(_cords[0], out int _x)) { if (int.TryParse(_cords[1], out int _y)) { if (int.TryParse(_cords[2], out int _z)) { _cInfo.SendPackage(NetPackageManager.GetPackage <NetPackageTeleportPlayer>().Setup(new Vector3(_x, _y, _z), null, false)); if (Wallet.IsEnabled && Command_Cost >= 1) { Wallet.SubtractCoinsFromWallet(_cInfo.playerId, Command_Cost); } PersistentContainer.Instance.Players[_cInfo.playerId].LastLobby = DateTime.Now; PersistentContainer.DataChange = true; } } } } else { Phrases.Dict.TryGetValue(250, out string _phrase250); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase250 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); } } } else { Phrases.Dict.TryGetValue(245, out string _phrase245); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase245 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); } }
public static void Exec(ClientInfo _cInfo, string _message) { EntityPlayer player = PersistentOperations.GetEntityPlayer(_cInfo.entityId); if (player != null) { if (Player_Check) { if (Teleportation.PCheck(_cInfo, player)) { return; } } if (Zombie_Check) { if (Teleportation.ZCheck(_cInfo, player)) { return; } } ClientInfo friend = ConsoleHelper.ParseParamIdOrName(_message); if (friend != null) { EntityPlayer friendPlayer = PersistentOperations.GetEntityPlayer(friend.entityId); if (friendPlayer != null) { if (!player.IsFriendsWith(friendPlayer)) { Phrases.Dict.TryGetValue("FriendTeleport9", out string _phrase); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); return; } DateTime lastFriendTele = DateTime.Now; if (PersistentContainer.Instance.Players[_cInfo.CrossplatformId.CombinedString].LastFriendTele != null) { lastFriendTele = PersistentContainer.Instance.Players[_cInfo.CrossplatformId.CombinedString].LastFriendTele; } TimeSpan varTime = DateTime.Now - lastFriendTele; double fractionalMinutes = varTime.TotalMinutes; int _timepassed = (int)fractionalMinutes; if (ReservedSlots.IsEnabled && ReservedSlots.Reduced_Delay) { if (ReservedSlots.Dict.ContainsKey(_cInfo.PlatformId.CombinedString) || ReservedSlots.Dict.ContainsKey(_cInfo.CrossplatformId.CombinedString)) { if (ReservedSlots.Dict.TryGetValue(_cInfo.PlatformId.CombinedString, out DateTime dt)) { if (DateTime.Now < dt) { int delay = Delay_Between_Uses / 2; Delay(_cInfo, friend, _timepassed, delay); return; } } else if (ReservedSlots.Dict.TryGetValue(_cInfo.CrossplatformId.CombinedString, out dt)) { if (DateTime.Now < dt) { int delay = Delay_Between_Uses / 2; Delay(_cInfo, friend, _timepassed, delay); return; } } } } Delay(_cInfo, friend, _timepassed, Delay_Between_Uses); return; } } Phrases.Dict.TryGetValue("FriendTeleport11", out string phrase1); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + phrase1 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); } }
public static void Exec(ClientInfo _cInfo, string _playerName) { if (SetMarket.Market_Position != "0,0,0") { int x, y, z; string _sql; if (Return) { EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId]; Vector3 _position = _player.GetPosition(); x = (int)_position.x; y = (int)_position.y; z = (int)_position.z; if (PvP_Check) { if (Teleportation.PCheck(_cInfo, _player)) { return; } } if (Zombie_Check) { if (Teleportation.ZCheck(_cInfo, _player)) { return; } } string _mposition = x + "," + y + "," + z; MarketPlayers.Add(_cInfo.entityId); _sql = string.Format("UPDATE Players SET marketReturn = '{0}' WHERE steamid = '{1}'", _mposition, _cInfo.playerId); SQL.FastQuery(_sql, "MarketChat"); string _phrase561; if (!Phrases.Dict.TryGetValue(561, out _phrase561)) { _phrase561 = " you can go back by typing {CommandPrivate}{Command51} when you are ready to leave the market."; } _phrase561 = _phrase561.Replace("{CommandPrivate}", ChatHook.Command_Private); _phrase561 = _phrase561.Replace("{Command51}", MarketChat.Command51); ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase561 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } string[] _cords = { }; if (SetMarket.Market_Position.Contains(",")) { if (SetMarket.Market_Position.Contains(" ")) { SetMarket.Market_Position.Replace(" ", ""); } _cords = SetMarket.Market_Position.Split(',').ToArray(); } else { _cords = SetMarket.Market_Position.Split(' ').ToArray(); } int.TryParse(_cords[0], out x); int.TryParse(_cords[1], out y); int.TryParse(_cords[2], out z); _cInfo.SendPackage(new NetPackageTeleportPlayer(new Vector3(x, y, z), null, false)); string _phrase562; if (!Phrases.Dict.TryGetValue(562, out _phrase562)) { _phrase562 = " sent you to the market."; } ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase562 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null); if (Wallet.IsEnabled && Command_Cost >= 1) { Wallet.SubtractCoinsFromWallet(_cInfo.playerId, Command_Cost); } _sql = string.Format("UPDATE Players SET lastMarket = '{0}' WHERE steamid = '{1}'", DateTime.Now, _cInfo.playerId); SQL.FastQuery(_sql, "MarketChat"); } else { string _phrase563; if (!Phrases.Dict.TryGetValue(563, out _phrase563)) { _phrase563 = " the market position is not set."; } ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + _phrase563 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } }
public static void MarketTele(ClientInfo _cInfo) { if (Market.Market_Position != "0,0,0" || Market.Market_Position != "0 0 0" || Market.Market_Position != "") { EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId]; if (Player_Check) { if (Teleportation.PCheck(_cInfo, _player)) { return; } } if (Zombie_Check) { if (Teleportation.ZCheck(_cInfo, _player)) { return; } } if (!Teleportation.Teleporting.Contains(_cInfo.entityId)) { Teleportation.Teleporting.Add(_cInfo.entityId); } int x, y, z; if (Return) { Vector3 _position = _player.GetPosition(); x = (int)_position.x; y = (int)_position.y; z = (int)_position.z; string _mposition = x + "," + y + "," + z; MarketPlayers.Add(_cInfo.entityId); PersistentContainer.Instance.Players[_cInfo.playerId].MarketReturnPos = _mposition; Phrases.Dict.TryGetValue(252, out string _phrase252); _phrase252 = _phrase252.Replace("{CommandPrivate}", ChatHook.Command_Private); _phrase252 = _phrase252.Replace("{Command51}", Command51); ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase252 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } string[] _cords = Market.Market_Position.Split(',').ToArray(); if (int.TryParse(_cords[0], out int _x)) { if (int.TryParse(_cords[1], out int _y)) { if (int.TryParse(_cords[2], out int _z)) { _cInfo.SendPackage(NetPackageManager.GetPackage <NetPackageTeleportPlayer>().Setup(new Vector3(_x, _y, _z), null, false)); if (Wallet.IsEnabled && Command_Cost >= 1) { Wallet.SubtractCoinsFromWallet(_cInfo.playerId, Command_Cost); } PersistentContainer.Instance.Players[_cInfo.playerId].LastMarket = DateTime.Now; PersistentContainer.Instance.Save(); } } } } else { Phrases.Dict.TryGetValue(254, out string _phrase254); ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase254 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } }
private static void LobbyTele(ClientInfo _cInfo) { if (Lobby_Position != "0,0,0" && Lobby_Position != "0 0 0" && Lobby_Position != "") { EntityPlayer player = PersistentOperations.GetEntityPlayer(_cInfo.entityId); if (player != null) { if (!LobbyPlayers.Contains(_cInfo.entityId)) { if (Player_Check) { if (Teleportation.PCheck(_cInfo, player)) { return; } } if (Zombie_Check) { if (Teleportation.ZCheck(_cInfo, player)) { return; } } if (!Teleportation.Teleporting.Contains(_cInfo.entityId)) { Teleportation.Teleporting.Add(_cInfo.entityId); } int x, y, z; if (Return) { Vector3 position = player.GetPosition(); x = (int)position.x; y = (int)position.y; z = (int)position.z; string pposition = x + "," + y + "," + z; LobbyPlayers.Add(_cInfo.entityId); PersistentContainer.Instance.Players[_cInfo.CrossplatformId.CombinedString].LobbyReturnPos = pposition; PersistentContainer.DataChange = true; Phrases.Dict.TryGetValue("Lobby3", out string phrase); phrase = phrase.Replace("{Command_Prefix1}", ChatHook.Chat_Command_Prefix1); phrase = phrase.Replace("{Command_lobbyback}", Command_lobbyback); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); } string[] cords = Lobby_Position.Split(',').ToArray(); if (int.TryParse(cords[0], out int i)) { if (int.TryParse(cords[1], out int j)) { if (int.TryParse(cords[2], out int k)) { _cInfo.SendPackage(NetPackageManager.GetPackage <NetPackageTeleportPlayer>().Setup(new Vector3(i, j, k), null, false)); if (Wallet.IsEnabled && Command_Cost >= 1) { Wallet.RemoveCurrency(_cInfo.CrossplatformId.CombinedString, Command_Cost); } PersistentContainer.Instance.Players[_cInfo.CrossplatformId.CombinedString].LastLobby = DateTime.Now; PersistentContainer.DataChange = true; } } } } else { Phrases.Dict.TryGetValue("Lobby10", out string phrase); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); } } } else { Phrases.Dict.TryGetValue("Lobby5", out string phrase); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); } }
public static void MarketTele(ClientInfo _cInfo) { if (Market.Market_Position != "0,0,0" || Market.Market_Position != "0 0 0" || Market.Market_Position != "") { EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId]; if (Player_Check) { if (Teleportation.PCheck(_cInfo, _player)) { return; } } if (Zombie_Check) { if (Teleportation.ZCheck(_cInfo, _player)) { return; } } int x, y, z; if (Return) { Vector3 _position = _player.GetPosition(); x = (int)_position.x; y = (int)_position.y; z = (int)_position.z; string _mposition = x + "," + y + "," + z; MarketPlayers.Add(_cInfo.entityId); PersistentContainer.Instance.Players[_cInfo.playerId].MarketReturnPos = _mposition; string _phrase561; if (!Phrases.Dict.TryGetValue(561, out _phrase561)) { _phrase561 = "You can go back by typing {CommandPrivate}{Command51} when you are ready to leave the market."; } _phrase561 = _phrase561.Replace("{CommandPrivate}", ChatHook.Command_Private); _phrase561 = _phrase561.Replace("{Command51}", Command51); ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase561 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } string[] _cords = { }; if (Market.Market_Position.Contains(",")) { if (Market.Market_Position.Contains(" ")) { Market.Market_Position.Replace(" ", ""); } _cords = Market.Market_Position.Split(',').ToArray(); } else if (Market.Market_Position.Contains(" ")) { _cords = Market.Market_Position.Split(' ').ToArray(); } int.TryParse(_cords[0], out x); int.TryParse(_cords[1], out y); int.TryParse(_cords[2], out z); _cInfo.SendPackage(NetPackageManager.GetPackage <NetPackageTeleportPlayer>().Setup(new Vector3(x, y, z), null, false)); string _phrase562; if (!Phrases.Dict.TryGetValue(562, out _phrase562)) { _phrase562 = "Sent you to the market."; } ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase562 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); if (Wallet.IsEnabled && Command_Cost >= 1) { Wallet.SubtractCoinsFromWallet(_cInfo.playerId, Command_Cost); } PersistentContainer.Instance.Players[_cInfo.playerId].LastMarket = DateTime.Now; PersistentContainer.Instance.Save(); } else { string _phrase563; if (!Phrases.Dict.TryGetValue(563, out _phrase563)) { _phrase563 = "The market position is not set."; } ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase563 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } }
private static void LobbyTele(ClientInfo _cInfo) { if (Lobby.Lobby_Position != "0,0,0" || Lobby.Lobby_Position != "0 0 0" || Lobby.Lobby_Position != "") { EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId]; if (_player != null) { if (Player_Check) { if (Teleportation.PCheck(_cInfo, _player)) { return; } } if (Zombie_Check) { if (Teleportation.ZCheck(_cInfo, _player)) { return; } } int x, y, z; if (Return) { Vector3 _position = _player.GetPosition(); x = (int)_position.x; y = (int)_position.y; z = (int)_position.z; string _pposition = x + "," + y + "," + z; LobbyPlayers.Add(_cInfo.entityId); PersistentContainer.Instance.Players[_cInfo.playerId].LobbyReturnPos = _pposition; string _phrase552; if (!Phrases.Dict.TryGetValue(552, out _phrase552)) { _phrase552 = " you can go back by typing {CommandPrivate}{Command53} when you are ready to leave the lobby."; } _phrase552 = _phrase552.Replace("{CommandPrivate}", ChatHook.Command_Private); _phrase552 = _phrase552.Replace("{Command53}", Command53); ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase552 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } string[] _cords = { }; if (Lobby.Lobby_Position.Contains(",")) { if (Lobby.Lobby_Position.Contains(" ")) { Lobby.Lobby_Position.Replace(" ", ""); } _cords = Lobby.Lobby_Position.Split(',').ToArray(); } else if (Lobby.Lobby_Position.Contains(" ")) { _cords = Lobby.Lobby_Position.Split(' ').ToArray(); } string _phrase553; if (!Phrases.Dict.TryGetValue(553, out _phrase553)) { _phrase553 = " sending you to the lobby."; } int.TryParse(_cords[0], out x); int.TryParse(_cords[1], out y); int.TryParse(_cords[2], out z); ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase553 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); _cInfo.SendPackage(NetPackageManager.GetPackage <NetPackageTeleportPlayer>().Setup(new Vector3(x, y, z), null, false)); if (Wallet.IsEnabled && Command_Cost >= 1) { Wallet.SubtractCoinsFromWallet(_cInfo.playerId, Command_Cost); } PersistentContainer.Instance.Players[_cInfo.playerId].LastLobby = DateTime.Now; PersistentContainer.Instance.Save(); } } else { string _phrase554; if (!Phrases.Dict.TryGetValue(554, out _phrase554)) { _phrase554 = " the lobby position is not set."; } ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase554 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } }
public static void Checks(ClientInfo _cInfo, string _message, bool _announce) { EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId]; if (PvP_Check) { if (Teleportation.PCheck(_cInfo, _player)) { return; } } if (Zombie_Check) { if (Teleportation.ZCheck(_cInfo, _player)) { return; } } ClientInfo _friend = ConsoleHelper.ParseParamIdOrName(_message); if (_friend != null) { EntityPlayer _friendPlayer = GameManager.Instance.World.Players.dict[_friend.entityId]; if (_player.IsFriendsWith(_friendPlayer)) { bool _donator = false; string _sql = string.Format("SELECT lastFriendTele FROM Players WHERE steamid = '{0}'", _cInfo.playerId); DataTable _result = SQL.TQuery(_sql); DateTime _lastFriendTele; DateTime.TryParse(_result.Rows[0].ItemArray.GetValue(0).ToString(), out _lastFriendTele); _result.Dispose(); if (Delay_Between_Uses < 1 || _lastFriendTele.ToString() == "10/29/2000 7:30:00 AM") { if (Wallet.IsEnabled && Command_Cost >= 1) { CommandCost(_cInfo, _message); } else { MessageFriend(_cInfo, _message); } } else { TimeSpan varTime = DateTime.Now - _lastFriendTele; double fractionalMinutes = varTime.TotalMinutes; int _timepassed = (int)fractionalMinutes; if (ReservedSlots.IsEnabled && ReservedSlots.Reduced_Delay) { if (ReservedSlots.Dict.ContainsKey(_cInfo.playerId)) { DateTime _dt; ReservedSlots.Dict.TryGetValue(_cInfo.playerId, out _dt); if (DateTime.Now < _dt) { _donator = true; int _newDelay = Delay_Between_Uses / 2; if (_timepassed >= _newDelay) { if (Wallet.IsEnabled && Command_Cost >= 1) { CommandCost(_cInfo, _message); } else { MessageFriend(_cInfo, _message); } } else { int _timeleft = _newDelay - _timepassed; string _phrase630; if (!Phrases.Dict.TryGetValue(630, out _phrase630)) { _phrase630 = " you can only teleport to a friend once every {DelayBetweenUses} minutes. Time remaining: {TimeRemaining} minutes."; } _phrase630 = _phrase630.Replace("{DelayBetweenUses}", _newDelay.ToString()); _phrase630 = _phrase630.Replace("{TimeRemaining}", _timeleft.ToString()); if (_announce) { ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase630 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null); } else { ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase630 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } } } } } if (!_donator) { if (_timepassed >= Delay_Between_Uses) { if (Wallet.IsEnabled && Command_Cost >= 1) { CommandCost(_cInfo, _message); } else { MessageFriend(_cInfo, _message); } } else { int _timeleft = Delay_Between_Uses - _timepassed; string _phrase630; if (!Phrases.Dict.TryGetValue(630, out _phrase630)) { _phrase630 = " you can only teleport to a friend once every {DelayBetweenUses} minutes. Time remaining: {TimeRemaining} minutes."; } _phrase630 = _phrase630.Replace("{DelayBetweenUses}", Delay_Between_Uses.ToString()); _phrase630 = _phrase630.Replace("{TimeRemaining}", _timeleft.ToString()); if (_announce) { ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase630 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null); } else { ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase630 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } } } } } else { string _phrase633; if (!Phrases.Dict.TryGetValue(633, out _phrase633)) { _phrase633 = "This player is not your friend. You can not request teleport to them."; } ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase633 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } } }
public static void Tele(ClientInfo _cInfo) { try { EntityPlayer player = PersistentOperations.GetEntityPlayer(_cInfo.entityId); if (player != null) { if (Dict.Count > 0) { int x = (int)player.position.x; int y = (int)player.position.y; int z = (int)player.position.z; foreach (KeyValuePair <string, string[]> travel in Dict) { string[] c1 = travel.Value[0].Split(','); int.TryParse(c1[0], out int x1); int.TryParse(c1[1], out int y1); int.TryParse(c1[2], out int z1); string[] c2 = travel.Value[1].Split(','); int.TryParse(c2[0], out int x2); int.TryParse(c2[1], out int y2); int.TryParse(c2[2], out int z2); if (x >= x1 && x <= x2 && y >= y1 && y <= y2 && z >= z1 && z <= z2) { if (Player_Check) { if (Teleportation.PCheck(_cInfo, player)) { return; } } if (Zombie_Check) { if (Teleportation.ZCheck(_cInfo, player)) { return; } } string[] destination = travel.Value[2].Split(','); int.TryParse(destination[0], out int destinationX); int.TryParse(destination[1], out int destinationY); int.TryParse(destination[2], out int destinationZ); _cInfo.SendPackage(NetPackageManager.GetPackage <NetPackageTeleportPlayer>().Setup(new Vector3(destinationX, destinationY, destinationZ), null, false)); if (Wallet.IsEnabled && Command_Cost >= 1) { Wallet.RemoveCurrency(_cInfo.CrossplatformId.CombinedString, Command_Cost); } PersistentContainer.Instance.Players[_cInfo.CrossplatformId.CombinedString].LastTravel = DateTime.Now; PersistentContainer.DataChange = true; Phrases.Dict.TryGetValue("Travel1", out string phrase); phrase = phrase.Replace("{Destination}", travel.Value[2]); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); return; } } Phrases.Dict.TryGetValue("Travel2", out string phrase1); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + phrase1 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); return; } } } catch (Exception e) { Log.Out(string.Format("[SERVERTOOLS] Error in Travel.Tele: {0}", e.Message)); } }