├── .gitattributes ├── map ├── __resource.lua └── stream │ ├── generic_texture_renderer.gfx │ └── generic_texture_renderer_2.gfx ├── README.md ├── FiveM_Client ├── Properties │ └── AssemblyInfo.cs ├── FiveM_Client.csproj ├── NativeUI │ └── Sprite.cs └── FiveM_Plugin │ ├── VideoPlayer.cs │ └── FXClient.cs ├── FiveM_Server ├── Properties │ └── AssemblyInfo.cs ├── FiveM_Server.csproj └── FXServer.cs └── FXPlugin.sln /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /map/__resource.lua: -------------------------------------------------------------------------------- 1 | resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937' 2 | -------------------------------------------------------------------------------- /map/stream/generic_texture_renderer.gfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sheenthebest/fivem_cinema/HEAD/map/stream/generic_texture_renderer.gfx -------------------------------------------------------------------------------- /map/stream/generic_texture_renderer_2.gfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sheenthebest/fivem_cinema/HEAD/map/stream/generic_texture_renderer_2.gfx -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # fivem_cinema 2 | 3 | https://forum.fivem.net/t/cinema-with-working-youtube-and-distanced-sound-volume-preview-wip-c/150737/13 4 | 5 | C# - Only Source Code 6 | 7 | This code probably do not work if you are not a developer. 8 | 9 | No Support 10 | -------------------------------------------------------------------------------- /FiveM_Client/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.Reflection; 4 | using System.Runtime.CompilerServices; 5 | using System.Runtime.InteropServices; 6 | using System.Runtime.Versioning; 7 | 8 | [assembly: AssemblyVersion("1.0.0.0")] 9 | [assembly: CompilationRelaxations(8)] 10 | [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] 11 | [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] 12 | [assembly: AssemblyTitle("FiveM_Plugin")] 13 | [assembly: AssemblyDescription("")] 14 | [assembly: AssemblyConfiguration("")] 15 | [assembly: AssemblyCompany("")] 16 | [assembly: AssemblyProduct("FiveM_Plugin")] 17 | [assembly: AssemblyCopyright("Copyright © 2018")] 18 | [assembly: AssemblyTrademark("")] 19 | [assembly: ComVisible(false)] 20 | [assembly: Guid("01188858-d24b-4da2-9c48-2609811568d2")] 21 | [assembly: AssemblyFileVersion("1.0.0.0")] 22 | -------------------------------------------------------------------------------- /FiveM_Server/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.Reflection; 4 | using System.Runtime.CompilerServices; 5 | using System.Runtime.InteropServices; 6 | using System.Runtime.Versioning; 7 | 8 | [assembly: AssemblyVersion("1.0.0.0")] 9 | [assembly: CompilationRelaxations(8)] 10 | [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] 11 | [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] 12 | [assembly: AssemblyTitle("FiveM_Server")] 13 | [assembly: AssemblyDescription("")] 14 | [assembly: AssemblyConfiguration("")] 15 | [assembly: AssemblyCompany("")] 16 | [assembly: AssemblyProduct("FiveM_Server")] 17 | [assembly: AssemblyCopyright("Copyright © 2018")] 18 | [assembly: AssemblyTrademark("")] 19 | [assembly: ComVisible(false)] 20 | [assembly: Guid("17d71ace-b4fb-4389-b0f0-59210d0790ec")] 21 | [assembly: AssemblyFileVersion("1.0.0.0")] 22 | -------------------------------------------------------------------------------- /FXPlugin.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.26228.4 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FiveM_Client", "FiveM_Client\FiveM_Client.csproj", "{30F488B6-04D2-4C03-963E-C285349903CF}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FiveM_Server", "FiveM_Server\FiveM_Server.csproj", "{30F488B6-04D2-4C03-963E-C285349903D0}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Release|Any CPU = Release|Any CPU 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {30F488B6-04D2-4C03-963E-C285349903CF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 17 | {30F488B6-04D2-4C03-963E-C285349903CF}.Debug|Any CPU.Build.0 = Debug|Any CPU 18 | {30F488B6-04D2-4C03-963E-C285349903CF}.Release|Any CPU.ActiveCfg = Release|Any CPU 19 | {30F488B6-04D2-4C03-963E-C285349903CF}.Release|Any CPU.Build.0 = Release|Any CPU 20 | {30F488B6-04D2-4C03-963E-C285349903D0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {30F488B6-04D2-4C03-963E-C285349903D0}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {30F488B6-04D2-4C03-963E-C285349903D0}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {30F488B6-04D2-4C03-963E-C285349903D0}.Release|Any CPU.Build.0 = Release|Any CPU 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | EndGlobal 29 | -------------------------------------------------------------------------------- /FiveM_Server/FiveM_Server.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {30F488B6-04D2-4C03-963E-C285349903D0} 8 | Library 9 | FiveM_Server 10 | FiveM_Server 11 | v4.5.2 12 | 512 13 | 14 | 15 | AnyCPU 16 | true 17 | full 18 | false 19 | bin\Debug\ 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | 24 | 25 | AnyCPU 26 | pdbonly 27 | true 28 | bin\Release\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /FiveM_Client/FiveM_Client.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {30F488B6-04D2-4C03-963E-C285349903CF} 8 | Library 9 | FiveM_Client 10 | FiveM_Client 11 | v4.5.2 12 | 512 13 | 14 | 15 | AnyCPU 16 | true 17 | full 18 | false 19 | bin\Debug\ 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | 24 | 25 | AnyCPU 26 | pdbonly 27 | true 28 | bin\Release\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /FiveM_Client/NativeUI/Sprite.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Drawing; 3 | using System.IO; 4 | using System.Reflection; 5 | using CitizenFX.Core.Native; 6 | using CitizenFX.Core.UI; 7 | 8 | namespace NativeUI 9 | { 10 | // Token: 0x02000002 RID: 2 11 | public class Sprite 12 | { 13 | // Token: 0x17000001 RID: 1 14 | // (get) Token: 0x06000001 RID: 1 RVA: 0x00002050 File Offset: 0x00000250 15 | // (set) Token: 0x06000002 RID: 2 RVA: 0x00002058 File Offset: 0x00000258 16 | public string TextureDict 17 | { 18 | get 19 | { 20 | return this._textureDict; 21 | } 22 | set 23 | { 24 | this._textureDict = value; 25 | } 26 | } 27 | 28 | // Token: 0x06000003 RID: 3 RVA: 0x00002061 File Offset: 0x00000261 29 | public Sprite(string textureDict, string textureName, PointF position, SizeF size, float heading, Color color) 30 | { 31 | this.TextureDict = textureDict; 32 | this.TextureName = textureName; 33 | this.Position = position; 34 | this.Size = size; 35 | this.Heading = heading; 36 | this.Color = color; 37 | this.Visible = true; 38 | } 39 | 40 | // Token: 0x06000004 RID: 4 RVA: 0x000020A0 File Offset: 0x000002A0 41 | public Sprite(string textureDict, string textureName, PointF position, SizeF size) : this(textureDict, textureName, position, size, 0f, Color.FromArgb(255, 255, 255, 255)) 42 | { 43 | } 44 | 45 | // Token: 0x06000005 RID: 5 RVA: 0x000020D8 File Offset: 0x000002D8 46 | public void Draw() 47 | { 48 | if (!this.Visible) 49 | { 50 | return; 51 | } 52 | if (!Function.Call(91750494399812324L, new InputArgument[] 53 | { 54 | this.TextureDict 55 | })) 56 | { 57 | Function.Call(-2332038263791780395L, new InputArgument[] 58 | { 59 | this.TextureDict, 60 | true 61 | }); 62 | } 63 | float width = (float)Screen.Resolution.Width; 64 | int height = Screen.Resolution.Height; 65 | float num = width / (float)height; 66 | float num2 = 1080f * num; 67 | float num3 = this.Size.Width / num2; 68 | float num4 = this.Size.Height / 1080f; 69 | float num5 = this.Position.X / num2 + num3 * 0.5f; 70 | float num6 = this.Position.Y / 1080f + num4 * 0.5f; 71 | Function.Call(-1729472009930024816L, new InputArgument[] 72 | { 73 | this.TextureDict, 74 | this.TextureName, 75 | num5, 76 | num6, 77 | num3, 78 | num4, 79 | this.Heading, 80 | this.Color.R, 81 | this.Color.G, 82 | this.Color.B, 83 | this.Color.A 84 | }); 85 | } 86 | 87 | // Token: 0x06000006 RID: 6 RVA: 0x00002270 File Offset: 0x00000470 88 | public static void Draw(string dict, string name, int xpos, int ypos, int boxWidth, int boxHeight, float rotation, Color color) 89 | { 90 | if (!Function.Call(91750494399812324L, new InputArgument[] 91 | { 92 | dict 93 | })) 94 | { 95 | Function.Call(-2332038263791780395L, new InputArgument[] 96 | { 97 | dict, 98 | true 99 | }); 100 | } 101 | float width = (float)Screen.Resolution.Width; 102 | int height = Screen.Resolution.Height; 103 | float num = width / (float)height; 104 | float num2 = 1080f * num; 105 | float num3 = (float)boxWidth / num2; 106 | float num4 = (float)boxHeight / 1080f; 107 | float num5 = (float)xpos / num2 + num3 * 0.5f; 108 | float num6 = (float)ypos / 1080f + num4 * 0.5f; 109 | Function.Call(-1729472009930024816L, new InputArgument[] 110 | { 111 | dict, 112 | name, 113 | num5, 114 | num6, 115 | num3, 116 | num4, 117 | rotation, 118 | color.R, 119 | color.G, 120 | color.B, 121 | color.A 122 | }); 123 | } 124 | 125 | // Token: 0x06000007 RID: 7 RVA: 0x000023B4 File Offset: 0x000005B4 126 | public static string WriteFileFromResources(Assembly yourAssembly, string fullResourceName) 127 | { 128 | string tempFileName = Path.GetTempFileName(); 129 | return Sprite.WriteFileFromResources(yourAssembly, fullResourceName, tempFileName); 130 | } 131 | 132 | // Token: 0x06000008 RID: 8 RVA: 0x000023D0 File Offset: 0x000005D0 133 | public static string WriteFileFromResources(Assembly yourAssembly, string fullResourceName, string savePath) 134 | { 135 | using (Stream manifestResourceStream = yourAssembly.GetManifestResourceStream(fullResourceName)) 136 | { 137 | if (manifestResourceStream != null) 138 | { 139 | byte[] buffer = new byte[manifestResourceStream.Length]; 140 | manifestResourceStream.Read(buffer, 0, Convert.ToInt32(manifestResourceStream.Length)); 141 | using (FileStream fileStream = File.Create(savePath)) 142 | { 143 | fileStream.Write(buffer, 0, Convert.ToInt32(manifestResourceStream.Length)); 144 | fileStream.Close(); 145 | } 146 | } 147 | } 148 | return Path.GetFullPath(savePath); 149 | } 150 | 151 | // Token: 0x04000001 RID: 1 152 | public PointF Position; 153 | 154 | // Token: 0x04000002 RID: 2 155 | public SizeF Size; 156 | 157 | // Token: 0x04000003 RID: 3 158 | public Color Color; 159 | 160 | // Token: 0x04000004 RID: 4 161 | public bool Visible; 162 | 163 | // Token: 0x04000005 RID: 5 164 | public float Heading; 165 | 166 | // Token: 0x04000006 RID: 6 167 | public string TextureName; 168 | 169 | // Token: 0x04000007 RID: 7 170 | private string _textureDict; 171 | } 172 | } 173 | -------------------------------------------------------------------------------- /FiveM_Server/FXServer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using CitizenFX.Core; 4 | using CitizenFX.Core.Native; 5 | 6 | namespace FiveM_Server 7 | { 8 | // Token: 0x02000002 RID: 2 9 | internal class FXServer : BaseScript 10 | { 11 | // Token: 0x06000001 RID: 1 RVA: 0x00002050 File Offset: 0x00000250 12 | public FXServer() 13 | { 14 | API.RegisterCommand("volume", new Action, string>(this.OnVolumeCmd), false); 15 | API.RegisterCommand("play", new Action, string>(this.OnVideoPlayCmd), false); 16 | API.RegisterCommand("pause", new Action, string>(this.OnVideoPauseCmd), false); 17 | API.RegisterCommand("stop", new Action, string>(this.OnVideoStopCmd), false); 18 | API.RegisterCommand("vtime", new Action, string>(this.OnVideoTimeCmd), false); 19 | API.RegisterCommand("url", new Action, string>(this.OnUrlCmd), false); 20 | API.RegisterCommand("yt", new Action, string>(this.OnYTCmd), false); 21 | API.RegisterCommand("player", new Action, string>(this.OnPlayerCmd), false); 22 | } 23 | 24 | // Token: 0x06000002 RID: 2 RVA: 0x00002144 File Offset: 0x00000344 25 | private void OnVolumeCmd(int playerId, List args, string cmd) 26 | { 27 | if (playerId >= 0 && args.Count == 1) 28 | { 29 | base.Players[playerId].TriggerEvent("Video:SetVolume", new object[] 30 | { 31 | float.Parse((string)args[0]) 32 | }); 33 | } 34 | } 35 | 36 | // Token: 0x06000003 RID: 3 RVA: 0x00002194 File Offset: 0x00000394 37 | private void OnVideoPlayCmd(int playerId, List args, string cm) 38 | { 39 | if (!this.IsAllowedToChange(base.Players[playerId])) 40 | { 41 | return; 42 | } 43 | if (args.Count == 1) 44 | { 45 | foreach (Player player in base.Players) 46 | { 47 | player.TriggerEvent("Video:Play", new object[] 48 | { 49 | (string)args[0] 50 | }); 51 | } 52 | } 53 | } 54 | 55 | // Token: 0x06000004 RID: 4 RVA: 0x00002218 File Offset: 0x00000418 56 | private void OnVideoPauseCmd(int playerId, List args, string cm) 57 | { 58 | if (!this.IsAllowedToChange(base.Players[playerId])) 59 | { 60 | return; 61 | } 62 | foreach (Player player in base.Players) 63 | { 64 | player.TriggerEvent("Video:Pause", new object[0]); 65 | } 66 | } 67 | 68 | // Token: 0x06000005 RID: 5 RVA: 0x00002284 File Offset: 0x00000484 69 | private void OnVideoStopCmd(int playerId, List args, string cm) 70 | { 71 | if (!this.IsAllowedToChange(base.Players[playerId])) 72 | { 73 | return; 74 | } 75 | foreach (Player player in base.Players) 76 | { 77 | player.TriggerEvent("Video:Stop", new object[0]); 78 | } 79 | } 80 | 81 | // Token: 0x06000006 RID: 6 RVA: 0x000022F0 File Offset: 0x000004F0 82 | private void OnVideoTimeCmd(int playerId, List args, string cm) 83 | { 84 | if (!this.IsAllowedToChange(base.Players[playerId])) 85 | { 86 | return; 87 | } 88 | foreach (Player player in base.Players) 89 | { 90 | if (args.Count == 3) 91 | { 92 | int num = int.Parse((string)args[0]); 93 | int num2 = int.Parse((string)args[1]); 94 | int num3 = int.Parse((string)args[2]); 95 | player.TriggerEvent("Video:Time", new object[] 96 | { 97 | num, 98 | num2, 99 | num3 100 | }); 101 | } 102 | } 103 | } 104 | 105 | // Token: 0x06000007 RID: 7 RVA: 0x000023B8 File Offset: 0x000005B8 106 | private void OnUrlCmd(int playerId, List args, string cm) 107 | { 108 | if (!this.IsAllowedToChange(base.Players[playerId])) 109 | { 110 | return; 111 | } 112 | if (args.Count == 1) 113 | { 114 | foreach (Player player in base.Players) 115 | { 116 | player.TriggerEvent("Video:URL", new object[] 117 | { 118 | (string)args[0] 119 | }); 120 | } 121 | } 122 | } 123 | 124 | // Token: 0x06000008 RID: 8 RVA: 0x0000243C File Offset: 0x0000063C 125 | private void OnYTCmd(int playerId, List args, string cm) 126 | { 127 | if (!this.IsAllowedToChange(base.Players[playerId])) 128 | { 129 | return; 130 | } 131 | if (args.Count == 1) 132 | { 133 | foreach (Player player in base.Players) 134 | { 135 | player.TriggerEvent("Video:YT", new object[] 136 | { 137 | (string)args[0] 138 | }); 139 | } 140 | } 141 | } 142 | 143 | // Token: 0x06000009 RID: 9 RVA: 0x000024C0 File Offset: 0x000006C0 144 | private void OnPlayerCmd(int playerId, List args, string cm) 145 | { 146 | if (!this.IsAllowedToChange(base.Players[playerId])) 147 | { 148 | return; 149 | } 150 | foreach (Player player in base.Players) 151 | { 152 | player.TriggerEvent("Video:Player", new object[0]); 153 | } 154 | } 155 | 156 | // Token: 0x0600000A RID: 10 RVA: 0x0000252C File Offset: 0x0000072C 157 | private bool IsAllowedToChange(Player player) 158 | { 159 | foreach (string a in player.Identifiers) 160 | { 161 | foreach (string b in FXServer.AllowedPlayers) 162 | { 163 | if (a == b) 164 | { 165 | return true; 166 | } 167 | } 168 | } 169 | return false; 170 | } 171 | 172 | // Token: 0x0600000B RID: 11 RVA: 0x000025A0 File Offset: 0x000007A0 173 | private int GetRandom(int min, int max) 174 | { 175 | return new Random().Next(min, max); 176 | } 177 | 178 | // Token: 0x0600000C RID: 12 RVA: 0x000025B0 File Offset: 0x000007B0 179 | public void RegisterEventHandler(string name, Delegate action) 180 | { 181 | EventHandlerDictionary eventHandlers = base.EventHandlers; 182 | eventHandlers[name] += action; 183 | } 184 | 185 | // Token: 0x0600000D RID: 13 RVA: 0x000025DA File Offset: 0x000007DA 186 | public void RegisterExport(string name, Delegate action) 187 | { 188 | base.Exports.Add(name, action); 189 | } 190 | 191 | // Token: 0x04000001 RID: 1 192 | public static string[] AllowedPlayers = new string[] 193 | { 194 | "steam:11000010610ca2d", 195 | "steam:11000010f3457b0" 196 | }; 197 | } 198 | } 199 | -------------------------------------------------------------------------------- /FiveM_Client/FiveM_Plugin/VideoPlayer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using CitizenFX.Core; 3 | using CitizenFX.Core.Native; 4 | 5 | namespace FiveM_Plugin 6 | { 7 | // Token: 0x02000005 RID: 5 8 | public class VideoPlayer : IDisposable 9 | { 10 | // Token: 0x0600001C RID: 28 RVA: 0x000028C4 File Offset: 0x00000AC4 11 | public VideoPlayer(FXClient client, string url, string resourceName) 12 | { 13 | this.resourceName = resourceName; 14 | this.URL = url; 15 | this.RTI = VideoPlayer.INDEX++; 16 | client.RegisterEventHandler("onClientResourceStart", new Action(this.OnClientResourceStart)); 17 | client.RegisterEventHandler("onResourceStop", new Action(this.OnResourceStop)); 18 | } 19 | 20 | // Token: 0x0600001D RID: 29 RVA: 0x0000294E File Offset: 0x00000B4E 21 | public VideoPlayer(FXClient client, string url) : this(client, url, VideoPlayer.DEFAULT_RESOURCE) 22 | { 23 | } 24 | 25 | // Token: 0x0600001E RID: 30 RVA: 0x00002960 File Offset: 0x00000B60 26 | private async void OnClientResourceStart(string resName) 27 | { 28 | if (resName == API.GetCurrentResourceName()) 29 | { 30 | this.scaleform = new Scaleform(this.resourceName); 31 | while (!this.scaleform.IsLoaded) 32 | { 33 | await BaseScript.Delay(0); 34 | } 35 | if (VideoPlayer.TXD == -1L) 36 | { 37 | VideoPlayer.TXD = API.CreateRuntimeTxd("meows"); 38 | } 39 | this.duiObj = API.CreateDui(this.URL, 1280, 720); 40 | this.dui = API.GetDuiHandle(this.duiObj); 41 | this.tx = Function.Call((ulong)-1321908437, new InputArgument[] 42 | { 43 | VideoPlayer.TXD, 44 | "woof", 45 | this.dui 46 | }); 47 | } 48 | } 49 | 50 | // Token: 0x0600001F RID: 31 RVA: 0x000029A1 File Offset: 0x00000BA1 51 | private void OnResourceStop(string resName) 52 | { 53 | if (resName == API.GetCurrentResourceName()) 54 | { 55 | this.Dispose(); 56 | } 57 | } 58 | 59 | // Token: 0x06000020 RID: 32 RVA: 0x000029B6 File Offset: 0x00000BB6 60 | public void SetURL(string url) 61 | { 62 | this.NEW_URL = url; 63 | this.LastVolume = -1f; 64 | } 65 | 66 | // Token: 0x06000021 RID: 33 RVA: 0x000029CA File Offset: 0x00000BCA 67 | public void SendMessage(string json) 68 | { 69 | if (this.messaging) 70 | { 71 | API.SendDuiMessage(this.duiObj, json); 72 | } 73 | } 74 | 75 | // Token: 0x06000022 RID: 34 RVA: 0x000029E0 File Offset: 0x00000BE0 76 | public void SetMessagingEnabled(bool state) 77 | { 78 | this.messaging = state; 79 | } 80 | 81 | // Token: 0x06000023 RID: 35 RVA: 0x000029E9 File Offset: 0x00000BE9 82 | public void SetVolume(float volume) 83 | { 84 | this.Volume = volume; 85 | } 86 | 87 | // Token: 0x06000024 RID: 36 RVA: 0x000029F2 File Offset: 0x00000BF2 88 | public void SetVideoPlay(string webmVideoUrl) 89 | { 90 | this.SendMessage("{ \"type\": \"video\", \"video\":\"" + webmVideoUrl + "\" }"); 91 | } 92 | 93 | // Token: 0x06000025 RID: 37 RVA: 0x00002A0A File Offset: 0x00000C0A 94 | public void PauseVideo() 95 | { 96 | this.SendMessage("{ \"type\": \"pause\" }"); 97 | } 98 | 99 | // Token: 0x06000026 RID: 38 RVA: 0x00002A17 File Offset: 0x00000C17 100 | public void StopVideo() 101 | { 102 | this.SendMessage("{ \"type\": \"stop\" }"); 103 | } 104 | 105 | // Token: 0x06000027 RID: 39 RVA: 0x00002A24 File Offset: 0x00000C24 106 | public void SetVideoTime(int hours, int minutes, int seconds) 107 | { 108 | int num = seconds + minutes * 60 + hours * 60 * 60; 109 | this.SendMessage("{ \"type\": \"time\", \"time\":\"" + num + "\" }"); 110 | } 111 | 112 | // Token: 0x06000028 RID: 40 RVA: 0x00002A5B File Offset: 0x00000C5B 113 | public void SetIframeUrl(string url) 114 | { 115 | this.SendMessage("{ \"type\": \"urlframe\", \"urlframe\":\"" + url + "\" }"); 116 | } 117 | 118 | // Token: 0x06000029 RID: 41 RVA: 0x00002A73 File Offset: 0x00000C73 119 | public void SetYT(string videoId) 120 | { 121 | this.SendMessage("{ \"type\": \"yt\", \"yt\":\"" + videoId + "\" }"); 122 | } 123 | 124 | // Token: 0x0600002A RID: 42 RVA: 0x00002A8B File Offset: 0x00000C8B 125 | public void Refresh() 126 | { 127 | this.SetURL(this.URL); 128 | } 129 | 130 | // Token: 0x0600002B RID: 43 RVA: 0x00002A99 File Offset: 0x00000C99 131 | public void SendMousMove(int x, int y) 132 | { 133 | API.SendDuiMouseMove(this.duiObj, x, y); 134 | } 135 | 136 | // Token: 0x0600002C RID: 44 RVA: 0x00002AA8 File Offset: 0x00000CA8 137 | public void SendMouseClick(string buttonName, bool state) 138 | { 139 | if (state) 140 | { 141 | API.SendDuiMouseDown(this.duiObj, buttonName); 142 | return; 143 | } 144 | API.SendDuiMouseUp(this.duiObj, buttonName); 145 | } 146 | 147 | // Token: 0x0600002D RID: 45 RVA: 0x00002AC8 File Offset: 0x00000CC8 148 | public async void SendMouseClick(string buttonName) 149 | { 150 | API.SendDuiMouseDown(this.duiObj, buttonName); 151 | await BaseScript.Delay(10); 152 | API.SendDuiMouseUp(this.duiObj, buttonName); 153 | } 154 | 155 | // Token: 0x0600002E RID: 46 RVA: 0x00002B0C File Offset: 0x00000D0C 156 | public void Play(Vector3 location, Vector3 rotation, Vector3 scale) 157 | { 158 | if (this.scaleform != null && this.scaleform.IsLoaded && !this.txdHasBeenSet) 159 | { 160 | this.scaleform.CallFunction("SET_TEXTURE", new object[] 161 | { 162 | "meows", 163 | "woof", 164 | 0, 165 | 0, 166 | 1280, 167 | 720 168 | }); 169 | this.txdHasBeenSet = true; 170 | } 171 | if (this.scaleform != null && this.scaleform.IsLoaded) 172 | { 173 | this.SendMessage("{ \"type\": \"volume\", \"volume\": " + this.Volume + " }"); 174 | if (this.NEW_URL.Length > 0) 175 | { 176 | this.URL = this.NEW_URL; 177 | API.SetDuiUrl(this.duiObj, this.NEW_URL); 178 | this.NEW_URL = ""; 179 | } 180 | this.scaleform.Render3D(location, rotation, scale); 181 | } 182 | } 183 | 184 | // Token: 0x0600002F RID: 47 RVA: 0x00002C08 File Offset: 0x00000E08 185 | public void Dispose() 186 | { 187 | API.DestroyDui(this.duiObj); 188 | this.scaleform.Dispose(); 189 | } 190 | 191 | // Token: 0x04002CBD RID: 11453 192 | public static string DEFAULT_RESOURCE = "generic_texture_renderer"; 193 | 194 | // Token: 0x04002CBE RID: 11454 195 | private static int INDEX = 0; 196 | 197 | // Token: 0x04002CBF RID: 11455 198 | private static long TXD = -1L; 199 | 200 | // Token: 0x04002CC0 RID: 11456 201 | private string resourceName; 202 | 203 | // Token: 0x04002CC1 RID: 11457 204 | private string URL; 205 | 206 | // Token: 0x04002CC2 RID: 11458 207 | private string NEW_URL = ""; 208 | 209 | // Token: 0x04002CC3 RID: 11459 210 | private int RTI; 211 | 212 | // Token: 0x04002CC4 RID: 11460 213 | private Scaleform scaleform; 214 | 215 | // Token: 0x04002CC5 RID: 11461 216 | private long duiObj; 217 | 218 | // Token: 0x04002CC6 RID: 11462 219 | private string dui; 220 | 221 | // Token: 0x04002CC7 RID: 11463 222 | private long tx; 223 | 224 | // Token: 0x04002CC8 RID: 11464 225 | private bool txdHasBeenSet; 226 | 227 | // Token: 0x04002CC9 RID: 11465 228 | private float Volume = 1f; 229 | 230 | // Token: 0x04002CCA RID: 11466 231 | private float LastVolume = 1f; 232 | 233 | // Token: 0x04002CCB RID: 11467 234 | private bool messaging = true; 235 | } 236 | } 237 | -------------------------------------------------------------------------------- /FiveM_Client/FiveM_Plugin/FXClient.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Drawing; 3 | using System.Dynamic; 4 | using System.Threading.Tasks; 5 | using CitizenFX.Core; 6 | using CitizenFX.Core.Native; 7 | using NativeUI; 8 | 9 | namespace FiveM_Plugin 10 | { 11 | // Token: 0x02000003 RID: 3 12 | public class FXClient : BaseScript 13 | { 14 | // Token: 0x06000009 RID: 9 RVA: 0x00002464 File Offset: 0x00000664 15 | public FXClient() 16 | { 17 | this.RegisterTickHandler(new Func(this.OnTick)); 18 | this.RegisterTickHandler(new Func(this.OnVolumeControlTick)); 19 | this.carVideo = new VideoPlayer(this, FXClient.PLAYER_URL); 20 | this.cursor = new Sprite("commonmenu", "arrowleft", new PointF(0f, 0f), new SizeF(20f, 20f)); 21 | this.cursor.Color = Color.FromArgb(0, 255, 20); 22 | this.RegisterEventHandler("Video:SetVolume", new Action(this.OnVolumeReceived)); 23 | this.RegisterEventHandler("Video:Play", new Action(this.OnVideoPlayReceived)); 24 | this.RegisterEventHandler("Video:Pause", new Action(this.OnVideoPauseReceived)); 25 | this.RegisterEventHandler("Video:Stop", new Action(this.OnVideoStopReceived)); 26 | this.RegisterEventHandler("Video:Time", new Action(this.OnVideoTimeReceived)); 27 | this.RegisterEventHandler("Video:URL", new Action(this.OnSwitchToURLReceived)); 28 | this.RegisterEventHandler("Video:YT", new Action(this.OnSwitchToYTReceived)); 29 | this.RegisterEventHandler("Video:Player", new Action(this.OnSwitchToPlayerReceived)); 30 | } 31 | 32 | // Token: 0x0600000A RID: 10 RVA: 0x00002610 File Offset: 0x00000810 33 | public void OnClientReceiveTimeFromPlayer(ExpandoObject data, CallbackDelegate cb) 34 | { 35 | } 36 | 37 | // Token: 0x0600000B RID: 11 RVA: 0x00002612 File Offset: 0x00000812 38 | private void OnVolumeReceived(float vol) 39 | { 40 | this.CustomVolume = vol; 41 | } 42 | 43 | // Token: 0x0600000C RID: 12 RVA: 0x0000261B File Offset: 0x0000081B 44 | private void OnVideoPlayReceived(string video) 45 | { 46 | this.carVideo.SetVideoPlay(video); 47 | this.OnVolumeControlTick(); 48 | } 49 | 50 | // Token: 0x0600000D RID: 13 RVA: 0x00002630 File Offset: 0x00000830 51 | private void OnVideoPauseReceived() 52 | { 53 | this.carVideo.PauseVideo(); 54 | } 55 | 56 | // Token: 0x0600000E RID: 14 RVA: 0x0000263D File Offset: 0x0000083D 57 | private void OnVideoStopReceived() 58 | { 59 | this.carVideo.StopVideo(); 60 | } 61 | 62 | // Token: 0x0600000F RID: 15 RVA: 0x0000264A File Offset: 0x0000084A 63 | private void OnVideoTimeReceived(int h, int m, int s) 64 | { 65 | this.carVideo.SetVideoTime(h, m, s); 66 | } 67 | 68 | // Token: 0x06000010 RID: 16 RVA: 0x0000265A File Offset: 0x0000085A 69 | private void OnSwitchToURLReceived(string url) 70 | { 71 | this.carVideo.SetIframeUrl(url); 72 | } 73 | 74 | // Token: 0x06000011 RID: 17 RVA: 0x00002668 File Offset: 0x00000868 75 | private void OnSwitchToYTReceived(string url) 76 | { 77 | this.carVideo.SetYT(url); 78 | } 79 | 80 | // Token: 0x06000012 RID: 18 RVA: 0x00002676 File Offset: 0x00000876 81 | private void OnSwitchToPlayerReceived() 82 | { 83 | this.carVideo.Refresh(); 84 | } 85 | 86 | // Token: 0x06000013 RID: 19 RVA: 0x00002684 File Offset: 0x00000884 87 | public void DrawDevText(string text) 88 | { 89 | API.SetTextFont(4); 90 | API.SetTextProportional(true); 91 | API.SetTextScale(0.5f, 0.5f); 92 | API.SetTextColour(255, 255, 255, 255); 93 | API.SetTextDropshadow(0, 0, 0, 0, 255); 94 | API.SetTextEdge(1, 0, 0, 0, 255); 95 | API.SetTextDropShadow(); 96 | API.SetTextOutline(); 97 | API.SetTextEntry("STRING"); 98 | API.AddTextComponentString(text); 99 | API.DrawText(0.005f, 0.005f + (float)this.nextIndex * 0.025f); 100 | this.nextIndex++; 101 | } 102 | 103 | // Token: 0x06000014 RID: 20 RVA: 0x00002728 File Offset: 0x00000928 104 | public async Task OnVolumeControlTick() 105 | { 106 | Vector3 position = Game.PlayerPed.Position; 107 | float num = 1f - Math.Min(Math.Abs(API.GetDistanceBetweenCoords(position.X, position.Y, position.Z, this.CLoc.X, this.CLoc.Y, this.CLoc.Z, true)), (float)this.MAX_DISTANCE) / (float)this.MAX_DISTANCE; 108 | this.v = num * this.CustomVolume; 109 | if (this.carVideo != null) 110 | { 111 | this.carVideo.SetVolume(num * this.CustomVolume); 112 | } 113 | await BaseScript.Delay(500); 114 | } 115 | 116 | // Token: 0x06000015 RID: 21 RVA: 0x00002770 File Offset: 0x00000970 117 | public async Task OnTick() 118 | { 119 | this.carVideo.Play(this.CLoc, this.CRot, this.CScl); 120 | } 121 | 122 | // Token: 0x06000016 RID: 22 RVA: 0x000027B8 File Offset: 0x000009B8 123 | public void RegisterEventHandler(string name, Delegate action) 124 | { 125 | try 126 | { 127 | EventHandlerDictionary eventHandlers = base.EventHandlers; 128 | eventHandlers[name] += action; 129 | } 130 | catch (Exception ex) 131 | { 132 | Console.WriteLine(ex.ToString()); 133 | } 134 | } 135 | 136 | // Token: 0x06000017 RID: 23 RVA: 0x00002800 File Offset: 0x00000A00 137 | public void RegisterNuiEventHandler(string name, Delegate action) 138 | { 139 | try 140 | { 141 | Function.Call((ulong)-855388759, new InputArgument[] 142 | { 143 | name 144 | }); 145 | this.RegisterEventHandler("__cfx_nui:" + name, action); 146 | } 147 | catch (Exception) 148 | { 149 | } 150 | } 151 | 152 | // Token: 0x06000018 RID: 24 RVA: 0x00002850 File Offset: 0x00000A50 153 | public void RegisterTickHandler(Func action) 154 | { 155 | try 156 | { 157 | base.Tick += action; 158 | } 159 | catch (Exception) 160 | { 161 | } 162 | } 163 | 164 | // Token: 0x06000019 RID: 25 RVA: 0x0000287C File Offset: 0x00000A7C 165 | public void DeregisterTickHandler(Func action) 166 | { 167 | try 168 | { 169 | base.Tick -= action; 170 | } 171 | catch (Exception) 172 | { 173 | } 174 | } 175 | 176 | // Token: 0x0600001A RID: 26 RVA: 0x000028A8 File Offset: 0x00000AA8 177 | public void RegisterExport(string name, Delegate action) 178 | { 179 | base.Exports.Add(name, action); 180 | } 181 | 182 | // Token: 0x04000008 RID: 8 183 | private int nextIndex; 184 | 185 | // Token: 0x04000009 RID: 9 186 | private Sprite cursor; 187 | 188 | // Token: 0x0400000A RID: 10 189 | private static string PLAYER_URL = "http://173.249.59.200/cinema/"; 190 | 191 | // Token: 0x0400000B RID: 11 192 | private VideoPlayer carVideo; 193 | 194 | // Token: 0x0400000C RID: 12 195 | private bool spawned; 196 | 197 | // Token: 0x0400000D RID: 13 198 | private Vector3 poss; 199 | 200 | // Token: 0x0400000E RID: 14 201 | private bool cursorEnabled; 202 | 203 | // Token: 0x0400000F RID: 15 204 | private Vector3 cursorPos; 205 | 206 | // Token: 0x04000010 RID: 16 207 | private float CustomVolume = 1f; 208 | 209 | // Token: 0x04000011 RID: 17 210 | private int wmxi; 211 | 212 | // Token: 0x04000012 RID: 18 213 | private int wmyi; 214 | 215 | // Token: 0x04000013 RID: 19 216 | private int MAX_DISTANCE = 100; 217 | 218 | // Token: 0x04000014 RID: 20 219 | private float v; 220 | 221 | // Token: 0x04000015 RID: 21 222 | private Vector3 CLoc = new Vector3(-1678.949f, -928.3431f, 20.6290932f); 223 | 224 | // Token: 0x04000016 RID: 22 225 | private Vector3 CRot = new Vector3(0f, 0f, -140f); 226 | 227 | // Token: 0x04000017 RID: 23 228 | private Vector3 CScl = new Vector3(0.969999969f, 0.484999985f, -0.1f); 229 | } 230 | } 231 | --------------------------------------------------------------------------------