HabbitForums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

HAbbo rp nypd bot function

Go down

HAbbo rp nypd bot function Empty HAbbo rp nypd bot function

Post  Admin Wed Nov 03, 2010 3:48 pm

Introduction:

Hey guys, Well today I'm releasing my bot codes for RASTALULZ RP V26. As Caleb as released his, I thought that I may as well do mine.

[NOTE: I KNOW THESES ARE MESSY, BUT THESES WERE FOR PERSONAL USE, AND IF I SEE ,MANY WANTING THEM, THEN I'M HAPPY TOO CONTINUE TO DO WORK ON THEM!]

1) Open up virtualRooms.cs
2) Search for;
"private string _publicroomItems;" - With no quotes.
3) Add this;
" public Thread follow;" - with no quotes.
4) Search for;
"internal void sendShout(virtualRoomUser sourceUser, string Message)"
5) ABOVE IT add this snippet;
Code:
public void follower()
{
int iCount = 0;
try
{
while (true)
{
using (DatabaseClient dbClient = Eucalypt.dbManager.GetClient())
foreach (virtualBot roomBot in _Bots.Values)
foreach (virtualRoomUser sourceUser in _Users.Values)
{
int punch_randomer;
int slap_randomer;
int dead;
virtualUser Target = userManager.getUser(sourceUser.userID);
punch_randomer = dbClient.getInt("SELECT punch FROM users WHERE id = '" + Target.userID + "'");
slap_randomer = dbClient.getInt("SELECT slap FROM users WHERE id = '" + Target.userID + "'");
dead = dbClient.getInt("SELECT dead FROM users WHERE id = '" + Target.userID + "'");
int cop = dbClient.getInt("SELECT cop FROM roombots WHERE figure = '" + roomBot.Figure + "'");

if (dead == 1)
{
sendShout(roomBot, "Cunt, Your dead, Il get you later, i guess!");
dbClient.runQuery("UPDATE users SET punch = '0' WHERE name = '" + Target._Username + "'");
follow = null;
follow.Abort();
}
else
{
if (punch_randomer == 1)
{
if (cop == 1)
{
iCount++;
roomBot.Z1 = Rotation.Calculate(roomBot.X, roomBot.Y, Target.roomUser.X, Target.roomUser.Y);
roomBot.Z2 = roomBot.Z1;
Coord Next = new Coord();
int[] Borders = getMapBorders();
Next = new Coord(Target.roomUser.X - 1, Target.roomUser.Y);
roomBot.goalX = Next.X;
roomBot.goalY = Next.Y;
Thread.Sleep(200);

if ((roomBot.Y == Target.roomUser.Y && roomBot.X == Target.roomUser.X) || (roomBot.Y + 1 == Target.roomUser.Y && roomBot.X == Target.roomUser.X) || (roomBot.Y - 1 == Target.roomUser.Y && roomBot.X == Target.roomUser.X) || (roomBot.Y == Target.roomUser.Y && roomBot.X + 1 == Target.roomUser.X) || (roomBot.Y == Target.roomUser.Y && roomBot.X - 1 == Target.roomUser.X))
{
Target.roomUser.walkLock = true;
Target.roomUser.goalX = -1;
Target.Run();
sendSaying(roomBot, "*fires a stungun at " + Target._Username + "*");
if ((roomBot.Y == Target.roomUser.Y && roomBot.X == Target.roomUser.X) || (roomBot.Y + 1 == Target.roomUser.Y && roomBot.X == Target.roomUser.X) || (roomBot.Y - 1 == Target.roomUser.Y && roomBot.X == Target.roomUser.X) || (roomBot.Y == Target.roomUser.Y && roomBot.X + 1 == Target.roomUser.X) || (roomBot.Y == Target.roomUser.Y && roomBot.X - 1 == Target.roomUser.X))
{
iCount++;
roomBot.Z1 = Rotation.Calculate(roomBot.X, roomBot.Y, Target.roomUser.X, Target.roomUser.Y);
roomBot.Z2 = roomBot.Z1;
Next = new Coord(Target.roomUser.X - 1, Target.roomUser.Y);
roomBot.goalX = Next.X;
roomBot.goalY = Next.Y;
Thread.Sleep(2000);
Target.roomUser.walkLock = true;
sendSaying(roomBot, "*removes cuffs from belt and wraps around " + Target._Username + " wrists*");
Thread.Sleep(2000);
sendSaying(roomBot, "*arrests " + Target._Username + " for 15 minutes, and fines them 75 credits, for assult!*");
dbClient.runQuery("UPDATE users SET credits = credits - '75' WHERE name = '" + Target._Username + "'");
Target.refreshValueables(true, true);
dbClient.runQuery("UPDATE users SET arrested = '1', arrests = arrests + '1', time_jail = '15', working = '0' WHERE name = '" + Target._Username + "'");
Target._Figure = Target._Uni + "ch-220-94.lg-280-94.sh-290-94";
Target._Mission = "Convict";
Target.refreshAppearance(false, true, true);
dbClient.runQuery("UPDATE users SET punch = '0' WHERE name = '" + Target._Username + "'");
dbClient.runQuery("UPDATE users SET avoid = '1' WHERE name = '" + Target._Username + "'");
Target.sendData("D^" + "H" + Encoding.encodeVL64(7));
ThreadStart jailStarter = new ThreadStart(Target.jailTime);
Target.jailLooper = new Thread(jailStarter);
Target.jailLooper.Priority = ThreadPriority.Lowest;
Target.jailLooper.Start();
follow = null;
follow.Abort();
}
else if (slap_randomer == 1)
{
if (cop == 1)
{
iCount++;
roomBot.Z1 = Rotation.Calculate(roomBot.X, roomBot.Y, Target.roomUser.X, Target.roomUser.Y);
roomBot.Z2 = roomBot.Z1;
Next = new Coord(Target.roomUser.X - 1, Target.roomUser.Y);
roomBot.goalX = Next.X;
roomBot.goalY = Next.Y;
Thread.Sleep(200);

if ((roomBot.Y == Target.roomUser.Y && roomBot.X == Target.roomUser.X) || (roomBot.Y + 1 == Target.roomUser.Y && roomBot.X == Target.roomUser.X) || (roomBot.Y - 1 == Target.roomUser.Y && roomBot.X == Target.roomUser.X) || (roomBot.Y == Target.roomUser.Y && roomBot.X + 1 == Target.roomUser.X) || (roomBot.Y == Target.roomUser.Y && roomBot.X - 1 == Target.roomUser.X))
{
Target.roomUser.walkLock = true;
Target.roomUser.goalX = -1;
Target.Run();
sendSaying(roomBot, "*fires a stungun at " + Target._Username + "*");
if ((roomBot.Y == Target.roomUser.Y && roomBot.X == Target.roomUser.X) || (roomBot.Y + 1 == Target.roomUser.Y && roomBot.X == Target.roomUser.X) || (roomBot.Y - 1 == Target.roomUser.Y && roomBot.X == Target.roomUser.X) || (roomBot.Y == Target.roomUser.Y && roomBot.X + 1 == Target.roomUser.X) || (roomBot.Y == Target.roomUser.Y && roomBot.X - 1 == Target.roomUser.X))
{
iCount++;
roomBot.Z1 = Rotation.Calculate(roomBot.X, roomBot.Y, Target.roomUser.X, Target.roomUser.Y);
roomBot.Z2 = roomBot.Z1;
Next = new Coord(Target.roomUser.X - 1, Target.roomUser.Y);
roomBot.goalX = Next.X;
roomBot.goalY = Next.Y;
Thread.Sleep(2000);
Target.roomUser.walkLock = true;
sendSaying(roomBot, "*removes cuffs from belt and wraps around " + Target._Username + " wrists*");
Thread.Sleep(2000);
sendSaying(roomBot, "*arrests " + Target._Username + " for 5 minutes, and fines them 25 credits, for assult!*");
dbClient.runQuery("UPDATE users SET credits = credits - '25' WHERE name = '" + Target._Username + "'");
Target.refreshValueables(true, true);
dbClient.runQuery("UPDATE users SET arrested = '1', arrests = arrests + '1', time_jail = '5', working = '0' WHERE name = '" + Target._Username + "'");
Target._Figure = Target._Uni + "ch-220-94.lg-280-94.sh-290-94";
Target._Mission = "Convict";
Target.refreshAppearance(false, true, true);
dbClient.runQuery("UPDATE users SET slap = '0' WHERE name = '" + Target._Username + "'");
dbClient.runQuery("UPDATE users SET avoid = '1' WHERE name = '" + Target._Username + "'");
Target.sendData("D^" + "H" + Encoding.encodeVL64(7));
ThreadStart jailStarter = new ThreadStart(Target.jailTime);
Target.jailLooper = new Thread(jailStarter);
Target.jailLooper.Priority = ThreadPriority.Lowest;
Target.jailLooper.Start();
follow = null;
follow.Abort();
}
}
}
}
Thread.Sleep(300);
}
}
}
}
}
}
}
catch
{
Thread.CurrentThread.Abort();
follow = null;
}
}
6) Search for;
" internal void sendShout(virtualRoomUser sourceUser, string Message)" - With no quotes.
7) Open up the void, if not already opened.
Cool I CANNOT REMEMBER WHAT WAS IN THAT VOID, AS I DID THIS MONTHS BACK, BUT ADD THIS IN THE VOID IF YOU CAN;

Code:
virtualUser Target = userManager.getUser(sourceUser.userID);
{
int cop = dbClient.getInt("SELECT cop FROM roombots WHERE figure = '" + roomBot.Figure + "'");
int randomer = dbClient.getInt("SELECT punch FROM users WHERE id = '" + Target.userID + "'");
{
if (follow != null)
{
}
else
{
if (randomer == 1)
{
if (cop == 1)
{
sendShout(roomBot, "FREEZE LAPD!");
follow = new Thread(follower);
follow.Priority = ThreadPriority.Lowest;
follow.Start();
}
}
Database collums:
This may sound stupid but I never worked out a different method..

Goto users table and add a collum for;
punch
int 1
defined 0

Goto roombots table, and add a collum for;
cop
int 1
defined 0

And on your punch command add this query;

" dbClient.runQuery("UPDATE users SET punch = '1' WHERE name = '" + _Username + "'");"

Admin
Admin

Posts : 2
Join date : 2010-10-28

https://habbitforums.board-directory.net

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum