Jump to content

help :?


Stylez

Recommended Posts

Hi guys. i made this script but it has 2 errors in debug.

[2012-03-28 17:52:27] WARNING: automobiliai\automobiliai.lua:20: Bad 'vehicle' pointer @ 'getVehicleOccupant'(1)

[2012-03-28 17:52:27] WARNING: automobiliai\automobiliai.lua:21: Bad 'vehicle' pointer @ 'getVehicleOccupant'(1)

BTW. script works fine :?

function engine(driver) 
    local vehicleHealth = getElementHealth(source) 
    if vehicleHealth <= 500 then 
        setVehicleEngineState(source, false) 
        getVehicleOccupant(driver) 
        outputChatBox("((Your engine is broken!))", getVehicleOccupant(driver), 255, 204,0) 
    end 
end 
addEventHandler("onVehicleEnter", getRootElement(), engine) 
  

Link to comment
function engine ( driver ) 
    local vehicleHealth = getElementHealth ( source ) -- gets vehicle health 
    if vehicleHealth <= 500 then -- check vehicle health 
        setVehicleEngineState(source, false) -- set engine off 
        getVehicleOccupant ( source ) -- wrong, you're trying to get the driver occupant 
        outputChatBox("((Your engine is broken!))", getVehicleOccupant ( source ), 255, 204,0) -- output in the chat 
    end 
end 
addEventHandler("onVehicleEnter", root, engine) 
  

This is the correct code. The comments are relative to your code.

Link to comment

hmm, i've got another problem now :/ i created allmost the same script ass the 1st one, but this one shows Err. message; attempt to call global 'getPedOccupedVehicle' (a nil value)

function uzkurti (thePed) 
    local theVehicle = getPedOccupedVehicle(source) 
    if theVehicle then 
        if getVehicleEngineState(theVehicle, false) then 
            setVehicleEngineState(theVehicle, true) 
        end 
    end 
end 
function kurti () 
    bindKey(source,"lalt", "down", uzkurti) 
end 
addEventHandler("onPlayerVehicleEnter", getRootElement(), kurti) 
  

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