denny199 Posted January 10, 2013 Share Posted January 10, 2013 Har, Hay there. So, I was making a script, the script is attaching a object to the players vehicle, but now is my question is, how can I attach the object exactly next to the car like the image underneath without tables/other crap. Some images with my paint skilsz 0.o: Good position: Click here for image same script with bad position: Click here for image2 My script: local neondanny = { } local neondanny2 = { } addCommandHandler ( "neon", function(player) if isPedInVehicle ( player ) then car = getPedOccupiedVehicle ( player ) if (isElement ( neondanny[ car ])) then destroyElement ( neondanny[ car ] ) elseif not (isElement ( neondanny[ car ])) then neondanny[ car ] = createObject ( 2079, 0, 0, 0 ) attachElements ( neondanny[ car ], car, -1.0,0,-0.58 ) setObjectScale ( neondanny[ car ], 1.5 ) setElementCollisionsEnabled(neondanny[ car ], false) neondanny2[ car ] = createObject ( 2079, 0, 0, 0 ) attachElements ( neondanny2[ car ], car, 1.0,0,-0.58 ) setObjectScale ( neondanny2[ car ], 1.5 ) setElementCollisionsEnabled(neondanny2[ car ], false) end end end) I hope that you guys can help me. Kindly regards -Danny Link to comment
Castillo Posted January 10, 2013 Share Posted January 10, 2013 That's because each vehicle is different. Link to comment
denny199 Posted January 10, 2013 Author Share Posted January 10, 2013 So there is not a function like": getVehicleModelOffset or something like that ;p I know enough thanks. Link to comment
3NAD Posted January 10, 2013 Share Posted January 10, 2013 You can edit it 'Manually' by Model Car, Like this.. local neondanny = { } local neondanny2 = { } addCommandHandler ( "neon", function ( player ) if isPedInVehicle ( player ) then car = getPedOccupiedVehicle ( player ) if ( isElement ( neondanny[ car ]) ) then destroyElement ( neondanny[ car ] ) else neondanny[ car ] = createObject ( 2079, 0, 0, 0 ) setObjectScale ( neondanny[ car ], 1.5 ) setElementCollisionsEnabled ( neondanny[ car ], false ) neondanny2[ car ] = createObject ( 2079, 0, 0, 0 ) setObjectScale ( neondanny2[ car ], 1.5 ) setElementCollisionsEnabled(neondanny2[ car ], false) if getElementModel ( car ) == 411 then attachElements ( neondanny[ car ], car, -1.0,0,-0.58 ) attachElements ( neondanny2[ car ], car, 1.0,0,-0.58 ) elseif getElementModel ( car ) == 429 then attachElements ( neondanny[ car ], car, -1.2,0,-0.4 ) attachElements ( neondanny2[ car ], car, 0.6,0,-0.4 ) end end end end ) Link to comment
Castillo Posted January 10, 2013 Share Posted January 10, 2013 Would be easier to use a table. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now