Author Topic: is this script for my osprey ture?  (Read 735 times)

I need to know if i did this right and if i didnt could you explain how to do it?

I assume you are trying to lift the ramp for the players vehicle
You're almost there, but an easier way of doing would be getting the vehicle off %client.player
Code: [Select]
%vehicle = %client.player.getObjectMount();
But what if the player is not in a vehicle?
Code: [Select]
if(!isObject(%vehicle)
{
   messageClient(%client,'',"You are not in a vehicle");
   return;
}
Now that we know the he's in a vehicle lets toggle the ramp
Code: [Select]
if(%vehicle.rampDown)
{
   %vehicle.playThread(1,"RampUp")
}
else
{
   %vehicle.playThread(1,"RampDown")
}

Adding it all together we get
Code: [Select]
function serverCmdRamp(%client)
{
   %vehicle = %client.player.getObjectMount();
   if(!isObject(%vehicle)
   {
      messageClient(%client,'',"You are not in a vehicle");
      return;
   }
   if(%vehicle.rampDown)
   {
      %vehicle.playThread(1,"RampUp")
   }
   else
   {
      %vehicle.playThread(1,"RampDown")
   }
}

For simplicity's sake I left out things like checking if the vehicle is an osprey, spam protection, checking if the client is the driver, but I think you get the idea

this wasn't tested so there could be things wrong if there is point them out

I assume you are trying to lift the ramp for the players vehicle
You're almost there, but an easier way of doing would be getting the vehicle off %client.player
Code: [Select]
%vehicle = %client.player.getObjectMount();
But what if the player is not in a vehicle?
Code: [Select]
if(!isObject(%vehicle)
{
   messageClient(%client,'',"You are not in a vehicle");
   return;
}
Now that we know the he's in a vehicle lets toggle the ramp
Code: [Select]
if(%vehicle.rampDown)
{
   %vehicle.playThread(1,"RampUp")
}
else
{
   %vehicle.playThread(1,"RampDown")
}

Adding it all together we get
Code: [Select]
function serverCmdRamp(%client)
{
   %vehicle = %client.player.getObjectMount();
   if(!isObject(%vehicle)
   {
      messageClient(%client,'',"You are not in a vehicle");
      return;
   }
   if(%vehicle.rampDown)
   {
      %vehicle.playThread(1,"RampUp")
   }
   else
   {
      %vehicle.playThread(1,"RampDown")
   }
}

For simplicity's sake I left out things like checking if the vehicle is an osprey, spam protection, checking if the client is the driver, but I think you get the idea

this wasn't tested so there could be things wrong if there is point them out
yea donke fur all the side functions and i relly dont think any other vehicle has the ramp animations
« Last Edit: August 05, 2013, 12:21:07 PM by SuperFlaminninja »