how to disable fps control for few seconds and re enable!!

hi i am wondering is there anyway when player collide with a trigger and disable fps control for a few seconds and then re enable it??

hi i am wondering is there anyway when player collide with a trigger and disable fps control for a few seconds…

You are looking for this: Wait For Seconds.

To disable running and crouching in a zone, change your RunAndCrouch script to be:

var walkSpeed: float = 7; // regular speed
var crouchSpeed: float = 3; // crouching speed
var runSpeed: float = 17; // run speed

private var chMotor: CharacterMotor;
private var ch: CharacterController;
private var tr: Transform;
private var height: float; // initial height
private var isCrouching : boolean = false;
private var isInCrouchArea : boolean = false; 
private var canCrouch : boolean = true;
private var canRun : boolean = true;

function SetRunOrCrouch(value : boolean)
{
    canRun = value;
    canCrouch = value;
}

function Start(){
    chMotor = GetComponent(CharacterMotor);
    tr = transform;
    ch = GetComponent(CharacterController);
    height = ch.height;
}

function Update(){

    var h = height;
    var speed = walkSpeed;

    if (canRun && (ch.isGrounded && Input.GetKey("left shift") || Input.GetKey("right shift"))){
        speed = runSpeed;
    }
   //Either pressing C or currently in crouch area will make us crouch
   isCrouching = Input.GetKey("c") || isInCrouchArea; 

   if(isCrouching && canCrouch) {
         h = 0.5 * height;
        speed = crouchSpeed; // slow down when crouching
   }
    chMotor.movement.maxForwardSpeed = speed; // set max speed
    var lastHeight = ch.height; // crouch/stand up smoothly 
    ch.height = Mathf.Lerp(ch.height, h, 5*Time.deltaTime);
    tr.position.y += (ch.height-lastHeight)/2; // fix vertical position
}

Then change your trigger script to be:

//attach this script to your trigger

var crouchArea : GameObject;
var Script : RunAndCrouch;

function OnTriggerEnter(other : Collider) //Check if something has entered the trigger ( and declares this object in "other" )
{
   if(other.collider.tag == crouchArea.tag) //Checks if the Player is inside the trigger
   {
      Script = other.gameObject.GetComponent(RunAndCrouch); 
      Script.SetRunOrCrouch(false);
   }
}
function OnTriggerExit(other : Collider) //Check if something has entered the trigger ( and declares this object in "other" )
{
   if(other.collider.tag == crouchArea.tag) //Checks if the Player is inside the trigger
   {
      Script = other.gameObject.GetComponent(RunAndCrouch); 
      Script.SetRunOrCrouch(true);
   }
}

That should do it. Now running and crouching are disabled in the zone.