TanguyOrtegat / esx_jb_advanced_truck_inventory

19 stars 36 forks source link

Some features #8

Open EGUltraTM opened 6 years ago

EGUltraTM commented 6 years ago

Hi and Thanks for the work.

This trunkscript isnt being updated and worked on anymore. https://github.com/IndianaBonesUrMom/ESX_Vehicletrunk

Maybe you could take there the detect trunk and fix it on your side. Cause on your script when you stand behind the car on the trunk it doesnt open. You need to stand in the "middle" of the car to get it work.

Here he simply uses a dirty workaround to move the point from the middle to an amount of meters back. This way you can press there

`function getAnusVector(entity) local hr = GetEntityHeading(entity) - 90.0 if hr < 0.0 then hr = 360.0 + hr end hr = hr 0.0174533 return { x = math.cos(hr) Config.VecOffset, y = math.sin(hr) * Config.VecOffset } end

function IsDistanceOk() local c = GetEntityCoords(GetPlayerPed(-1)) local f = getAnusVector(currentVehicle) local x, y, z = table.unpack(GetEntityCoords(currentVehicle)) x = x + f.x y = y + f.y return GetDistanceBetweenCoords(c, x, y, z, true) <= Config.MaxDistance end`

in the config:

Config.VecOffset = 2.5 --how much behind the car trunk is located. Very cheap way of accomplishing the goal

Greetings.

TanguyOrtegat commented 5 years ago

thanks for the research! but like you said noramlly won't update it anymore, i think if i looked back to my code i woould restart everything from 0 bcause it's coded like shit :')