Jump to content

Bad argument @ 'getVehicleType'


Recommended Posts

Hello guys! I have a little problem. The script works, but the only problem is that it spams the debugscript with this message:

Bad argument @ 'getVehicleType'

  
local vehicle = getPedOccupiedVehicle(localPlayer) 
            if getVehicleType(vehicle) == "Automobile" or getVehicleType(vehicle) == "Monster Truck" then 
                dxDrawImage( zero_x-10, zero_y-10, 18, 18, "blips/jarmu.png", 360 ) 
            elseif getVehicleType(vehicle) == "Plane" then 
                dxDrawImage( zero_x-10, zero_y-10, 18, 18, "blips/repulo.png", 360 ) 
            elseif getVehicleType(vehicle) == "Bike" or getVehicleType(vehicle) == "Quad" then 
                dxDrawImage( zero_x-10, zero_y-10, 18, 18, "blips/motor.png", 360 ) 
            elseif getVehicleType(vehicle) == "Helicopter" then 
                dxDrawImage( zero_x-10, zero_y-10, 18, 18, "blips/helikopter.png", 360 ) 
            elseif getVehicleType(vehicle) == "Boat" then 
                dxDrawImage( zero_x-10, zero_y-10, 18, 18, "blips/hajo.png", 360 ) 
            elseif getVehicleType(vehicle) == "BMX" then 
                dxDrawImage( zero_x-10, zero_y-10, 18, 18, "blips/bicikli.png", 360 ) 
            elseif getVehicleType(vehicle) == "Helicopter" then 
                dxDrawImage( zero_x-10, zero_y-10, 18, 18, "blips/helikopter.png", 360 ) 
            else 
                local player_rx, player_ry, player_rz = getElementRotation( localPlayer ) 
                dxDrawImage( zero_x-10, zero_y-10, 18, 18, "blips/2.png", 360-player_rz ) 
            end 
  

What's the problem? As I said the script works perfectly, but why does it spams debugscript?

Link to comment

Try this:

  
            local vehicle = getPedOccupiedVehicle(localPlayer) 
            if ( vehicle ) then 
                local t = getVehicleType ( vehicle ):lower ( ) 
                if ( t == "automobile" or t == "monster truck") then 
                    dxDrawImage( zero_x-10, zero_y-10, 18, 18, "blips/jarmu.png", 360 ) 
                elseif ( t == "plane" ) then 
                    dxDrawImage( zero_x-10, zero_y-10, 18, 18, "blips/repulo.png", 360 ) 
                elseif ( t == "quad" or t == "bike" ) then 
                    dxDrawImage( zero_x-10, zero_y-10, 18, 18, "blips/motor.png", 360 ) 
                elseif ( t == "helicopter" ) then 
                    dxDrawImage( zero_x-10, zero_y-10, 18, 18, "blips/helikopter.png", 360 ) 
                elseif ( t == "boat" ) then 
                    dxDrawImage( zero_x-10, zero_y-10, 18, 18, "blips/hajo.png", 360 ) 
                elseif ( t == "bmx" ) then 
                    dxDrawImage( zero_x-10, zero_y-10, 18, 18, "blips/bicikli.png", 360 ) 
                else 
                    local player_rx, player_ry, player_rz = getElementRotation( localPlayer ) 
                    dxDrawImage( zero_x-10, zero_y-10, 18, 18, "blips/2.png", 360-player_rz ) 
                end 
            end 
      

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