Jump to content

Wrong Argument!


Recommended Posts

Posted

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

If you need an Intermediate scripter feel free to PM me as I will accept "almost" any job, STATUS: UNAVAILABLE

SCOTLAND, my hometown, and the Home of GTA!

  • Moderators
Posted
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....

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

Posted

What i wan't is to check that the vehicle towing towing the bullet is id 525 (the towtruck)?

If you need an Intermediate scripter feel free to PM me as I will accept "almost" any job, STATUS: UNAVAILABLE

SCOTLAND, my hometown, and the Home of GTA!

Posted
getVehicleTowingVehicle 

Isn't that what you actually need?

How would i check the id of the car is 525?

If you need an Intermediate scripter feel free to PM me as I will accept "almost" any job, STATUS: UNAVAILABLE

SCOTLAND, my hometown, and the Home of GTA!

Posted
How would i check the id of the car is 525?
vehicle = getVehicleTowingVehicle(yourVehicle) 
      if getElementModel(vehicle) == 525 then 
              --your function 
      end 

Posted
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"?

If you need an Intermediate scripter feel free to PM me as I will accept "almost" any job, STATUS: UNAVAILABLE

SCOTLAND, my hometown, and the Home of GTA!

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

Posted

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!)

If you need an Intermediate scripter feel free to PM me as I will accept "almost" any job, STATUS: UNAVAILABLE

SCOTLAND, my hometown, and the Home of GTA!

Posted

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

  • Moderators
Posted

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 
  
  

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

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