void PlayLoopOrNonLoopedFX(Entity e, string asset, FxName fxName, bool useEvolutionArgument) { if (!PTFXHelper.HasNamedPTFXAssetLoaded(asset)) { PTFXHelper.RequestNamedPTFXAsset(asset); UI.ShowSubtitle("~r~ PTFX asset is not loaded, please try again ~n~ PTFX asset may not exist.."); } if (PTFXHelper.HasNamedPTFXAssetLoaded(asset)) { string fxType; Vector3 pos = e.Position + e.ForwardVector * 2f + e.RightVector * 1.5f; fxHandle = PTFXHelper.SpawnPTFXOnEntity(asset, fxName.PTFXName, e, new Vector3(1.5f, 2f, 0f), new Vector3(0.0f, 0.0f, 180.0f), fxSize); fxType = "Looped on Entity"; /*if (!PTFXHelper.DoesPTFXLoopedExist(fxHandle)) * { * fxHandle = PTFXHelper.SpawnPTFXOnEntityBone(asset, fxname, e, default(Vector3), default(Vector3), (int)Bone.IK_R_Hand, fxSize); * fxType = "Looped on Entity Bone"; * } * * if (!PTFXHelper.DoesPTFXLoopedExist(fxHandle)) * { * fxHandle = PTFXHelper.SpawnPTFXOnPedBone(asset, fxname, (Ped)e, default(Vector3), default(Vector3), (int)Bone.IK_R_Hand, fxSize); * fxType = "Looped on Ped Bone"; * }*/ if (!PTFXHelper.DoesPTFXLoopedExist(fxHandle)) { fxHandle = PTFXHelper.SpawnPTFXAtCoordinate(asset, fxName.PTFXName, pos, new Vector3(0, 0, 180.0f), fxSize); fxType = "Looped on Coordinate"; } if (!PTFXHelper.DoesPTFXLoopedExist(fxHandle)) { PTFXHelper.StartPTFXOnEntity(asset, fxName.PTFXName, e, new Vector3(1.5f, 2f, 0f), new Vector3(0.0f, 0.0f, 180.0f), fxSize); PTFXHelper.StartPTFXAtCoordinate(asset, fxName.PTFXName, pos, new Vector3(0, 0, 180.0f), fxSize); fxType = "Non Looped on Entity or on Coordinate, or doesn't work :("; } UI.ShowSubtitle("PTFX Spawn Type: " + fxType); if (useEvolutionArgument && PTFXHelper.DoesPTFXLoopedExist(fxHandle)) { foreach (var evo in fxName.EvolutionList) { PTFXHelper.SetEvolution(fxHandle, evo.EvolutionName, evo.Amount); PTFXHelper.SetAlpha(fxHandle, 1); } } } }
private void FxEvolution_OnItemLeftRight(UIMenu sender, UIMenuItem selectedItem, int index, bool left, UIMenuItem itemToControl, string fxName, string asset, bool useEvolutionArg, FxEvolution evo, string evolutionArg = "") { if (selectedItem == itemToControl) { evo.Amount = sender.ControlFloatValue(itemToControl, left, evo.Amount, 0.1f, 0.01f, 2, true); if (PTFXHelper.DoesPTFXLoopedExist(fxHandle)) { PTFXHelper.SetEvolution(fxHandle, evolutionArg, evo.Amount); PTFXHelper.SetAlpha(fxHandle, 1); } } }
private void FXMenu_OnItemLeftRight(UIMenu sender, UIMenuItem selectedItem, int index, bool left) { if (selectedItem == ItemFxSize) { fxSize = FXMenu.ControlFloatValue(ItemFxSize, left, fxSize, 0.1f, 1.0f); if (PTFXHelper.DoesPTFXLoopedExist(fxHandle)) { PTFXHelper.SetScale(fxHandle, fxSize); } } else if (selectedItem == ItemColourR) { colourR = FXMenu.ControlFloatValue(ItemColourR, left, colourR, 1f, 10f, 0, true, 0f, 255.0f); if (PTFXHelper.DoesPTFXLoopedExist(fxHandle)) { PTFXHelper.SetColour(fxHandle, colourR, colourG, colourB); } } else if (selectedItem == ItemColourG) { colourG = FXMenu.ControlFloatValue(ItemColourG, left, colourG, 1f, 10f, 0, true, 0f, 255.0f); if (PTFXHelper.DoesPTFXLoopedExist(fxHandle)) { PTFXHelper.SetColour(fxHandle, colourR, colourG, colourB); } } else if (selectedItem == ItemColourB) { colourB = FXMenu.ControlFloatValue(ItemColourB, left, colourB, 1f, 10f, 0, true, 0f, 255.0f); if (PTFXHelper.DoesPTFXLoopedExist(fxHandle)) { PTFXHelper.SetColour(fxHandle, colourR, colourG, colourB); } } else if (selectedItem == ItemRange) { rangeFx = FXMenu.ControlFloatValue(ItemRange, left, rangeFx, 0.1f, 1f, 1); if (PTFXHelper.DoesPTFXLoopedExist(fxHandle)) { PTFXHelper.SetRange(fxHandle, rangeFx); } } }
private void FXMenu_OnItemSelect(UIMenu sender, UIMenuItem selectedItem, int index) { if (selectedItem == ItemRemoveNearbyFx) { ForceRemoveSurroundingFX(Game.Player.Character); } if (selectedItem == ItemSearch) { searchString = Game.GetUserInput(25); if (searchString == null || searchString == "") { FXMenu.IsVisible = false; SearchMenu.IsVisible = true; return; } SearchMenu.ResetIndexPosition(); SearchMenu.SelectedItem = null; if (SearchMenu.UIMenuItemList.Count > 0) { SearchMenu.UIMenuItemList.Clear(); } FXMenu.IsVisible = false; SearchMenu.IsVisible = true; doSearch = true; allowMenuDraw = false; } if (selectedItem == ItemMoveTask) { if (PlayerIsTaskedToMove) { Game.Player.Character.Task.ClearAll(); PlayerIsTaskedToMove = false; } else { if (Game.Player.Character.IsInVehicle()) { Game.Player.Character.Task.CruiseWithVehicle(Game.Player.Character.CurrentVehicle, 50f, 6); //gtaforums.com/topic/822314-guide-driving-styles/ } else { Game.Player.Character.Task.WanderAround(); } PlayerIsTaskedToMove = true; } } if (selectedItem == ItemColourR || selectedItem == ItemColourG || selectedItem == ItemColourB || selectedItem == ItemFxSize || selectedItem == ItemRange) { if (lastAsset != null && lastFXName != null) { PTFXHelper.RemovePTFX(fxHandle); Ped player = Game.Player.Character; PlayLoopOrNonLoopedFX(player.IsInVehicle() ? player.CurrentVehicle : (Entity)player, lastAsset, lastFXName, lastFXName.EvolutionList.Count > 0 ? true : false); if (PTFXHelper.DoesPTFXLoopedExist(fxHandle)) { if (selectedItem == ItemColourR || selectedItem == ItemColourG || selectedItem == ItemColourB) { PTFXHelper.SetColour(fxHandle, colourR, colourG, colourB); } else if (selectedItem == ItemRange) { PTFXHelper.SetColour(fxHandle, colourR, colourG, colourB); PTFXHelper.SetRange(fxHandle, rangeFx); } } } } }