felipebaidoloko

Aviso de alerta

Recommended Posts

Boa noite preciso de uma ajuda para uma função para ver os meus veículos que são salvos, ai tem um setElementData que seta quando inicia o servidor. o que é isso?

 

AVISO = mau argumento @ 'getElementData' [elemento esperado no argumento 1, booleano]

 

-- Cliente

playerBlibs = {}
setTimer(function()
	if getElementData(getLocalPlayer(),"logedin") then
		for i, blip in pairs(playerBlibs) do
			if isElement(blip)then
				destroyElement(blip)
			end
		end
		for i,veh in ipairs(getElementsByType("vehicle")) do
			if veh then 
			vehicles = tonumber(getElementData(getElementData(veh,"parent"),"dropVeh")) -- aviso
				if vehicles == 2 then
					playerBlibs[i] = createBlipAttachedTo(veh,0,2,244, 32, 32)
					setBlipVisibleDistance(playerBlibs[i],1000)
				end
			end
		end
	end
end,10000,0)

 

Edited by felipebaidoloko

Share this post


Link to post
playerBlibs = {}
setTimer(function()
	if getElementData(getLocalPlayer(),"logedin") then
		for i, blip in pairs(playerBlibs) do
			if isElement(blip)then
				destroyElement(blip)
			end
		end
		for i,veh in ipairs(getElementsByType("vehicle")) do
        	local vehParent = getElementData(veh,"parent")
			if veh and vehParent then
				vehicles = tonumber(vehParent) -- aviso
				if vehicles == 2 then
					playerBlibs[i] = createBlipAttachedTo(veh,0,2,244, 32, 32)
					setBlipVisibleDistance(playerBlibs[i],1000)
				end
			end
		end
	end
end,1000,0)

Essa verificação vai evitar o aviso no debug, mas se algo tiver errado é com a data "parent".

  • Thanks 1

Share this post


Link to post

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.