Phiilip~* Posted December 5, 2012 Posted December 5, 2012 Hey guys Help me pls How I make for a Truck spawn with a Trailer attached? "Petrotr" for example... I know the function attachTrailerToVehicle But, I failed to use it (and I'm noob in Script ) Someone could help me do it? Thanks
Sparrow Posted December 5, 2012 Posted December 5, 2012 function attachTrailerToMyTruck() local x, y, z = getElementPosition(source) local vehicle = createVehicle(vehicleID, x, y, z) local trailer = createVehicle(trailerID, x, y+5, z) warpPedIntoVehicle(source, vehicle) attachTrailerToVehicle(trailer, vehicle) end addCommandHandler("createTruck", attachTrailerToMyTruck)
Anderl Posted December 5, 2012 Posted December 5, 2012 function attachTrailerToMyTruck() local x, y, z = getElementPosition(source) local vehicle = createVehicle(vehicleID, x, y, z) local trailer = createVehicle(trailerID, x, y+5, z) warpPedIntoVehicle(source, vehicle) attachTrailerToVehicle(trailer, vehicle) end addCommandHandler("createTruck", attachTrailerToMyTruck) local vehicleID = 353; local trailerID = 653; addCommandHandler( "createtruck", function( player ) local nX, nY, nZ = getElementPosition( player ); local pVehicle = createVehicle( vehicleID, nX, nY, nZ ); local pTrailer = createVehicle( trailerID, nX, nY + 5, nZ ); warpPedIntoVehicle( player, pVehicle ); attachTrailerToVehicle( pTrailer, pVehicle ); end )
Phiilip~* Posted December 5, 2012 Author Posted December 5, 2012 function attachTrailerToMyTruck() local x, y, z = getElementPosition(source) local vehicle = createVehicle(vehicleID, x, y, z) local trailer = createVehicle(trailerID, x, y+5, z) warpPedIntoVehicle(source, vehicle) attachTrailerToVehicle(trailer, vehicle) end addCommandHandler("createTruck", attachTrailerToMyTruck) Thanks man, but, I don't want command to spawn it, my idea is when start my map, the players spawn with a truck and a trailer attached them
Sparrow Posted December 5, 2012 Posted December 5, 2012 it's almost the same, just you need: local vehicle = createVehicle(vehicleID, x, y, z) local trailer = createVehicle(trailerID, x, y+5, z) warpPedIntoVehicle(source, vehicle) attachTrailerToVehicle(trailer, vehicle) change (x, y, z) with coordonates where the vehicle will be spawned when you start a map, same for vehicleID and trailerID. also remeber to change 'source' with element that you use
Phiilip~* Posted December 5, 2012 Author Posted December 5, 2012 also remeber to change 'source' with element that you use Sorry, I don't understand this :z and what element I'll use? I don't know anything about script
Tete omar Posted December 6, 2012 Posted December 6, 2012 Read this https://wiki.multitheftauto.com/wiki/Scr ... troduction anything hard you face , then post it and we'll help you.
Kenix Posted December 6, 2012 Posted December 6, 2012 also remeber to change 'source' with element that you use Sorry, I don't understand this :z and what element I'll use? I don't know anything about script viewtopic.php?f=148&t=40809 https://wiki.multitheftauto.com/wiki/Scr ... troduction
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