Need Help with Another Command

Like I mentioned in the LAN server, I was working on a /pick command for doors

It works...mostly except the doors close instantly after they open (0 Sec Timeout) No matter what the timeout is set to
function ccpick(%sender, %args){
   %pos        = %sender.player.getMuzzlePoint($WeaponSlot);
   %vec        = %sender.player.getMuzzleVector($WeaponSlot);
   %targetpos  = vectoradd(%pos,vectorscale(%vec,10));
   %obj        = containerraycast(%pos,%targetpos,$typemasks::staticshapeobjecttype,%sender.player);
   %obj        = getword(%obj,0);
   %dataBlock  = %obj.getDataBlock();
   %className  = %dataBlock.className;
   %DBname	   = %datablock.getName();
   %rand = getRandom(5 - 1) + 1;
   if(%args $= "help"){
	messageClient(%sender, 'MsgClient', "\c2To pick, you need skill and luck.. repeat /pick until a lock is hit.");
	return;
   }
   if (!isobject(%obj)) {
      messageclient(%sender, 'MsgClient', '\c5No Lock to Pick In Range.');
      return;
   }
   if (%DBname !$= "DeployedDoor") {
      messageclient(%sender, 'MsgClient', '\c5Not A Door Moron....');
      return;
   }
     switch(%rand) {
     case 1: %pickluck = 1;
     case 2: %pickluck = 0;
     case 3: %pickluck = 0;
     case 4: %pickluck = 0;
     case 5: %pickluck = 0;
     default: %pickluck = 0;
     }
     if(%pickluck == 1)
     {
     if(%obj.numpicked != 5) {
	 messageClient(%sender, 'MsgClient', "\c2Pillon Picked, "@(5 - %obj.numpicked)@" pillons left.");
     %obj.numpicked ++;
     }
		if(%obj.numpicked == 5){
        %obj.numpicked = 1;
        open(%obj);
        messageClient(%sender, 'MsgClient', "\c2You have picked this lock, Hurry Before It Closes!.");
        return;
        }
     }
     else
     {
        messageClient(%sender, 'MsgClient', "\c2You Missed The Pilon, Try Again.");
     }
}

Here is the Code to my /pick command.. Do any of you know how I could fix this issue?

Comments

Sign In or Register to comment.