Jump to content

Attaching offset help.


denny199

Recommended Posts

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

attachelementoff.png

same script with bad position:

Click here for image2

attachelementoff1.png

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...