Glitches[PC]{C#} TriggerBot Tutorial
Posted:

Glitches[PC]{C#} TriggerBot TutorialPosted:

NightFyre
  • Winter 2020
Status: Offline
Joined: Aug 29, 201212Year Member
Posts: 193
Reputation Power: 1338
Status: Offline
Joined: Aug 29, 201212Year Member
Posts: 193
Reputation Power: 1338

VIDEO TUTORIAL




TEXT TUTORIAL

check out the source code: GitHub

CHEAT ENGINE


Form Configuration
Open Visual Studio > New Project > Windows Forms App C# (name this whatever you would like , but for the sake of this tutorial we will name the project "AssaultCubeTrainer-TTG"
Save this wherever you would like.

    Project > Manage NuGet Packages...
    Browse > Memory.Dll
    Install => Memory.dll.x64 by NeWaGe


Memory.dll Inititialization

1. First add an application manifest file.
Project > Add New Item... > Application Manifest File (Windows Only)

2. Open the app.manifest file from your Solution Explorer window.

3. Edit line 19 where it says "level=" change "asInvoker" to "requireAdministrator". Save and close.

4. Open NuGet manager and Browse for "System.Security.Principal.Windows", install this.

5. Your trainer should match your game's platform. If compiling with Any CPU, uncheck the prefer 32bit checkbox in Build Project Properties if you need x64.
Ex: If game is x86, trainer should be x86. If game is x64, trainer should be x64.




Label, Checkbox & Timer
Navigate to the toolbox and add a Label, Checkbox and Timer to the form
example for Label


Name them however you like , but for the sake of this tutorial will name them
Label => Process_Label
CheckBox => Autoshoot_CheckBox
Timer => ProcessTimer
*TimerProperties> Enabled = True, Interval = 100ms



Coding Stuff
Navigate to the form code by by creating a FormLoad Event (double click empty space in form)
We will be filling this with some information in a moment , but we need to initialize everything first. Scroll to the top and add these libraries

using Memory;
using System.Runtime.InteropServices;
using System.Threading;


directly under public partial class "Form1" we can start initializing some components

public Mem m = new Mem();
private const string PROCESSNAME = "GTA5.exe";
bool gta5Running;

[DllImport("User32.dll")]
static extern short GetAsyncKeyState(Keys vKey);

[DllImport("user32.dll")]
public static extern void mouse_event(int a, int b, int c, int d, int ifyouenjoythisvideoconsidersubscribing);

int leftDown = 0x02;
int leftUp = 0x04;
int CHEAT = 0;


Alright lets go down to the form load event and add in some instructions for when we launch the program.

int PID = m.GetProcIdFromName(PROCESSNAME);
if (PID > 0)
{
   m.OpenProcess(PID);
   Thread AUTOSHOOT = new Thread(AutoShoot) { IsBackground = true };
   AUTOSHOOT.Start();
}


TIMER ... make sure you added an event by double clicking the timer

int PID = m.GetProcIdFromName(PROCESSNAME);
if (PID > 0)
{
   m.OpenProcess(PID);
   Process_Label.ForeColor = Color.FromArgb(0, 169, 0);
   Process_Label.Text = "GTAV CONNECTED";
   gta5Running = true;
   return;
}
Process_Label.ForeColor = Color.FromArgb(169, 0, 0);
Process_Label.Text = "GTAV NOT DETECTED";
gta5Running = false;


THE CHEAT , add this anywhere in the code ... these are sperate methods so do not place this stuff inside of another method / event

void Shoot(int delay)
{
   mouse_event(leftDown, 0, 0, 0, 0);
   Thread.Sleep(1);
   mouse_event(leftUp, 0, 0, 0, 0);
   Thread.Sleep(delay);
}

void AutoShoot()
{
   while (true)
   {
      if (GetAsyncKeyState(Keys.RButton) <0)
      {
         CHEAT = m.ReadInt("GTA5.exe+1FB2380");
         if (CHEAT >= 1 && Autoshoot_CheckBox.Checked)
         {
            Shoot(10);
            Shoot(1);
         }
      }
      Thread.Sleep(1);
   }
}


FULL SOURCE

using System;
using System.Drawing;
using System.Windows.Forms;
using Memory;
using System.Runtime.InteropServices;
using System.Threading;

namespace GTA5_Autoshoot_Tutorial
{
    public partial class MainForm : Form
    {
        Mem m = new Mem();
        private const string PROCESSNAME = "GTA5.exe";
        bool gta5Running;

        [DllImport("User32.dll")]
        static extern short GetAsyncKeyState(Keys vKey);

        [DllImport("user32.dll")]
        public static extern void mouse_event(int a, int b, int c, int d, int ifyouenjoythisvideoconsidersubscribing);

        int leftDown = 0x02;
        int leftUp = 0x04;
        int CHEAT = 0;

        //Methods
        void Shoot(int delay)
        {
            mouse_event(leftDown, 0, 0, 0, 0);
            Thread.Sleep(1);
            mouse_event(leftUp, 0, 0, 0, 0);
            Thread.Sleep(delay);
        }

        void AutoShoot()
        {
            while (true)
            {
                if (GetAsyncKeyState(Keys.RButton) <0)
                {
                    CHEAT = m.ReadInt("GTA5.exe+1FB2380");
                    if (CHEAT >= 1 && Autoshoot_CheckBox.Checked)
                    {
                        Shoot(10);
                        Shoot(1);
                    }
                }
                Thread.Sleep(1);
            }
        }

        public MainForm()
        {
            InitializeComponent();
        }

        private void MainForm_Load(object sender, EventArgs e)
        {
            int PID = m.GetProcIdFromName(PROCESSNAME);
            if (PID > 0)
            {
                m.OpenProcess(PID);
                Thread AUTOSHOOT = new Thread(AutoShoot) { IsBackground = true };
                AUTOSHOOT.Start();
            }
        }


        private void ProcessTimer_Tick(object sender, EventArgs e)
        {
            int PID = m.GetProcIdFromName(PROCESSNAME);
            if (PID > 0)
            {
                m.OpenProcess(PID);
                Process_Label.ForeColor = Color.FromArgb(0, 169, 0);
                Process_Label.Text = "GTAV CONNECTED";
                gta5Running = true;
                return;
            }
            Process_Label.ForeColor = Color.FromArgb(169, 0, 0);
            Process_Label.Text = "GTAV NOT DETECTED";
            gta5Running = false;
        }
    }
}



Watch the video if you get confused , its long but whatever its resourceful and does the job
#2. Posted:
LC10
  • Summer 2021
Status: Offline
Joined: Mar 23, 20195Year Member
Posts: 179
Reputation Power: 378
Status: Offline
Joined: Mar 23, 20195Year Member
Posts: 179
Reputation Power: 378
Thanks for this bro!
Users browsing this topic: None
Jump to:


RECENT POSTS

HOT TOPICS