Author Topic: Making a player leave a vehicle  (Read 3714 times)

Hey BLF. Ive been trying to solve this all morning.
%db.doDismount(%player);
where %db is %player.getDataBlock();

This makes the player leave the vehicle but they still control the vehicle.
Does anyone know any ways of /title?

See here
« Last Edit: July 05, 2014, 09:45:28 PM by swatman64 »

Player::unMount( )

EDIT: there's a better way apparently

%player.getDatablock().doDismount( %player, 1 )
« Last Edit: July 05, 2014, 04:27:21 PM by Zapk² »

Erm, that still doesn't fix my problem. Both methods do not release the control of the vehicle

try doing %player.setControlObject( %player );

Alright heres the problem, if I enter
%player.setControlObject(%player)
in the console it works perfectly. But when I enter it in script
Code: [Select]
%db.doDismount(%player, 1);
%player.setControlObject(%player);
it does nothing, I also tried
Code: [Select]
%db.doDismount(%player, 1);
%template = %player @ ".setControlObject(" @ %player @ ");";
eval(%template);
echo(%template);
It echoed "12827.setControlObject(12827);"
yet it does nothing. I tried copying and pasting that statement into the console and It worked fine. So what the hell is happening!
« Last Edit: July 05, 2014, 09:42:50 PM by swatman64 »

Where is %player being defined? post full code

I'm pretty sure you should be using %client.setControlObject(%player);.

I'm pretty sure you should be using %client.setControlObject(%player);.
that doesn't seem to work at all. But my problem still stands.

package driverslicense
{
   function Armor::onMount(%this, %player, %col, %mountObj, %unknownB)
   {
      %db = %player.getdatablock();
      %client = %player.client;
      if(cityRPGData.getData(%client.getBlid()).valueCanDrive)
      return parent::OnMount(%this, %player, %col, %mountObj, %unknownB);
      messageclient(%client, '', "\c6You need a Drivers License!");
      %db.doDismount(%player, 1);
      %template = %player @ ".setControlObject(" @ %player @ ");";
      eval(%template);
      echo(%template);
      echo("SetControllObject set");
      return;
   }
};
activatePackage(driverslicense);

Why are you using eval? There's literally no purpose for using eval there, it's just going to make your code run slower...

Why are you using eval? There's literally no purpose for using eval there, it's just going to make your code run slower...
he was doing it as a debugging technique. it would echo the command first and then attempt to eval it. if you read the rest of the thread you'd know that it isn't his intention to use eval in the final version/nondebug version

Why are you using eval? There's literally no purpose for using eval there, it's just going to make your code run slower...
What valcle said.

Bump even though this topic is slow as hell

Use trace and then exit a vehicle.


Use trace and then exit a vehicle.
I did this only to find Armor::OnMount originally. I also foujd .doDismount like this.