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.
Pages: 1
This is my first bot, and I'm not much of a "tutorial" kind of guy, so I decided instead of creating alternate threads for each issue, how about just use 1 thread.
#1 - My commands don't work. IDK why. Does not give errors, when someone says .help,
My code:
List<eeplayer> playerList = new List<eeplayer>();
public void handlemsg(object sender, PlayerIOClient.Message m)
{
if (m.Type == "init")
{
say("Connected");
}if (m.Type == "add")
{
playerList.Add(new eeplayer() { userID = m.GetInt(0), username = m.GetString(1) });
}if (m.Type == "left")
{
foreach (eeplayer p in playerList)
{
if (p.userID == m.GetInt(0))
{
playerList.Remove(p);
}
}
}if (m.Type == "say")
{
if (m.GetString(1) == ".help")
{foreach (eeplayer p in playerList)
{
con.Send("say", "/pm " + p.username + "'.afk' '.unafk'");
if (m.GetString(1) == ".unafk")
{
{
if (p.userID == m.GetInt(0))
{
con.Send("say", "/kill " + p.username);}
}if (m.GetString(1) == ".afk")
{
if (p.userID == m.GetInt(0))
{
con.Send("say", "/godon " + p.username);
}
}
}
}
}
}
}
}
}
Owner of GooCrew
GooCrew Worlds:
GooCrew Art World
Offline
So i don't understand, are you trying to make a help command? Because right now you have the curly braces in the wrong places, tell me what commands you want, because idk what is in the middle and what is going on with the foreach loop
If you would like me to make a bot for you, go here.
Offline
1. if the string is already .help it cannot be .afk or .unafk , they have to be seperate , you could uses switch (m.getstring(1)) for example
edit: you arent sending init2 !! this meens the server won't send you the "add" messages ;
send "init2" in the "init" section
Offline
Era, thank you for this. I thought that was the issue, but my friend ninjasupeatsninja denied that it was that issue earlier today. (Screw you ninja) I hope it works!
JabatheBlob1: Yes I am trying to create a help function that lists the player's permissions, an afk function that enables godmode on the player and an unafk function that kills the player.
Owner of GooCrew
GooCrew Worlds:
GooCrew Art World
Offline
if (m.Type == "say")
{
if (m.GetString(1) == ".help")//someone says help
{
foreach (eeplayer p in playerList)
{
con.Send("say", "/pm " + p.username + "'.afk' '.unafk'");//all players get spammed with help command
if (m.GetString(1) == ".unafk")//stuff that doesnt really belong in this if statement
{//stuff that doesnt really belong in this if statement
{//stuff that doesnt really belong in this if statement
if (p.userID == m.GetInt(0))//stuff that doesnt really belong in this if statement
{//stuff that doesnt really belong in this if statement
con.Send("say", "/kill " + p.username);//stuff that doesnt really belong in this if statement
}//stuff that doesnt really belong in this if statement
}//stuff that doesnt really belong in this if statement
if (m.GetString(1) == ".afk")//stuff that doesnt really belong in this if statement
{//stuff that doesnt really belong in this if statement
if (p.userID == m.GetInt(0))//stuff that doesnt really belong in this if statement
{//stuff that doesnt really belong in this if statement
con.Send("say", "/godon " + p.username);//stuff that doesnt really belong in this if statement
}//stuff that doesnt really belong in this if statement
} //stuff that doesnt really belong in this if statement
}//stuff that doesnt really belong in this if statement
}
}
if (m.GetString(1) == ".help")//someone says help
{
foreach (eeplayer p in playerList)
{
if (p.userID == m.GetInt(0))
{
con.Send("say", "/godon " + p.username);
}
}
}
if (m.GetString(1) == ".help")//someone says help
{
foreach (eeplayer p in playerList)
{
if (p.userID == m.GetInt(0))
{
con.Send("say", "/pm " + p.username + "'.afk' '.unafk'");
}
}
}
if you can read this....good for you
Offline
I see what was wrong the whole time. I took a break for a while.
The bot starts the list for players who enter and leave, I start the bot after I enter, so commands do not work for me, therefore, I cannot test them.
Owner of GooCrew
GooCrew Worlds:
GooCrew Art World
Offline
It should get players who are in the level already, unless you are doing it wrong.
thanks zoey aaaaaaaaaaaand thanks latif for the avatar
Offline
>Ewoke: Don't spoon-feed code. How will he learn? I didn't learn to code from copy and pasting from a forum. Next time give him a task description. If you are going to spoon-feed, you should possibly take a screenshot so he has to type it manually. (Which would help him learn.)
On Topic:
You should use a Dictionary to store your players, I find it useful and convenient.
Offline
Thanks everyone :3 I got it working, though now I am trying to find out how to have a bot command work like this for secret, hidden, or just non-spammy commands.
/pm gooberg123 [command variable here]
I have been reading up on it and watching tutorials and I have been getting help, I am aware I should use the write function in EE Information created by capasha.
Though I am not sure how to get this working.
Thanks again! ^^
Owner of GooCrew
GooCrew Worlds:
GooCrew Art World
Offline
Yes, you would use case "write":
Here's how you figure out what to do:
call string(0) first, and see what it produces, name that something easy for you to know. Do the same thing with the string(1). Go on from there.
thanks zoey aaaaaaaaaaaand thanks latif for the avatar
Offline
Yes, you would use case "write":
Here's how you figure out what to do:
call string(0) first, and see what it produces, name that something easy for you to know. Do the same thing with the string(1). Go on from there.
Thank you, I will start trying to get this working.
Owner of GooCrew
GooCrew Worlds:
GooCrew Art World
Offline
>Ewoke: Don't spoon-feed code. How will he learn? I didn't learn to code from copy and pasting from a forum. Next time give him a task description. If you are going to spoon-feed, you should possibly take a screenshot so he has to type it manually. (Which would help him learn.)
On Topic:
You should use a Dictionary to store your players, I find it useful and convenient.
some people learn by doing, others learn by reading on how to do it. ill use the screenshot method next time
if you can read this....good for you
Offline
Pages: 1
[ Started around 1715761969.7823 - Generated in 0.078 seconds, 10 queries executed - Memory usage: 1.53 MiB (Peak: 1.71 MiB) ]