Hello, dear community!
I am working on another small script which would allowed me to actually freeze car standing on top of car trailer without using any traditional trainer menu, since on our server, we have scripthook disabled.
This is what I’ve came up with so far. But it doesn’t work and leave no errors… Could someone point me a good direction here??
local targetVehicle = GetVehiclePedIsIn(GetPlayerPed(-1), false)
local isVehicleTrailer = GetHashKey('cartr16')
local NearestCarTrailer = GetClosestVehicle(GetEntityCoords(isVehicleTrailer, true), 1000.0, 0, 4)
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if IsControlPressed(0, Keys['E']) and if IsPedInVehicle(GetPlayerPed(-1), false) then
AttachEntityToEntity(targetvehicle, NearestCarTrailer, 20, -0.5, -12.0, 1.0, 0.0, 0.0, 0.0, false, false, false, false, 20, true)
end
end
if IsControlPressed(0, 170) and IsPedInVehicle(targetVehicle) then
DetachEntity(targetVehicle, false, false)
--vehicle = nil
end
end
end)
I have been trying to find suitable car trailer and narrowed selection to two models online, but everyone has it’s pros and cons.
This first one is really great, even has detachtable ramp as an extra, but it’s buggy - you have to be in position of “driver” to be able to manipulate the ramp and sometimes, from uknown reason, you can’t get to driver seat anymore… So you can’t load your car on trailer again.
- another annoying thing is that with every car with lower profile, you will loose doors, since it has very badly placed wheel base and it’s collision with anything that’s on top of the trailer…
Problem could be theoretically solved by editing the collision data, but I am noob and can’t do that yet (this trailer is unlocked)
This second one is better, doesn’t need ramp manipulation, it hasn’t have mentioned collision problems, but car on this trailer is even more unstable that on previous one.
From this reason, I want to create some sort of very simple car trailer menu allowing to players attach the one entity to another
(that could be even allowed under condition of owning the entity as we operate with SQL database, so trolls should be eliminated by this)
Does anybody have experience with this? Any advices? Thank you for all answers in advance