//Script Name: sc_on_unlock
//////////////////////////////////////////
//Created By: Genisys (Guile)
//Created On:   8/19/08
/////////////////////////////////////////
/*
This will spawn in the Super Cop on
the PC for unlocking something they
were not suppose to!
*/
////////////////////////////////////////
#include "setxp_inc"

//Main Script
void main()
{

  //Declare Major Variables
  object oPlayer = GetLastLocked();

  if(GetIsDM(oPlayer) || GetIsDMPossessed(oPlayer))
  { return; }

  object oTarget;
  object oSpawn;
  object oMe = OBJECT_SELF;
  location lTarget;
  //Unlock the object!
  SetLocked(oMe, FALSE);


//Let's ID the opener (in case it's a familiar!)
if(!GetIsPC(oPlayer))
{

 //IF It truly was an associate who attacked..
 if(GetMaster(oPlayer)!=OBJECT_INVALID)
 {
 oPlayer = GetMaster(oPlayer);
 }
 else
 {
 oPlayer = GetLastLocked();
 }

}

if(GetIsPC(oPlayer))
{

//Only Once Ever 30 Seconds!
int Do1Time = GetLocalInt(oPlayer, GetTag(OBJECT_SELF) + "SC");
if (Do1Time==TRUE) {return;}

SetLocalInt(oPlayer, GetTag(OBJECT_SELF) + "SC", TRUE);
DelayCommand(30.0, SetLocalInt(oPlayer, GetTag(OBJECT_SELF) + "SC", FALSE));


  //Penalize the player!
  //ApplyRespawnPenalty(oPlayer);

  oTarget = oPlayer;
  lTarget = GetLocation(oTarget);

  oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "supercop", lTarget);

  AssignCommand(oPlayer, ClearAllActions());

 }

//Main Script End
}