diff --git a/LemonUI/Elements/ScaledBink.cs b/LemonUI/Elements/ScaledBink.cs index e33a0d6..23df25a 100644 --- a/LemonUI/Elements/ScaledBink.cs +++ b/LemonUI/Elements/ScaledBink.cs @@ -17,7 +17,7 @@ namespace LemonUI.Elements /// /// A Bink Video file. /// - public class ScaledBink : BaseElement + public class ScaledBink : BaseElement, IDisposable { #region Fields @@ -91,6 +91,11 @@ public ScaledBink(string name, PointF pos, SizeF size) : base(pos, size) /// public override void Draw() { + if (id == -1) + { + return; + } + #if ALTV Alt.Natives.PlayBinkMovie(id); Alt.Natives.DrawBinkMovie(id, relativePosition.X, relativePosition.Y, relativeSize.Width, relativeSize.Height, 0.0f, 255, 255, 255, 255); @@ -116,6 +121,11 @@ public override void Draw() /// public void Stop() { + if (id == -1) + { + return; + } + #if ALTV Alt.Natives.StopBinkMovie(id); #elif FIVEM @@ -128,6 +138,30 @@ public void Stop() Function.Call(Hash.STOP_BINK_MOVIE, id); #endif } + /// + /// Disposes the Bink Video ID. + /// + public void Dispose() + { + if (id == -1) + { + return; + } + +#if ALTV + Alt.Natives.ReleaseBinkMovie(id); +#elif FIVEM + API.ReleaseBinkMovie(id); +#elif RAGEMP + Invoker.Invoke(0x04D950EEFA4EED8C, id); +#elif RPH + NativeFunction.CallByHash(0x04D950EEFA4EED8C, id); +#elif SHVDN3 || SHVDNC + Function.Call(Hash.RELEASE_BINK_MOVIE, id); +#endif + + id = -1; + } /// public override void Recalculate() {