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); } } }