Thread: Mount
View Single Post
  #1  
Old 12-23-2015, 01:33 PM
Kirko Kirko is offline
Registered Guest
Join Date: Dec 2014
Location: Texas
Posts: 61
Kirko is a jewel in the roughKirko is a jewel in the rough
Mount

So I've been working on a 2 person mount script but having trouble with the passenger sticking to the driver. When the driver is inbetween two levels on a gmap the passenger will begin warping all over the place and when I enter a new level, the passenger will stay in previous level. I was lucky to get some help by a few individuals and fix some of my crappy scripting but I still can't seem to fix these problems.

Here is the portion that involves the passenger.
PHP Code:
function onActionServerSide(cmd){
  switch(
cmd){   
    case 
"unFollow":
      
temp.pl findplayer(params[1]);
      
temp.pl.clientr.passenger_driver null;
      
temp.pl.clientr.driver null;
            
      
clientr.passenger_driver null;
      
clientr.driver null;
      break;

    case 
"warpPlayer":
      
temp.pl findplayer(player.clientr.driver);
      
player.setlevel2(temp.pl.level.nameplayer.xplayer.x);
      break;
  }
}


//#CLIENTSIDE
function onCreated(){
  
hideInviteIcon();
  if(
clientr.passenger_driver != null || clientr.driver != null)
    
onLeave();
}

function 
onActionClientSide(temp.cmd){
  switch(
cmd){
    case 
"follow":
      
this.following findplayer(clientr.driver);
      
onTimeOut();
      break;

    case 
"unFollow":
      
onLeave();
      break;
      
    default:
      break;
  }
}

function 
onTimeOut(){
  
temp.pl findplayer(clientr.driver);
  if(
temp.pl == null) return onLeave();
  if(
clientr.driver != null){
    
moveToDriver();
    
setTimer(0.05);
  }else{
    
onLeave();
  }
}

function 
moveToDriver(){
  
temp.driverAccount findPlayer(clientr.driver);
  
player.dir temp.driverAccount.dir;
  if(
player.level.name != temp.driverAccount.level.name){
    if(!(
this.lastUsed timevar2 )) {
      
triggerserver("weapon"this.name"warpPlayer");
      
player.chat "forcewarp";
      
this.lastUsedtimevar2 5;
    }
  }
  
player.temp.driverAccount.vecx(temp.driverAccount.dir) * 2;
  
player.temp.driverAccount.vecy(temp.driverAccount.dir) * 2;
}

function 
onLeave(){
  
temp.driverAccount findPlayer(clientr.driver);
  
player.temp.driverAccount.x;
  
player.temp.driverAccount.y;

  
this.timeout 0;
  if(
clientr.driver != null)
    
triggerserver("gui"this.name"unFollow"this.following);
  else
    
triggerserver("gui"this.name"unFollow"passenger_driver);
  
this.following null;
}

function 
GraalControl.onKeyDown(temp.keycodetemp.keystringtemp.scancode) {
  switch (
temp.keycode) {
    case 
VK_A:
      if(
clientr.driver != null)
        
onLeave();
      break;
  }

Reply With Quote