Hey everyone, i want to make a system, which will prevent car from moving when no one is driving it.
function onVehicleMove( vehicle, lastX, lastY, lastZ, newX, newY, newZ )
{
if (newX && newY && newZ && !player.Vehicle)
{
vehicle.Pos.x = lastX, vehicle.Pos.y = lastY, vehicle.Pos.z = lastZ;
}
else return;
}
The problem is, that function 'onVehicleMove' does not contain 'player', so how i can detect the player ?
I get error here
if (newX && newY && newZ && !player.Vehicle)
player dosen't defined.
Replace
!player.Vehicle
with
!vehicle.Driver
Thank you.
when newX, newY or newZ == 0, bool is false and the vehicle can move. but is so less problem
Try setting the vehicle weight very high when its unoccupied.
Quote from: 2b2ttianxiu on Oct 01, 2023, 12:50 PMwhen newX, newY or newZ == 0, bool is false and the vehicle can move. but is so less problem
I have created the system & it's working great.
But it's somehow a little bit laggy, test it: https://forum.vc-mp.org/index.php?topic=9337.0
And if you have any ideas to improve lag, please share it with us.
Quote from: Gulk on Oct 01, 2023, 03:23 PMTry setting the vehicle weight very high when its unoccupied.
It's seems a good idea :p
But i think it's not real, i will be like the person who will be laugh at the players indirectly.