Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: Mohamed Boubekri on Sep 09, 2023, 02:09 PM

Title: Handbrake error
Post by: Mohamed Boubekri on Sep 09, 2023, 02:09 PM
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.
Title: Re: Handbrake error
Post by: Xmair on Sep 09, 2023, 05:15 PM
Replace
!player.Vehicle
with
!vehicle.Driver
Title: Re: Handbrake error
Post by: Mohamed Boubekri on Sep 09, 2023, 05:51 PM
Thank you.
Title: Re: Handbrake error
Post by: 2b2ttianxiu on Oct 01, 2023, 12:50 PM
when newX, newY or newZ == 0, bool is false and the vehicle can move. but is so less problem
Title: Re: Handbrake error
Post by: Gulk on Oct 01, 2023, 03:23 PM
Try setting the vehicle weight very high when its unoccupied.
Title: Re: Handbrake error
Post by: Mohamed Boubekri on Oct 05, 2023, 07:09 AM
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.
Title: Re: Handbrake error
Post by: 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.
Title: Re: Handbrake error
Post by: vitovc on Oct 05, 2023, 09:58 AM
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