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
I really want to know how to make a bot follow a player.
Only when the player moves/jumps.
Here is what your dealing with:
public static Connection con1;
public static Client client1;
static void onMessage(object sender, PlayerIOClient.Message m)
{
switch (m.Type)
{
case "init":
con1.Send("init2");
break;
case "add":
if (m.GetString(1) == "ninjasupeatsninja")
{
ownerid = m.GetInt(0);
}
break;
case "god":
if (m.GetInt(0) == ownerid)
{
con1.Send("god", m.GetBoolean(1));
}
break;
case "m":
if (m.GetInt(0) == ownerid)
{
/*
* Here is where you can code where the bot moves.
*/
}
break;
}
}
Here is everything i am "using"
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Threading;
using PlayerIOClient;
This is what your dealing with:
*A v2.0.50727 PlayerIOClient
*Connection is con1
*I am using a switch (m.Type)
*I already have the god-mode thing programmed, so you dont have to worry about that.
Please tell me how to make this happen.
If you need more pieces of code, please ask for them.
Thank you.
Offline
public static Connection con1;
public static Client client1;
static void onMessage(object sender, PlayerIOClient.Message m)
{
switch (m.Type)
{
case "m":
if (m.GetInt(0) == ownerid)
{
int X = Convert.ToInt32(Convert.ToDouble(m[1]) / 16);
int Y = Convert.ToInt32(Convert.ToDouble(m[2]) / 16);
int m1 = Convert.ToInt32(Convert.ToDecimal(m[1]) / 16);
int m2 = Convert.ToInt32(Convert.ToDecimal(m[2]) / 16);
int m5 = Convert.ToInt32(Math.Round(Convert.ToDecimal(m[5]), 0));
int m6 = Convert.ToInt32(Math.Round(Convert.ToDecimal(m[6]), 0));
int xp = m1 + m5;
int yp = m2 + m6;
ThreadPool.QueueUserWorkItem(delegate
{
con.Send("m", m.GetDouble(1), m.GetDouble(2), m.GetDouble(3), m.GetDouble(4), m.GetDouble(5), m.GetDouble(6), m.GetDouble(7), m.GetDouble(8), m.GetInt(9), m.GetBoolean(10));
Thread.Sleep(125);
});
}
break;
}
}
Offline
public static Connection con1; public static Client client1; static void onMessage(object sender, PlayerIOClient.Message m) { switch (m.Type) { case "m": if (m.GetInt(0) == ownerid) { int X = Convert.ToInt32(Convert.ToDouble(m[1]) / 16); int Y = Convert.ToInt32(Convert.ToDouble(m[2]) / 16); int m1 = Convert.ToInt32(Convert.ToDecimal(m[1]) / 16); int m2 = Convert.ToInt32(Convert.ToDecimal(m[2]) / 16); int m5 = Convert.ToInt32(Math.Round(Convert.ToDecimal(m[5]), 0)); int m6 = Convert.ToInt32(Math.Round(Convert.ToDecimal(m[6]), 0)); int xp = m1 + m5; int yp = m2 + m6; ThreadPool.QueueUserWorkItem(delegate { con.Send("m", m.GetDouble(1), m.GetDouble(2), m.GetDouble(3), m.GetDouble(4), m.GetDouble(5), m.GetDouble(6), m.GetDouble(7), m.GetDouble(8), m.GetInt(9), m.GetBoolean(10)); Thread.Sleep(125); }); } break; } }
i've forgot to thank you btw
Offline
Or just use this short code..
connection.Send("m", m[1], m[2], m[3], m[4], m[5], m[6], m[7], m[8], m[9], m[10]);
4-5
we are on
6-11
Offline
o_o I am a beginning programmer, I am creating my first bot...
The only thing here I know, is the definition of "connection"
Owner of GooCrew
GooCrew Worlds:
GooCrew Art World
Offline
o_o I am a beginning programmer, I am creating my first bot...
The only thing here I know, is the definition of "connection"
i can be deh person who will help u
Offline
gooberg123 wrote:o_o I am a beginning programmer, I am creating my first bot...
The only thing here I know, is the definition of "connection"i can be deh person who will help u
Been there, done that.
Trust me, you'll regret it.
Offline
Pages: 1
[ Started around 1732798881.5502 - Generated in 0.392 seconds, 13 queries executed - Memory usage: 1.54 MiB (Peak: 1.71 MiB) ]