S3M Posted January 8, 2013 Share Posted January 8, 2013 (edited) Is it possible to use the vehicle in which a player is to glue on a moving object? like the resource: player on vehicle glued https://community.multitheftauto.com/index.php?p=profile&id=502 Need it for fix this: grtz Edited January 8, 2013 by Guest Link to comment
Castillo Posted January 8, 2013 Share Posted January 8, 2013 Should be possible, yes. Link to comment
myonlake Posted January 10, 2013 Share Posted January 10, 2013 I made my own attachment script so, that when you drive a vehicle on a marker on a ship and type a command, it will be attached to the marker. The marker is attached to the ship. When you drive, the marker is attached to the ship and the car is still glued to the marker. It's simple. Link to comment
S3M Posted January 16, 2013 Author Share Posted January 16, 2013 I made my own attachment script so, that when you drive a vehicle on a marker on a ship and type a command, it will be attached to the marker. The marker is attached to the ship. When you drive, the marker is attached to the ship and the car is still glued to the marker. It's simple. Ah oke nice idea THX, i gonna try that. Link to comment
S3M Posted January 16, 2013 Author Share Posted January 16, 2013 I made my own attachment script so, that when you drive a vehicle on a marker on a ship and type a command, it will be attached to the marker. The marker is attached to the ship. When you drive, the marker is attached to the ship and the car is still glued to the marker. It's simple. You use server side only? Thx Link to comment
myonlake Posted January 16, 2013 Share Posted January 16, 2013 Of course. It wouldn't be synchronized client-side. Link to comment
S3M Posted January 16, 2013 Author Share Posted January 16, 2013 I got this. Working almost, only after detach the vehicle fall through object. local vehicleHydra = createVehicle ( 520, -1409.5, 496.0, 11.9, 0, 0, 358.99487304688 ) local vehicleHydra2 = createVehicle ( 520, -1419.5, 496.0, 11.9, 0, 0, 358.99487304688 ) local deckMarker1 = createMarker ( -1410.3000488281, 506.79998779297, 10, "cylinder", 4, 255, 0, 0, 50 ) local deck1 = createObject( 3114, -1414.4000244141, 505, 9.65, 0, 0, 0.2445068359375) addEventHandler("onResourceStart", gResRoot, function () setElementData ( deck1, "pos", "ground" ) attachElements ( deckMarker1, deck1, 5, 0, 0 ) function attach1 ( hitElement, deckMarker1 ) if ( getElementType( hitElement ) == "vehicle" ) then attachElements ( hitElement, deck1, 5, 0, 2.37 ) end end addEventHandler ( "onMarkerHit", deckMarker1, attach1 ) end ) addCommandHandler("dck", function () if getElementData( deck1, "pos") == "ground" then moveObject( deck1, 5000, -1414.4000244141, 520.90002441406, 9.7) setElementData( deck1, "pos", "top") else moveObject( deck1, 6000, -1414.4000244141, 505, 9.7) setElementData( deck1, "pos", "ground") end end ) function detach ( thePlayer, commandName ) local pVehicle = getPedOccupiedVehicle( thePlayer ) detachElements ( pVehicle, deck1 ) end addCommandHandler ( "detach", detach ) Link to comment
DarkLink Posted January 16, 2013 Share Posted January 16, 2013 I'm away from mta scripting for a long time, but I am sure that the problem is because that your object doesnt have collision shape. You need to do it with another object, or try to make a custom collision shape to that object (dont know if its possible..) Good luck Link to comment
psydomin Posted January 16, 2013 Share Posted January 16, 2013 try lifting the vehicle a few inches from the moving object so that it reenters the colshape of the object. Should solve it Link to comment
myonlake Posted January 17, 2013 Share Posted January 17, 2013 try lifting the vehicle a few inches from the moving object so that it reenters the colshape of the object. Should solve it Exactly. Try to lift it with the setElementPosition function. Link to comment
Hyunsu Posted January 17, 2013 Share Posted January 17, 2013 Like psydomin said, The problem is the lifting object don't have collision like grass, leaves of trees. (I will say a above object "A".) So, you can attach object (that imitates collision of A) to A. The collision of the attached object should be similer to "A". And you can hide the attaced object by using "setElementAlpha()". If the object in video have collision, your ped and your vehicle can stand up the object. Link to comment
3NAD Posted January 17, 2013 Share Posted January 17, 2013 vehicleHydra = createVehicle ( 520, -1409.5, 496.0, 11.9, 0, 0, 358.99487304688 ) vehicleHydra2 = createVehicle ( 520, -1419.5, 496.0, 11.9, 0, 0, 358.99487304688 ) deckMarker1 = createMarker ( -1410.3000488281, 506.79998779297, 10, "cylinder", 4, 255, 0, 0, 50 ) deck1 = createObject ( 3114, -1414.4000244141, 505, 9.65, 0, 0, 0.2445068359375 ) deck2 = createObject ( 3114, -1414.4000244141, 505, 8.5, 0, 0, 0.2445068359375 ) setElementAlpha ( deck2, 0 ) attachElements ( deckMarker1, deck1, 5, 0, 0 ) canMove = false addEventHandler ( "onMarkerHit", deckMarker1, function ( hitElement ) if ( getElementType( hitElement ) == "vehicle" ) then attachElements ( hitElement, deck1, 5, 0, 2.37 ) end end , false ) addCommandHandler ( "dck", function ( thePlayer ) if not canMove then moveObject ( deck1, 5000, -1414.4000244141, 520.90002441406, 9.7 ) moveObject ( deck2, 5000, -1414.4000244141, 520.90002441406, 9 ) canMove = true else moveObject ( deck1, 6000, -1414.4000244141, 505, 9.7 ) moveObject ( deck2, 5000, -1414.4000244141, 520.90002441406, 9 ) canMove = false end end ) addCommandHandler ( "detach", function ( thePlayer ) local pVehicle = getPedOccupiedVehicle ( thePlayer ) detachElements ( pVehicle, deck1 ) end ) Link to comment
S3M Posted January 17, 2013 Author Share Posted January 17, 2013 vehicleHydra = createVehicle ( 520, -1409.5, 496.0, 11.9, 0, 0, 358.99487304688 ) vehicleHydra2 = createVehicle ( 520, -1419.5, 496.0, 11.9, 0, 0, 358.99487304688 ) deckMarker1 = createMarker ( -1410.3000488281, 506.79998779297, 10, "cylinder", 4, 255, 0, 0, 50 ) deck1 = createObject ( 3114, -1414.4000244141, 505, 9.65, 0, 0, 0.2445068359375 ) deck2 = createObject ( 3114, -1414.4000244141, 505, 8.5, 0, 0, 0.2445068359375 ) setElementAlpha ( deck2, 0 ) attachElements ( deckMarker1, deck1, 5, 0, 0 ) canMove = false addEventHandler ( "onMarkerHit", deckMarker1, function ( hitElement ) if ( getElementType( hitElement ) == "vehicle" ) then attachElements ( hitElement, deck1, 5, 0, 2.37 ) end end , false ) addCommandHandler ( "dck", function ( thePlayer ) if not canMove then moveObject ( deck1, 5000, -1414.4000244141, 520.90002441406, 9.7 ) moveObject ( deck2, 5000, -1414.4000244141, 520.90002441406, 9 ) canMove = true else moveObject ( deck1, 6000, -1414.4000244141, 505, 9.7 ) moveObject ( deck2, 5000, -1414.4000244141, 520.90002441406, 9 ) canMove = false end end ) addCommandHandler ( "detach", function ( thePlayer ) local pVehicle = getPedOccupiedVehicle ( thePlayer ) detachElements ( pVehicle, deck1 ) end ) Thx, the vehicle dont fall through anymore. Only i can use the attach functie 1 time, the second vehicle don't attach only if i restart resource. Link to comment
3NAD Posted January 17, 2013 Share Posted January 17, 2013 Create another Marker, With Another Event And Function. Link to comment
S3M Posted January 18, 2013 Author Share Posted January 18, 2013 Create another Marker, With Another Event And Function. It's fix thx all for reactions thx 3NAD. 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