Categories > Coding > C# >

hey alexa! whats the best way to make auto attach

Posts: 0

Threads: 0

Joined: ?

Reputation:

Posted

alexa read the title and spoon feed my cuz im baby

  • 0

Haruka

STD Testing Center

Posts: 58

Threads: 3

Joined: Feb, 2023

Reputation: 5

Replied

not the best but it works

 

 try
        {
            Process[] processes = Process.GetProcessesByName("RobloxPlayerBeta");

            if (processes.Length > 0)
            {
                Console.WriteLine("You can inject (roblox is open )");
            }
            else
            {
                Console.WriteLine("you cant inject ( roblox is closed) ");
            }
        }
        catch (Exception ex)
        {
            Console.WriteLine("An error occurred while trying to check for Roblox: " + ex.Message);
        }
    }

 

 

 

 

  • 0

Added

@atariXD, that is true but its important for handling errors and preventing crashes

  

and if you really dont want error handling you could just remove it 

rocess[] processes = Process.GetProcessesByName("RobloxPlayerBeta");

        if (processes.Length > 0)
        {
            Console.WriteLine("Roblox is running.");
        }
        else
        {
            Console.WriteLine("Roblox is not running.");
        }

 

 

this would work aswell

Process[] processes = Process.GetProcessesByName("RobloxPlayerBeta");

        if (processes == null || processes.Length == 0)
        {
            Console.WriteLine("Roblox is not running.");
        }
        else
        {
            Console.WriteLine("Roblox is running.");
        }
    }

 

  • 0

https://media.discordapp.net/attachments/979069297374671018/1078367228593971362/VelvetSiggy.png

 

 

Posts: 533

Threads: 41

Joined: May, 2020

Reputation: 4

Replied

@Haruka, Roblox has 2 processes though and you cant inject if there is only 1 procces? so just checking if it is greater then 0 could cause problems I think?

  • 0

nltr | Xaml & C# Developer Former Fluxus Administrator
------------------------------------------------------------------------------------
💜 Developer of Kronos ðŸ’œ

Senior Dev of Orbit

Discord

Posts: 7

Threads: 1

Joined: Sep, 2022

Reputation: 0

Replied

use a timer or a while true loop to check if the roblox process is running and then inject

  • 0

Posts: 0

Threads: 0

Joined: ?

Reputation:

Replied

@intristic_roast,
what i will do is sort by the roblox proccesses which takes the mostest memory

  • 0

Posts: 4

Threads: 1

Joined: Apr, 2023

Reputation: 3

Replied

@reversed_coffee, I don't know why youre acting like such a smart ass when in reality you said a whole bunch of nonsense, 

 

anyway as for the advice you gave, you don't have to check for debugger thats stupid and inefficient and everything about that doesn't make sense why would you do that

 

I also don't see how making a new thread (which is stupid either way) would block any sort of task like updating, the whole point of multi-threading

 

 

 

 

s asynchrounity, apart from that use tasks not new Thread because that makes a new system thread which is inefficient,

 

as for "spoonfeeding" this is the most annoying anwser you can possibly give, not only because everything you said was pretty much incorrect, but also as for an actual decent solution here:

 

 
public class ProcessWatcher
{
public Process Process = new Process();
public delegate void Delegate(Process process);
public event Delegate Created;
public bool GetProcess(string processName)
{
Process[] processes = Process.GetProcessesByName(processName);
if (processes.Length < 1)
return false;
foreach (var process in processes)
{
if (String.IsNullOrWhiteSpace(process.MainWindowTitle))
continue;
Process = process;
return true;
}
return false;
}
public void Auto()
{
do
Thread.Sleep(2000);
while (!GetProcess());
Created?.Invoke(Process);
Process.EnableRaisingEvents = true;
Process.Exited += (ignore, ignore2) =>
Auto();
}
}
  • 0

Posts: 2014

Threads: 198

Joined: Apr, 2021

Reputation: 16

Replied

Make a loop that will:
1. Look for a Roblox process.

2. If found, inject the API into the process.

3. (Optional) Return a message saying injection complete.

  • 0

Random quote here...

Posts: 1

Threads: 0

Joined: Feb, 2023

Reputation: 2

Replied

@reversed_coffee
There's nothing "questionable" in the reply Iskra left to you.

You posted something stupid and we're corrected for it, there's no need to leave any aftershock.

 

"I get that we all slip up, and even I do" who are you again????

 

There is no more explanation needed in the code he provided, either. It's self documenting and very easy for anyone to understand.

You're in need of a reality check. If you don't know the answer, don't post it.

  • 0

Users viewing this thread:

( Members: 0, Guests: 1, Total: 1 )