Lock vehicle

Started by Ksna, Jul 20, 2015, 03:36 PM

Previous topic - Next topic

Ksna

I m making a race system and i used vehicle.locked function but it is not useful as it just locks from outside I saw this event Onplayerexitvehicle but i cant return him back to his own vehicle...

Sebastian

#1
onPlayerExitVehicle( player, vehicle )
{
     if( vehicle is locked )
          player.PutInVehicle( FindVehicle( vehicle ) );
}


I'm pretty sure that player.PutInVehicle is not the correct form, but @Gudio should tell you the right one.
(that one can also apply the entering animation back to car, so it will just look as normal as possible)

Honey

#2
 If you want to put someone in a vehicle you can just do player.Vehicle = FindVehicle(id);

EDIT : I think we can achieve this in a better way by simply ignoring the onplayerexitvehicle function like this :

function onplayerexitvehicle(....)
{
return 0; // Not tested
}

karan20000000000

#3
I think this is what you want to implement
function onPlayerExitVehicle(player,vehicle)
{
          if(vehicle.Locked==true) { vehicle.Locked = false; player.Vehicle = vehicle; vehicle.Locked = true; }
}
Its untested by the way.

I don't think so player.PutInVehicleSlot() would be a good idea because when the car's having speed and player tries to get out of car, this function is unable to put him back in the car.
With regards,
KP
------------------------------------------

Ksna

Thanks, topic solved