observer script/"bot"

Lyon

<b><font color="lightsteelblue">Veteran</font><fon
has anyone ever written an automated observer script/bot?
 
dajackal wrote a shoutcast observer thing a while back. some of the code might help you get started. it looks like it's a way to control an observer using remotes? i've never used it.

Code:
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//  .oooooo.    oooooooooooo    ooooo        oooooooooooo   .oooooo.    oooooooooooo ooooo      ooo oooooooooo.    oooooooooooo//
// d8P'  `Y8b  d'""""""d888'    `888'        `888'     `8  d8P'  `Y8b   `888'     `8 `888b.     `8' `888'   `Y8b  d'""""""d888'//
//888      888       .888P   +   888          888         888            888          8 `88b.    8   888      888       .888P  //
//888      888      d888'   +++  888          888oooo8    888            888oooo8     8   `88b.  8   888      888      d888'   //
//888      888    .888P      +   888          888    "    888     ooooo  888    "     8     `88b.8   888      888    .888P     //
//`88b    d88'   d888'    .P     888       o  888       o `88.    .88'   888       o  8       `888   888     d88'   d888'    .P//
// `Y8bood8P'  .8888888888P      o888ooooood8 o888ooooood8  `Y8bood8P'   o888ooooood8 o8o        `8  o888bood8P'  .8888888888P //
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//	Shoutcast v1.2 by DaJ4ck3L
//

function remoteShoutcastF(%clientId, %team, %flagorbit)
{
	%clientId.tries++;
	if(%clientId.tries > 10)
	{
		if(%clientId.gone)
		{
			return;
		}
		%name = client::getName(%clientId);
		Log::Exploit(%clientId, "Server-Crash", "remoteShoutcastF");
		banlist::add(client::getTransportAddress(%clientId), 999);
		kick(%clientId, "You Were Kicked For Spamming remoteShoutcastF");
		%clientId.gone = true;
		return;
	}
	schedule(%clientId@".tries = 0;", 0.5);
	//^^spam protection
	Shoutcast::CheckFlag(%clientId, %team, %flagorbit);
}

function remoteShoutcastP(%clientId)
{
	%clientId.tries++;
	if(%clientId.tries > 10)
	{
		if(%clientId.gone)
		{
			return;
		}
		%name = client::getName(%clientId);
		Log::Exploit(%clientId, "Server-Crash", "remoteShoutcastP");
		banlist::add(client::getTransportAddress(%clientId), 999);
		kick(%clientId, "You Were Kicked For Spamming remoteShoutcastP");
		%clientId.gone = true;
		return;
	}
	schedule(%clientId@".tries = 0;", 0.5);
	//^^spam protection
	Shoutcast::CheckPlayer(%clientId);
}

function Shoutcast::CheckFlag(%clientId, %team, %flagorbit)
{
   if(Client::getTeam(%clientId) != -1 && -1 < %team)
      return;
   
	%flag = $teamFlag[%team];
   	if(-1 < %flag.carrier)
	{
		%target = Player::getClient(%flag.carrier);
		%clientId.observerMode = "observerOrbit";
		Observer::setOrbitObject(%clientId, %target, 10, 10, 10); //give a little extra room for the capper to see what's going on around him.
		bottomprint(%clientId, "<jc>Third Person Observing " @ Client::getName(%target), 5);
		%clientId.observerTarget = %target;
	}
	else
	{
		%clientId.observerTarget = "";
		%clientId.observerMode = "observerFly"; //wish i could've orbited this, but i got lazy. maybe in update.
		Observer::setFlyMode(%clientId, Vector::add(GameBase::getPosition(%flag), "0 0 3"), GameBase::getRotation(%flag), true, true);
		bottomprint(%clientId, "<jc>Observing the " @ getTeamName(%team) @ " flag", 5);
	}
}

function Shoutcast::CheckPlayer(%clientId)
{
	if(Client::getTeam(%clientId) != -1)
		return;
	
	if(%clientId.selClient == "")
		return;
	
	if(Client::getTeam(%clientId.selClient) == -1)
		return;
	
	%target = %clientId.selClient;
	%clientId.observerMode = "observerOrbit";
	Observer::setOrbitObject(%clientId, %target, 5, 5, 5);
	bottomprint(%clientId, "<jc>Third Person Observing " @ Client::getName(%target), 5);
	%clientId.observerTarget = %target;
	Client::cancelMenu(%clientId);
}
 
Back
Top