public void OpenVehicleTrunkRequest(IPlayer player, IVehicle vehicle, string positionJson) { //IVehicle vehicle = (IVehicle)args[0]; Vector3 positionTrunk = JsonConvert.DeserializeObject <Vector3>(positionJson); Alt.Log("Doszedl event trunk"); Alt.Log($"xx: {positionTrunk.X} y: {positionTrunk.Y} z: {positionTrunk.Z}"); VehicleEntity vehicleEntity = vehicle.GetVehicleEntity(); if (vehicleEntity == null) { return; } IColShape trunkColShape = Alt.CreateColShapeCylinder(new Position(positionTrunk.X, positionTrunk.Y, positionTrunk.Z), 2f, 2f); trunkColShape.SetData("vehicle:trunk", vehicleEntity); vehicle.SetData("current:vehicle-trunks", trunkColShape); DrawTextModel drawTextModel = new DrawTextModel() { Text = "Kliknij ~g~E ~w~ aby otworzyć bagażnik", X = positionTrunk.X, Y = positionTrunk.Y, Z = positionTrunk.Z, Dimension = vehicle.Dimension, UniqueID = $"VEHICLE_TRUNK_DRAW_TEXT{vehicleEntity.DbModel.Id}" }; DrawTextHelper.CreateGlobalDrawText(drawTextModel); vehicleEntity.TrunkOpen = true; }
public static void CreateGlobalDrawText(DrawTextModel drawTextModel) { EntityHelper.Add(drawTextModel); Alt.EmitAllClients("drawText:create", drawTextModel); }
public static void CreateDrawText(this IPlayer player, DrawTextModel drawTextModel) { player.EmitAsync("drawText:create", drawTextModel); }
public static void RemoveVehicleTrunkDrawText(string uniqueID) { DrawTextModel trunkDrawTextToRemove = VehicleTrunkDrawsText.Find(x => x.UniqueID == uniqueID); VehicleTrunkDrawsText.Remove(trunkDrawTextToRemove); }
public static void Add(DrawTextModel drawTextModel) => VehicleTrunkDrawsText.Add(drawTextModel);