When I load the object normally in the object has collision. But when I attach it to my car with a marker it has no collision whatsoever so I know it's a scripting error of mine.
I have the following 2 script files:
client.lua:
setCloudsEnabled ( false )
function objects ()
local capt_rail_col = engineLoadCOL("capt_rail.col")
engineReplaceCOL(capt_rail_col, 1339)
local capt_rail = engineLoadDFF('capt_rail.dff', 0)
engineReplaceModel(capt_rail, 1339)
local hook_col = engineLoadCOL("hook.col")
engineReplaceCOL(hook_col, 1337)
local hook = engineLoadDFF('hook.dff', 0)
engineReplaceModel(hook, 1337)
end
addEventHandler( "onClientResourceStart", getResourceRootElement(getThisResource()), objects )
marker.lua:
local marker = createMarker(2449,-1657,12.948616027832,"corona",4,230,230,230,230)
local objectAttached = nil
function markerHit (hitPlayer, match)
if (source == marker) and match and hitPlayer == localPlayer then
if not objectAttached then
local vehicle = getPedOccupiedVehicle ( localPlayer )
if vehicle then
local object = createObject(1337, 0,0,0)
setElementDoubleSided ( object, true )
attachElements(object, vehicle, 0, 0, 0.7, 0, 0, 0)
objectAttached = true
end
end
end
end
addEventHandler("onClientMarkerHit", root, markerHit)
Thanks in advance!