C
C#13mo ago
Rofus-_-

❔ Big Problem in C# plz someone help

so i'm new to coding (just so you know so if you say something to advanced i will maybe not know what it is) and i have made or making a a movement for the mouse to go down with basiclly when i left click i want my mouse to go down and rn the code is about 3600 lines and i got some big problems that no one really haces on the internet or at least what i can find, this is the problems in one of the codes:
void OnEvent(string eventName, int arg)
{
//guner 5
if (eventName == "MOUSE_BUTTON_PRESSED" && arg == guner 5
{
kickback = !kickback;
gun = arg;
if (kickback == false)
{
Console.WriteLine("guner_5_off");
}
else
{
Console.WriteLine("guner_5_on");
EnablePrimaryMouseButtonEvents(true);
}
}
void OnEvent(string eventName, int arg)
{
//guner 5
if (eventName == "MOUSE_BUTTON_PRESSED" && arg == guner 5
{
kickback = !kickback;
gun = arg;
if (kickback == false)
{
Console.WriteLine("guner_5_off");
}
else
{
Console.WriteLine("guner_5_on");
EnablePrimaryMouseButtonEvents(true);
}
}
the name 'EnablePrimaryMouseButtonEvents' does not exist in the current context and i have much more such as ..
The name 'IsMouseButtonPressed' does not exist in the current context
The name 'IsModifierPressed' does not exist in the current context
The name 'PressKey' does not exist in the current context
The name 'ReleaseKey' does not exist in the current context
The name 'IsMouseButtonPressed' does not exist in the current context
The name 'IsModifierPressed' does not exist in the current context
The name 'PressKey' does not exist in the current context
The name 'ReleaseKey' does not exist in the current context
that i had on soooo many locations but i fixed it some what with using this:
bool IsMouseButtonPressed(int button);
bool IsModifierPressed(string modifier);
void PressKey(string key);
void ReleaseKey(string key);
bool IsMouseButtonPressed(int button);
bool IsModifierPressed(string modifier);
void PressKey(string key);
void ReleaseKey(string key);
now with using does i lost a lot of errors i had in the code but it still says that the "Local function 'IsMouseButtonPressed(int)' must declare a body because it is not marked 'static extern'" (for example) and idk what to do with that info. i guess i'm supposed to give it a comand on what is "IsMouseButtonPressed" but idk how to give it a command that works or does not give me does scream errors
6 Replies
Rofus-_-
Rofus-_-OP13mo ago
now if someone wants the hole code then tell me and i will edit some stuff just because i am going to make this something that is privet, because the code is done but i needed to make it work and while doing it does things happend, but just tell me if you want the code and i will give you it (or send it here)
Joschi
Joschi13mo ago
The error you send means, that the compiler does not know what EnablePrimaryMouseButtonEvents is supposed to be. It simply does not exist and so the program cannot work. For example you got a simple Hello World Program
Console.WriteLine("Hello World");
Console.WriteLine("Hello World");
You could put that string Hello World into it's own variale.
string helloVariable = "Hello World";
Console.WriteLine(helloVariable)
string helloVariable = "Hello World";
Console.WriteLine(helloVariable)
This is functionally the same. But now you do this:
Console.WriteLine(goodbyeVariable)
Console.WriteLine(goodbyeVariable)
What is the program supposed to do? It has no clue what goodbyeVariable is supposed to be. Is it some other string? Is it a function that returns a string? What you basically did with declaring those local functions was the following:
string goodbyeVariable;
Console.WriteLine(goodbyeVariable);
string goodbyeVariable;
Console.WriteLine(goodbyeVariable);
Great, now the program knows it's a string. But that string has no value? So it won't print anything.
Rofus-_-
Rofus-_-OP13mo ago
ok got i will see what i can do it with +rep i wounder if i can use user32.dll in some way cuz it will help with movement
Joschi
Joschi13mo ago
P/Invoke source generation - .NET
Learn about compile-time source generation for platform invokes in .NET.
Joschi
Joschi13mo ago
I guess Before .NET7 there is [DllImport] to work with external dlls
Accord
Accord13mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server