Lloyd Logan Posted April 2, 2013 Share Posted April 2, 2013 Hey what is the argument meant to be in if ( getVehicleTowedByVehicle ( ????? ) == bullet ) then if i want it be a towtruck? e.g. towVehicles = { [525]=true } What i mean is the ????? has to be a towtruck (id 525) what do i put in there? EDIT : I TRIED if ( getVehicleTowedByVehicle ( towVehicles[getElementModel ( source )] ) == bullet ) then BUT THAT NEVER WORKED! Thanks Lloyd Link to comment
Moderators IIYAMA Posted April 2, 2013 Moderators Share Posted April 2, 2013 if ( getVehicleTowedByVehicle ( ????? ) == bullet ) then Vehicle user data should be there. (just the vehicle) = getVehicleTowedByVehicle ( vehicle ) Returns the vehicle(the wagon) behind it or false. https://wiki.multitheftauto.com/wiki/GetElementModel local model1 = getElementModel ( vehicle1 ) if towVehicles[model1] then --or if towVehicles[getElementModel ( vehicle1 )] then It works for sure. getVehicleTowedByVehicle ( towVehicles[getElementModel ( source )] ) == bullettowVehicles[getElementModel ( source )] -- boolean (true/false) getVehicleTowedByVehicle ( boolean )-- error Compare error with vehicle user data.... Link to comment
Lloyd Logan Posted April 2, 2013 Author Share Posted April 2, 2013 What i wan't is to check that the vehicle towing towing the bullet is id 525 (the towtruck)? Link to comment
DiSaMe Posted April 2, 2013 Share Posted April 2, 2013 getVehicleTowingVehicle Isn't that what you actually need? Link to comment
Lloyd Logan Posted April 2, 2013 Author Share Posted April 2, 2013 getVehicleTowingVehicle Isn't that what you actually need? How would i check the id of the car is 525? Link to comment
Ludo Posted April 2, 2013 Share Posted April 2, 2013 How would i check the id of the car is 525? vehicle = getVehicleTowingVehicle(yourVehicle) if getElementModel(vehicle) == 525 then --your function end Link to comment
Lloyd Logan Posted April 2, 2013 Author Share Posted April 2, 2013 How would i check the id of the car is 525? vehicle = getVehicleTowingVehicle(yourVehicle) if getElementModel(vehicle) == 525 then --your function end What is meant to be under "yourVehicle"? Link to comment
Ludo Posted April 2, 2013 Share Posted April 2, 2013 How would i check the id of the car is 525? vehicle = getVehicleTowingVehicle(yourVehicle) if getElementModel(vehicle) == 525 then --your function end What is meant to be under "yourVehicle"? Man, what do you want to do with your script? I didn't get it. Link to comment
Lloyd Logan Posted April 2, 2013 Author Share Posted April 2, 2013 It has to be that when the car hits the marker, it has to be towed in order for it to work (instead of driving the car there it has to be towed!) Link to comment
Ludo Posted April 2, 2013 Share Posted April 2, 2013 This will check is the vehicle that hits the marker is being towed and if it is a bullet. function checkIfTowed(element) if getElementType(element) == "vehicle" then if getVehicleTowingVehicle(element) then if getElementModel(element) == 525 then --your function end end end end addEventHandler("onMarkerHit", getRootElement(), checkIfTowed) EDIT: I used a wrong event, this one should work Link to comment
Moderators IIYAMA Posted April 2, 2013 Moderators Share Posted April 2, 2013 Note: When you hit every marker, this will be executed. The best way to solve this is by using special element id's. setElementID (element,"TOWmarker")-- when you create the marker. if getElementID(element)=="TOWmarker" then -- on marker hit 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