Handbrake error

Started by Mohamed Boubekri, Sep 09, 2023, 02:09 PM

Previous topic - Next topic

Mohamed Boubekri

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.
| What now ? | Not yet ! |
Morrocan:- [ 🇲🇦 ].

Xmair

Replace
!player.Vehicle
with
!vehicle.Driver

Credits to Boystang!

VU Full Member | VCDC 6 Coordinator & Scripter | EG A/D Contributor | Developer of VCCNR | Developer of KTB | Ex-Scripter of EAD

Mohamed Boubekri

| What now ? | Not yet ! |
Morrocan:- [ 🇲🇦 ].

2b2ttianxiu

when newX, newY or newZ == 0, bool is false and the vehicle can move. but is so less problem

Gulk

Try setting the vehicle weight very high when its unoccupied.

Mohamed Boubekri

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.
| What now ? | Not yet ! |
Morrocan:- [ 🇲🇦 ].

Mohamed Boubekri

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.
| What now ? | Not yet ! |
Morrocan:- [ 🇲🇦 ].

vitovc

Quote from: Mohamed Boubekri on Oct 05, 2023, 07:14 AM
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.
https://forum.vc-mp.org/index.php?topic=4991.msg37376#msg37376
...::: vice city :::...