diff --git a/AdminTools/AdminTools.csproj b/AdminTools/AdminTools.csproj index 21898b3..5ba49ba 100644 --- a/AdminTools/AdminTools.csproj +++ b/AdminTools/AdminTools.csproj @@ -42,10 +42,8 @@ ..\packages\Colorful.Console.1.0.5\lib\net452\Colorful.Console.dll True - - False - ..\..\..\..\SERVERS\GameServer\Grand Theft Auto\GTA V\GTAServer.exe - False + + ..\..\..\..\Documents\GTA Scripting\Plugins\GTAServer.exe ..\packages\Lidgren.Network.1.0.2\lib\net451\Lidgren.Network.dll @@ -59,6 +57,13 @@ ..\packages\MaxMind.GeoIP2.2.6.0\lib\net45\MaxMind.GeoIP2.dll True + + ..\packages\protobuf-net.2.1.0\lib\net451\protobuf-net.dll + True + + + ..\libs\ScriptHookVDotNet.dll + diff --git a/AdminTools/packages.config b/AdminTools/packages.config index 4326215..cdaaa46 100644 --- a/AdminTools/packages.config +++ b/AdminTools/packages.config @@ -5,5 +5,6 @@ + \ No newline at end of file diff --git a/Client/Chat.cs b/Client/Chat.cs index d94c65a..2e641db 100644 --- a/Client/Chat.cs +++ b/Client/Chat.cs @@ -13,159 +13,159 @@ namespace GTACoOp { - public class Chat : Script + public class Chat { - public event EventHandler OnComplete; + public event EventHandler OnComplete; - public Chat() - { - CurrentInput = ""; - _mainScaleform = new Scaleform(0); - _mainScaleform.Load("multiplayer_chat"); - } + public Chat() + { + CurrentInput = ""; + _mainScaleform = new Scaleform(0); + _mainScaleform.Load("multiplayer_chat"); + } - public bool HasInitialized; + public bool HasInitialized; - public void Init() - { - _mainScaleform.CallFunction("SET_FOCUS", 2, 2, "ALL"); - _mainScaleform.CallFunction("SET_FOCUS", 1, 2, "ALL"); - HasInitialized = true; - } + public void Init() + { + _mainScaleform.CallFunction("SET_FOCUS", 2, 2, "ALL"); + _mainScaleform.CallFunction("SET_FOCUS", 1, 2, "ALL"); + HasInitialized = true; + } - public bool IsFocused + public bool IsFocused + { + get { return _isFocused; } + set { - get { return _isFocused; } - set + if (value && !_isFocused) + { + _mainScaleform.CallFunction("SET_FOCUS", 2, 2, "ALL"); + } + else if (!value && _isFocused) { - if (value && !_isFocused) - { - _mainScaleform.CallFunction("SET_FOCUS", 2, 2, "ALL"); - } - else if (!value && _isFocused) - { - _mainScaleform.CallFunction("SET_FOCUS", 1, 2, "ALL"); - } + _mainScaleform.CallFunction("SET_FOCUS", 1, 2, "ALL"); + } - _isFocused = value; + _isFocused = value; - } } + } - private Scaleform _mainScaleform; + private Scaleform _mainScaleform; - public string CurrentInput; + public string CurrentInput; - private int _switch = 1; - private Keys _lastKey; - private bool _isFocused; + private int _switch = 1; + private Keys _lastKey; + private bool _isFocused; - public void Tick() - { - if (!Main.IsOnServer()) return; + public void Tick() + { + if (!Main.IsOnServer()) return; - _mainScaleform.Render2D(); + _mainScaleform.Render2D(); - if (!IsFocused) return; - Function.Call(Hash.DISABLE_ALL_CONTROL_ACTIONS, 0); - } + if (!IsFocused) return; + Function.Call(Hash.DISABLE_ALL_CONTROL_ACTIONS, 0); + } - public void AddMessage(string sender, string msg) + public void AddMessage(string sender, string msg) + { + if (string.IsNullOrEmpty(sender)) { - if (string.IsNullOrEmpty(sender)) - { - _mainScaleform.CallFunction("ADD_MESSAGE", "", SanitizeString(msg)); - System.IO.File.AppendAllText("scripts\\GTACOOP_chat.log", "[" + DateTime.UtcNow + "] " + msg + "\n"); - } - else - { - _mainScaleform.CallFunction("ADD_MESSAGE", SanitizeString(sender) + ":", SanitizeString(msg)); - System.IO.File.AppendAllText("scripts\\GTACOOP_chat.log", "[" + DateTime.UtcNow + "] " + sender + ": " + msg + "\n"); - } + _mainScaleform.CallFunction("ADD_MESSAGE", "", SanitizeString(msg)); + System.IO.File.AppendAllText("scripts\\GTACOOP_chat.log", "[" + DateTime.UtcNow + "] " + msg + "\n"); } - - public string SanitizeString(string input) + else { - input = Regex.Replace(input, "~.~", "", RegexOptions.IgnoreCase); - return input; + _mainScaleform.CallFunction("ADD_MESSAGE", SanitizeString(sender) + ":", SanitizeString(msg)); + System.IO.File.AppendAllText("scripts\\GTACOOP_chat.log", "[" + DateTime.UtcNow + "] " + sender + ": " + msg + "\n"); } + } - public void OnKeyDown(Keys key) - { - if (key == Keys.PageUp && Main.IsOnServer()) - _mainScaleform.CallFunction("PAGE_UP"); + public string SanitizeString(string input) + { + input = Regex.Replace(input, "~.~", "", RegexOptions.IgnoreCase); + return input; + } - else if (key == Keys.PageDown && Main.IsOnServer()) - _mainScaleform.CallFunction("PAGE_DOWN"); + public void OnKeyDown(Keys key) + { + if (key == Keys.PageUp && Main.IsOnServer()) + _mainScaleform.CallFunction("PAGE_UP"); - if (!IsFocused) return; + else if (key == Keys.PageDown && Main.IsOnServer()) + _mainScaleform.CallFunction("PAGE_DOWN"); - if ((key == Keys.ShiftKey && _lastKey == Keys.Menu) || (key == Keys.Menu && _lastKey == Keys.ShiftKey)) - ActivateKeyboardLayout(1, 0); + if (!IsFocused) return; - _lastKey = key; + if ((key == Keys.ShiftKey && _lastKey == Keys.Menu) || (key == Keys.Menu && _lastKey == Keys.ShiftKey)) + ActivateKeyboardLayout(1, 0); - if (key == Keys.Escape) - { - IsFocused = false; - CurrentInput = ""; - } + _lastKey = key; - var keyChar = GetCharFromKey(key, Game.IsKeyPressed(Keys.ShiftKey), false); + if (key == Keys.Escape) + { + IsFocused = false; + CurrentInput = ""; + } - if (keyChar.Length == 0) return; + var keyChar = GetCharFromKey(key, Game.IsKeyPressed(Keys.ShiftKey), false); - if (keyChar[0] == (char)8) - { - _mainScaleform.CallFunction("SET_FOCUS", 1, 2, "ALL"); - _mainScaleform.CallFunction("SET_FOCUS", 2, 2, "ALL"); + if (keyChar.Length == 0) return; - if (CurrentInput.Length > 0) - { - CurrentInput = CurrentInput.Substring(0, CurrentInput.Length - 1); - _mainScaleform.CallFunction("ADD_TEXT", CurrentInput); - } - return; - } - if (keyChar[0] == (char)13) + if (keyChar[0] == (char)8) + { + _mainScaleform.CallFunction("SET_FOCUS", 1, 2, "ALL"); + _mainScaleform.CallFunction("SET_FOCUS", 2, 2, "ALL"); + + if (CurrentInput.Length > 0) { - _mainScaleform.CallFunction("ADD_TEXT", "ENTER"); - if (OnComplete != null) OnComplete.Invoke(this, EventArgs.Empty); - CurrentInput = ""; - return; + CurrentInput = CurrentInput.Substring(0, CurrentInput.Length - 1); + _mainScaleform.CallFunction("ADD_TEXT", CurrentInput); } - var str = keyChar; - - CurrentInput += str; - _mainScaleform.CallFunction("ADD_TEXT", str); + return; } + if (keyChar[0] == (char)13) + { + _mainScaleform.CallFunction("ADD_TEXT", "ENTER"); + if (OnComplete != null) OnComplete.Invoke(this, EventArgs.Empty); + CurrentInput = ""; + return; + } + var str = keyChar; + CurrentInput += str; + _mainScaleform.CallFunction("ADD_TEXT", str); + } - [DllImport("user32.dll")] - public static extern int ToUnicodeEx(uint virtualKeyCode, uint scanCode, - byte[] keyboardState, - [Out, MarshalAs(UnmanagedType.LPWStr, SizeConst = 64)] - StringBuilder receivingBuffer, - int bufferSize, uint flags, IntPtr kblayout); - - [DllImport("user32.dll")] - public static extern int ActivateKeyboardLayout(int hkl, uint flags); - public static string GetCharFromKey(Keys key, bool shift, bool altGr) + [DllImport("user32.dll")] + public static extern int ToUnicodeEx(uint virtualKeyCode, uint scanCode, + byte[] keyboardState, + [Out, MarshalAs(UnmanagedType.LPWStr, SizeConst = 64)] + StringBuilder receivingBuffer, + int bufferSize, uint flags, IntPtr kblayout); + + [DllImport("user32.dll")] + public static extern int ActivateKeyboardLayout(int hkl, uint flags); + + public static string GetCharFromKey(Keys key, bool shift, bool altGr) + { + var buf = new StringBuilder(256); + var keyboardState = new byte[256]; + if (shift) + keyboardState[(int)Keys.ShiftKey] = 0xff; + if (altGr) { - var buf = new StringBuilder(256); - var keyboardState = new byte[256]; - if (shift) - keyboardState[(int)Keys.ShiftKey] = 0xff; - if (altGr) - { - keyboardState[(int)Keys.ControlKey] = 0xff; - keyboardState[(int)Keys.Menu] = 0xff; - } - - ToUnicodeEx((uint)key, 0, keyboardState, buf, 256, 0, InputLanguage.CurrentInputLanguage.Handle); - return buf.ToString(); + keyboardState[(int)Keys.ControlKey] = 0xff; + keyboardState[(int)Keys.Menu] = 0xff; } + + ToUnicodeEx((uint)key, 0, keyboardState, buf, 256, 0, InputLanguage.CurrentInputLanguage.Handle); + return buf.ToString(); } - } \ No newline at end of file + } +} \ No newline at end of file diff --git a/Client/GTACoOp.csproj b/Client/GTACoOp.csproj index 423b1e0..9919f47 100644 --- a/Client/GTACoOp.csproj +++ b/Client/GTACoOp.csproj @@ -43,8 +43,12 @@ false + + ..\packages\Colorful.Console.1.0.5\lib\net452\Colorful.Console.dll + True + - ..\..\..\..\SERVERS\GameServer\Grand Theft Auto\GTA V\GTAServer.exe + ..\..\..\..\Documents\GTA Scripting\Plugins\GTAServer.exe ..\packages\Lidgren.Network.1.0.2\lib\net451\Lidgren.Network.dll @@ -79,6 +83,7 @@ + diff --git a/Client/packages.config b/Client/packages.config index 4b06aef..cdaaa46 100644 --- a/Client/packages.config +++ b/Client/packages.config @@ -1,8 +1,10 @@  + + \ No newline at end of file diff --git a/Race/Race.csproj b/Race/Race.csproj index de3ff62..602d3df 100644 --- a/Race/Race.csproj +++ b/Race/Race.csproj @@ -31,15 +31,37 @@ 4 + + ..\packages\Colorful.Console.1.0.5\lib\net452\Colorful.Console.dll + True + - ..\Server\bin\Release\GTAServer.exe + ..\Server\bin\Debug\GTAServer.exe - False - ..\libs\Lidgren.Network.dll + ..\packages\Lidgren.Network.1.0.2\lib\net451\Lidgren.Network.dll + True + + + ..\packages\MaxMind.Db.2.0.0\lib\net45\MaxMind.Db.dll + True + + + ..\packages\MaxMind.GeoIP2.2.6.0\lib\net45\MaxMind.GeoIP2.dll + True + + + ..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll + True + + + ..\packages\protobuf-net.2.1.0\lib\net451\protobuf-net.dll + True + + @@ -53,6 +75,10 @@ + + + +