Jump to content

Wrong Argument!


Recommended Posts

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
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 )] ) == bullet

towVehicles[getElementModel ( source )] -- boolean (true/false)

getVehicleTowedByVehicle ( boolean )-- error

Compare error with vehicle user data....

Link to comment
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

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

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

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...