Do you think I could just leave this part blank and it'd be okay? We're just going to replace the whole thing with a header image anyway, right?
You are not logged in.
Can't seem to add items to a ListBox in case say.
if(playermessage.StartsWith("!admin") && AdminList.Items.Contains(username) && checkAddadmin)
{
AdminList.Items.Add(playermessage.Substring(7));
say(playermessage.Substring(7) + "is now an admin");
}
The above mentioned code does not work.
Offline
Can't seem to add items to a ListBox in case say.
if(playermessage == "!admin" && AdminList.Items.Contains(username) && checkAddadmin) { AdminList.Items.Add(playermessage.Substring(7)); say(playermessage.Substring(7) + "is now an admin"); }
nvm read something wrong
probably somethingwrong in the if statement
if you can read this....good for you
Offline
You're probably receiving the error that you're trying to access a GUI element outside it's main thread.
To solve this you'll have to access the main thread (or something, I found this code snippet on stackoverflow a while ago).
MethodInvoker mi = delegate
{
// GUI element changes put here, in your case:
AdminList.Items.Add(playermessage.Substring(7));
};
if (InvokeRequired)
{
BeginInvoke(mi);
}
else
{
mi.Invoke();
}
Offline
playermessage == "!admin" has to be playermessage.Contains("!admin")
or playermessage.StartsWith("!admin")
Offline
playermessage == "!admin" has to be playermessage.Contains("!admin")
or playermessage.StartsWith("!admin")
I wrote this code separately, so in my original code its StartsWith()
Offline
You're probably receiving the error that you're trying to access a GUI element outside it's main thread.
To solve this you'll have to access the main thread (or something, I found this code snippet on stackoverflow a while ago).▼"code"
How exactly do you use a MethodInvoker class?
I understand how it works, like a function in JS, but what is:
if (InvokeRequired) { BeginInvoke(mi); } else { mi.Invoke(); }
What does it do? When does it execute? What is an InvokeRequired?
Offline
den3107 wrote:You're probably receiving the error that you're trying to access a GUI element outside it's main thread.
To solve this you'll have to access the main thread (or something, I found this code snippet on stackoverflow a while ago).▼"code"How exactly do you use a MethodInvoker class?
I understand how it works, like a function in JS, but what is:
den3107 wrote:if (InvokeRequired) { BeginInvoke(mi); } else { mi.Invoke(); }
What does it do? When does it execute? What is an InvokeRequired?
... you could just do at Form1() { }
CheckForIllegalCrossThreadCells = false;
Problem solved.
I used this in my bot and it worked.
Offline
[ Started around 1732488694.5808 - Generated in 0.109 seconds, 12 queries executed - Memory usage: 1.51 MiB (Peak: 1.67 MiB) ]