Jump to content

Bad argument @ 'getElementModel'


saluta

Recommended Posts

Spoiler

function getVehicleInformation ()
	
	local vehicle = getPedOccupiedVehicle(localPlayer)
76-->>>>>>>	if vehiclesNoEngine[ getElementModel(vehicle) ] then
	    setVehicleEngineState(vehicle, true)
	    return false
	end
	
    if isPedInVehicle(localPlayer) and getPedOccupiedVehicleSeat(localPlayer) == 0 and getKeyState(e_KEY) then
        return true
	else
	    return false
	end
end

76 line error

Error if vehiclesNoEngine [ getElementModel (vehicle) ] then

Spoiler

spacer.png

 

Link to comment

getPedOccupedVehicle function returns false if player is not found in car so check if player is in car I'm not sure but it should be like this

function getVehicleInformation ()
	
	local vehicle = getPedOccupiedVehicle(localPlayer)
	local vehicleModel = getElementModel(vehicle)

    if (vehicle and vehiclesNoEngine[vehicleModel]) then
	    setVehicleEngineState(vehicle, true)
	    return false
	end
	
    if isPedInVehicle(localPlayer) and getPedOccupiedVehicleSeat(localPlayer) == 0 and getKeyState(e_KEY) then
        return true
	else
	    return false
	end
end

 

Link to comment
12 hours ago, Burak5312 said:

getPedOccupedVehicle function returns false if player is not found in car so check if player is in car I'm not sure but it should be like this


function getVehicleInformation ()
	
	local vehicle = getPedOccupiedVehicle(localPlayer)
	local vehicleModel = getElementModel(vehicle)

    if (vehicle and vehiclesNoEngine[vehicleModel]) then
	    setVehicleEngineState(vehicle, true)
	    return false
	end
	
    if isPedInVehicle(localPlayer) and getPedOccupiedVehicleSeat(localPlayer) == 0 and getKeyState(e_KEY) then
        return true
	else
	    return false
	end
end

 

Warning didn't help anyway

Link to comment

it will work like this

function getVehicleInformation ()
	
	local vehicle = getPedOccupiedVehicle(localPlayer)
	local vehicleModel
    
    if(vehicle) then
       vehicleModel = getElementModel(vehicle)
    end

    if (vehicle and vehiclesNoEngine[vehicleModel]) then
	    setVehicleEngineState(vehicle, true)
	    return false
	end
	
    if isPedInVehicle(localPlayer) and getPedOccupiedVehicleSeat(localPlayer) == 0 and getKeyState(e_KEY) then
        return true
	else
	    return false
	end
end

 

Link to comment
15 hours ago, Burak5312 said:

it will work like this


function getVehicleInformation ()
	
	local vehicle = getPedOccupiedVehicle(localPlayer)
	local vehicleModel
    
    if(vehicle) then
       vehicleModel = getElementModel(vehicle)
    end

    if (vehicle and vehiclesNoEngine[vehicleModel]) then
	    setVehicleEngineState(vehicle, true)
	    return false
	end
	
    if isPedInVehicle(localPlayer) and getPedOccupiedVehicleSeat(localPlayer) == 0 and getKeyState(e_KEY) then
        return true
	else
	    return false
	end
end

 

Thanks very much.

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