SoFunction
Updated on 2025-03-07

How to help the League of Legends auxiliary lol hang up and not be kicked (lol hang up script)


using System;
using ;
using ;
using ;

using ;
using ;
using ;

namespace LOLSetCursor
{
    public class Hook
    {
        static bool IsStartThread = false;
        [StructLayout()]
        public class KeyBoardHookStruct
        {
            public int vkCode;
            public int scanCode;
            public int flags;
            public int time;
            public int dwExtraInfo;
        }
        public class SetPaint
        {
            public int X;
            public int Y;
            public int rows;
        }
        [Flags]  
        enum MouseEventFlag : uint 
        {  
            Move = 0x0001,  
            LeftDown = 0x0002,  
            LeftUp = 0x0004,  
            RightDown = 0x0008,  
            RightUp = 0x0010,  
            MiddleDown = 0x0020,  
            MiddleUp = 0x0040,  
            XDown = 0x0080,  
            XUp = 0x0100,  
            Wheel = 0x0800,  
            VirtualDesk = 0x4000,  
            Absolute = 0x8000  
        }

//Trust
        public delegate int HookProc(int nCode, int wParam, IntPtr lParam);
        static int hHook = 0;
        public const int WH_KEYBOARD_LL = 13;
//Release the constant of the key
        private const int KEYEVENTF_KEYUP = 2;
//LowLevel keyboard intercepts. If it is WH_KEYBOARD=2, it cannot be intercepted on the system keyboard. Acrobat Reader will obtain the keyboard before you intercept.
        static HookProc KeyBoardHookProcedure;

#region Call API
//Set hook
        [DllImport("", CharSet = , CallingConvention = )]
        public static extern int SetWindowsHookEx(int idHook, HookProc lpfn, IntPtr hInstance, int threadId);

//Draw the hook
        [DllImport("", CharSet = , CallingConvention = )]
        public static extern bool UnhookWindowsHookEx(int idHook);

//Calling the next hook
        [DllImport("", CharSet = , CallingConvention = )]
        public static extern int CallNextHookEx(int idHook, int nCode, int wParam, IntPtr lParam);

//Get the module handle
        [DllImport("", CharSet = , CallingConvention = )]
        public static extern IntPtr GetModuleHandle(string name);

//Find the target process window
        [DllImport("")]
        public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);

//Find subform
        [DllImport("", EntryPoint = "FindWindowEX")]
        public static extern IntPtr FindWindowEx(IntPtr hwndParent,
            IntPtr hwndChildAfter, string lpszClass, string lpszWindow);


//Set the process window to the front
        [DllImport("")]
        public static extern bool SetForegroundWindow(IntPtr hWnd);

//Simulate keyboard events
        [DllImport("")]
        public static extern void keybd_event(Byte bVk, Byte bScan, Int32 dwFlags, Int32 dwExtraInfo);

//Set the mouse position
        [DllImport("")]
        static extern bool SetCursorPos(int X, int Y);

//Simulate mouse buttons
        [DllImport("")]
        static extern void mouse_event(MouseEventFlag flsgs, int dx, int dy, uint data, UIntPtr extraInfo);
        #endregion
        /// <summary>
/// Install the hook
        /// </summary>
        public void Hook_Start()
        {
//Installing the hook
            if (hHook == 0)
            {
                KeyBoardHookProcedure = new HookProc(KeyBoatdHookProc);
                hHook = SetWindowsHookEx(WH_KEYBOARD_LL, KeyBoardHookProcedure,
                        , 0);
if (hHook == 0) Hook_Clear(); //hook setting failed
            }
        }

        /// <summary>
/// Uninstall Hook
        /// </summary>
        public static void Hook_Clear()
        {
            bool retKeyboard = true;
            if (hHook != 0)
            {
                retKeyboard = UnhookWindowsHookEx(hHook);
                hHook = 0;
            }
        }

        public static int KeyBoatdHookProc(int nCode, int wParam, IntPtr lParam)
        {
            Thread thread1 = new Thread(StartCursor);
            SetPaint sp = new SetPaint();
            = ;
            = ;
            = 0;
//Monitor user keyboard input
            KeyBoardHookStruct input = (KeyBoardHookStruct)(lParam, typeof(KeyBoardHookStruct));
            Keys k = (Keys)(typeof(Keys), ());

            if ( == (int) || == (int) || == (int)Keys.F1)
            {
                = true;
                IsStartThread = true;
                (sp);
            }
            else if ( == (int) || == (int) || == (int)Keys.F2)
            {
                Hook_Clear();
                if (null != thread1)
                {
                    ();
                    IsStartThread = false;
                }
            }
            return CallNextHookEx(hHook, nCode, wParam, lParam);
        }

        static void StartCursor(object list)
        {
            SetPaint spaint = list as SetPaint;
            int sWhith = ;
            int sHeight = ;
            int dx = 0;
            int dy = 0;

            while (IsStartThread)
            {               
                if (3 < ) = 0;
                switch ()
                {
                    case 0:
                        dx = sWhith  / 3;
                        dy = sHeight / 3;
                        break;
                    case 1:
                        dy = dy * 2;
                        break;
                    case 2:
                        dx = dx * 2;
                        break;
                    case 3:
                        dy = dy / 2;
                        break;
                    default:
                        break;
                }
                ++;
                //("width:"+sWhith+" height:"+sHeight+ " X:" + dx + " Y:" + dy+" rows:"+);
                SetCursorPos(dx, dy);
                mouse_event( | , 0, 0, 0, );
                (10000);
            }
        }
    }
}