Stylez Posted March 28, 2012 Share Posted March 28, 2012 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
drk Posted March 28, 2012 Share Posted March 28, 2012 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
Stylez Posted March 28, 2012 Author Share Posted March 28, 2012 oh, thank-you :] for me the hardest thing in scripting are the arguments Link to comment
Stylez Posted March 28, 2012 Author Share Posted March 28, 2012 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
drk Posted March 28, 2012 Share Posted March 28, 2012 It's occupied not Occuped. local theVehicle = getPedOccupiedVehicle ( source ) Link to comment
Stylez Posted March 28, 2012 Author Share Posted March 28, 2012 damn... whole day i was looking at this script and i didin't found that mistake thankyou again Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now