public void Invoke(ShPlayer player, float x, float y, float z, int placeIndex = 0) { if (placeIndex < 0 || placeIndex > (Core.Instance.SvManager.fixedPlaces.Count + Core.Instance.SvManager.apartments.Count)) { player.TS("TeleportCoordinates_invalidPlaceIndex", placeIndex.ToString()); return; } player.GetExtendedPlayer().ResetAndSavePosition(new Vector3(x, y, z), player.GetRotation(), placeIndex); player.TS("TeleportCoordinates", x.ToString(), y.ToString(), z.ToString(), placeIndex.ToString()); }
private StringBuilder GetOnlineInfo(ShPlayer target) { var sb = new StringBuilder(); sb .Append("ID: ").AppendLine(target.ID.ToString()) .Append("SteamID64: ").AppendLine(target.steamID.ToString()) .Append("Username: "******" (Sanitized)") .Append("Health: ").AppendLine(target.health.ToString()) .Append("BankBalance: ").AppendLine(target.svPlayer.bankBalance.ToString()) .Append("Position: ").AppendLine(target.GetPosition().ToString()) .Append("Rotation: ").AppendLine(target.GetRotation().ToString()) .Append("Stats: ").AppendLine(string.Join("\n - ", target.stats)) .Append("Expecting more info? Type '/info ").Append(target.steamID.ToString()).AppendLine("'."); return(sb); }
public void Invoke(ShPlayer player, string warp, int price = 0, int delay = 0) { if (delay < 0) { player.TS("delay_error_negative"); return; } if (price < 0) { player.TS("price_error_negative"); return; } if (player.svPlayer.InApartment()) { player.TS("warpCreate_error_inApartment"); return; } var file = Path.Combine(Core.Instance.Paths.WarpsFolder, $"{warp}.json"); if (File.Exists(file)) { player.TS("expFileHandler_create_error_alreadyExists", player.T(Core.Instance.WarpHandler.Name), warp); return; } var obj = new WarpHandler.JsonModel { Delay = Math.Max(0, delay), Price = Math.Max(0, price), Name = warp, Position = new WarpHandler.Position { SerializableVector3 = new SerializableVector3(player.GetPosition()), PlaceIndex = player.GetPlaceIndex() }, SerializableQuaternion = new SerializableQuaternion(player.GetRotation()) }; Core.Instance.WarpHandler.CreateNew(obj, warp); player.TS("warpCreate_created", warp, price.ToString(), delay.ToString()); }
public static void ResetAndSavePosition(this PlayerItem player, ShPlayer targetPlayer) { player.SavePosition(); player.Client.svPlayer.SvReset(targetPlayer.GetPosition(), targetPlayer.GetRotation(), targetPlayer.GetPlaceIndex()); }
public void Update(ShPlayer player) { Update(player.GetPosition(), player.GetRotation(), player.GetPlaceIndex()); }
public void Invoke(ShPlayer player, string name) { var vehicle = Core.Instance.EntityHandler.Vehicles.OrderByDescending(x => LevenshteinDistance.CalculateSimilarity(x.Key, name)).FirstOrDefault().Value; var pos = player.GetPosition(); Core.Instance.SvManager.AddNewEntity(vehicle, player.GetPlace(), new Vector3(pos.x, pos.y + 7F, pos.z), player.GetRotation(), respawnable: false); player.TS("player_vehicle_spawned", vehicle.name); }