//=============================================================================
// Do not compile me! (Class dependancies etc)
//
// This is an example of triggering via the convo - when this class is
// triggered, the player who triggered it via the conversation will be made
// into a cop.
//
// This is a good way of having your own custom code called without having to
// rebuild MPConvo.
//=============================================================================
class JoinPoliceTrigger extends Triggers;

var PoliceCrimeMon PCM;
Var AlliancesHandler AH;

function BeginPlay()
{
	local PoliceCrimeMon PCMM;
	local AlliancesHandler AHH;

	foreach AllActors(Class'PoliceCrimeMon',PCMM)
	{
		PCM=PCMM;
	}

	foreach AllActors(Class'AlliancesHandler',AHH)
	{
		AH=AHH;
	}

	Super.BeginPlay();
}

function Trigger( actor Other, pawn EventInstigator )
{
	local int i;
	local int k;

	if(EventInstigator.IsA('Human'))
	{
		for (i=1; i<20; i++)
		{
			if(Human(EventInstigator) == PCM.PlayerCop[i])
			{
				return;
			}
		}

		for (k=1; k<20; k++)
		{
			if(PCM.PlayerCop[k] == None)
			{
				PCM.PlayerCop[k] = Human(EventInstigator);
				AH.NewAlliance(DeusExPlayer(EventInstigator), 'Cop');
				DeusExPlayer(EventInstigator).Clientmessage("|p2Good job. Return to the van to complete your initiation.");
				return;
			}
		}
	}
}

defaultproperties
{
     Texture=Texture'Engine.S_Trigger'
}
