Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supporting setVehicleHandling on the client side, for vehicles created on the server side. (Custom vehicles, engineRequestModel) #2427

Closed
ZbyK77 opened this issue Nov 2, 2021 · 5 comments · Fixed by #2501 or #2824 · May be fixed by #2533
Labels
enhancement New feature or request

Comments

@ZbyK77
Copy link

ZbyK77 commented Nov 2, 2021

Is your feature request related to a problem? Please describe.

To create a vehicle with a custom ID (engineRequestModel), you need to create the vehicle on the server side, then change the model on the client side. Unfortunately, changing the model resets the handling of the vehicle, and it is not possible to change the handling through the client side, so handling cannot be set for a custom vehicle.

Describe the solution you'd like
Adding the ability to edit handling on the client side for vehicles created on the server side.

Describe alternatives you've considered
I used this solution which doesnt work for setVehicleHandling due to the described problem.

-- c-side
local v1,v2 = getVehicleVariant(source)
local handling = getVehicleHandling(source)
setElementModel(source,4542)
setVehicleVariant(source,v1,v2) -- return true, and I wish the setVehicleHandling function would work like this.
for i,v in pairs(handling) do
	setVehicleHandling(source,i,v) -- return false, because the vehicle is created on the server side. :(
end
@ZbyK77 ZbyK77 added the enhancement New feature or request label Nov 2, 2021
@Brian9221
Copy link

I think this is more a bug than an enhancement, in fact MTA team has fixed some incompatibility between server-clients to the new models related to door sync.

@LightSrc
Copy link

LightSrc commented Dec 5, 2021

I have also encountered this problem. I hope that dev team are aware of this bug and will find solution soon.

@Inder00
Copy link
Contributor

Inder00 commented Jan 5, 2022

  • If we change the vehicle on the client side using setElementModel it resets the vehicle handling.
  • If we change the vehicle on the client side and then set the handling everything works fine.

@ZbyK77
Copy link
Author

ZbyK77 commented Jan 5, 2022

I would like to point out that it is about changing the handling on the client's side, when the vehicle is created on the server side.

  • If we change the vehicle on the client side using setElementModel it resets the vehicle handling.

Everything is correct here, when we change the model, the handling resets.

  • If we change the vehicle on the client side and then set the handling everything works fine.

But when we want to change handling later, we can't do it (c-side).

Example:

-- client side
addCommandHandler("handling_client",function(cmd)
	local veh = getPedOccupiedVehicle(localPlayer) -- Currently: Infernus (411)
	if veh then
		local ori_hand = getVehicleHandling(veh) -- return mass: 1400
		setElementModel(veh,410) -- true
		local bf_hand = getVehicleHandling(veh) -- return mass: 1000
		local ret = setVehicleHandling(veh,"mass",500) -- return false
		local af_hand = getVehicleHandling(veh) -- return mass: 1000 (It should: 500)
		iprint(cmd,veh,ori_hand.mass,bf_hand.mass,ret,af_hand.mass)
	end
end)

Return:
[2022-01-05 23:43:23] INFO: "handling_client" elem:vehicle[Manana]0000961D 1400 1000 false 1000

Handling will change only when we do it on the server side.
image
(setVehicleHandling)

@Inder00
Copy link
Contributor

Inder00 commented Jan 5, 2022

I would like to point out that it is about changing the handling on the client's side, when the vehicle is created on the server side.

  • If we change the vehicle on the client side using setElementModel it resets the vehicle handling.

Everything is correct here, when we change the model, the handling resets.

  • If we change the vehicle on the client side and then set the handling everything works fine.

But when we want to change handling later, we can't do it (c-side).

Example:

-- client side
addCommandHandler("handling_client",function(cmd)
	local veh = getPedOccupiedVehicle(localPlayer) -- Currently: Infernus (411)
	if veh then
		local ori_hand = getVehicleHandling(veh) -- return mass: 1400
		setElementModel(veh,410) -- true
		local bf_hand = getVehicleHandling(veh) -- return mass: 1000
		local ret = setVehicleHandling(veh,"mass",500) -- return false
		local af_hand = getVehicleHandling(veh) -- return mass: 1000 (It should: 500)
		iprint(cmd,veh,ori_hand.mass,bf_hand.mass,ret,af_hand.mass)
	end
end)

Return: [2022-01-05 23:43:23] INFO: "handling_client" elem:vehicle[Manana]0000961D 1400 1000 false 1000

Handling will change only when we do it on the server side. image (setVehicleHandling)

The pull request I created fixes a bug that was causing the handling resets.
The setVehicleHandling functionality on vehicles created by the server from the client side enables PR #1935

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment