Jump to content

Bad argument @ 'getElementData'


Robis

Recommended Posts

Hello!

I have an warning showing up in my console!

Can anyone help me fix this? 

Gamemode: DayZ

WARNING:

Bad argument @ 'getElementData' [Expected element at argument 1, got nil]

Script:

function setEngineStateByPlayer (playersource)
  ------------------------------------------------
	local parent = getElementData(veh,"parent") --WARNING HERE
  ------------------------------------------------------
    if isElement(parent) and tonumber(getElementData(parent,"fuel"))then
    if getElementData(parent,"fuel") <= 0 then
		outputChatBox("This vehicle tank is empty!", playersource, 255, 22, 0)
		return
	end
	end
	local veh = getPedOccupiedVehicle (playersource)
	setVehicleEngineState (veh, not getVehicleEngineState(veh))
	if getVehicleEngineState(veh) == true then
		triggerClientEvent (playersource, "displayClientInfo", playersource,"Vehicle","You started the Engine.",22,255,0)
	else
		triggerClientEvent (playersource, "displayClientInfo", playersource,"Vehicle","You stopped the Engine. ",255,22,0)
	end
end

Thanks! :)

Edited by Robis
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...