Jump to content

[AJUDA] Distancia Script


Recommended Posts

Posted · Hidden
Hidden

Olá estou com um pequeno ou grande problema é minha primeira vez usando getDistanceBetweenPoints3D e estou mim matando para resolve a distancia bom estou tentando fazer um sistema para guarda o veiculo porem precisa esta perto dele para guarda tentei varias formas e linhas mais ainda não sei onde errei ou o que esta faltando então vim aqui pede a ajuda de vocês!

OBS: ESTOU TENDO ERRO DIRETO NO

if ( dist > 5 )  then 

SYSTEMA COMPLETO

addEvent("DestroyMyVehicle", true)
addEventHandler("DestroyMyVehicle", root, 
function(id)
	local vehicle = getVehicleByID(id)
	if isElement(vehicle) then
		local data = dbPoll(dbQuery(db, "SELECT * FROM VehicleList WHERE Account = ? AND ID = ?", getAccountName(getPlayerAccount(source)), id), -1)
		if type(data) == "table" and #data ~= 0 then
			local xc,yc,zc = getElementPosition ( value )
			local x2,y2,z2 = getElementPosition ( source )
			local dist = getDistanceBetweenPoints3D ( xc, yc, zc, x2, y2, z2 )
			if ( dist > 5 )  then 
				dxMsg(source, "Você está muito distante do veículo.", "error")
			else
				destroyVehicle(vehicle)
				dxMsg(source, "Seu veículo #00FF00"..getVehicleNameFromModel(data[1]["Model"]).." #FFFFFFfoi guardado!", "success")
			end
			else
			dxMsg(source, "O seu veículo não foi spawnado!", "error")
		end
	end
end)

 

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