BrooklyN# Posted November 1, 2012 Share Posted November 1, 2012 Hi , I'm making one map and the spawn is a truck, and I want this truck spawn with a Trailer (Petrotr) linked It's possible? If yes, how? Link to comment
BrooklyN# Posted November 1, 2012 Author Share Posted November 1, 2012 (edited) attachTrailerToVehicle Thanks man Edited November 1, 2012 by Guest Link to comment
BrooklyN# Posted November 1, 2012 Author Share Posted November 1, 2012 The truck with the trailer is attached successfully, but not spawnpoint as I wanted.. How i do the player spawn in this vehicle? Link to comment
Anderl Posted November 1, 2012 Share Posted November 1, 2012 spawnPlayer warpPedIntoVehicle Link to comment
BrooklyN# Posted November 2, 2012 Author Share Posted November 2, 2012 I try this: for i, vehicle in ipairs(getElementsByType("vehicle"))do if vehicle then if(getVehicleName(vehicle) == "Roadtrain")then local trailer = createVehicle(435, 3469.1201171875, -1544.19921875, 4.9000000953674) if trailer then attachTrailerToVehicle(vehicle, trailer) end end end end but, I spawn just with the Trailer ._. and I want spawn with the Truck attached with the Trailer Help me Link to comment
Dev Posted November 2, 2012 Share Posted November 2, 2012 Try this. addCommandHandler('trailer', function( thePlayer ) if ( thePlayer ) then local x, y, z = getElementPosition( thePlayer ) local truck = createVehicle( 515, 0, 0, 3 ) if ( truck ) then setElementPosition( truck, x + 5, y, z ) local trailer = createVehicle( 435, 0, 0, 3 ) if ( trailer ) then setElementFrozen( trailer, true ) local success = attachTrailerToVehicle( truck, trailer) if ( success ) then setElementFrozen( trailer, false ) outputChatBox('Trailer attached to the Truck.', thePlayer ) end end end end end ) Link to comment
BrooklyN# Posted November 3, 2012 Author Share Posted November 3, 2012 Try this. addCommandHandler('trailer', function( thePlayer ) if ( thePlayer ) then local x, y, z = getElementPosition( thePlayer ) local truck = createVehicle( 515, 0, 0, 3 ) if ( truck ) then setElementPosition( truck, x + 5, y, z ) local trailer = createVehicle( 435, 0, 0, 3 ) if ( trailer ) then setElementFrozen( trailer, true ) local success = attachTrailerToVehicle( truck, trailer) if ( success ) then setElementFrozen( trailer, false ) outputChatBox('Trailer attached to the Truck.', thePlayer ) end end end end end ) Error: Attemp to perform arithmetic on local 'x' (a boolean value) Warning: Bad argument @ 'getElementPosition' And I don't want command, I want the map to start with the truck and trailer attached, like a spawnpoint 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