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)

 

[BR] • VIDA DE JOVEM • ~ ROLEPLAY ~ [ CORPS, VOICE, GANGS, VIPS ]

VENHA CONHECER NOSSO SERVIDOR ~ R O L E P L A Y ~ SERVIDOR NOVO
BEM CONFIGURADO COMPACTADO LEVE COM UM BOM PING Obs: Depende da Sua NET!
Staff Sempre Online Vagas Abertas Para todos tipo de trabalhos CORPS, GANGS,
SAMU, MECANICOS e Muitos Outros Trabalhos Vale a pena Visita passe seus 10Minutos
Aqui e venha conhecer a verdadeira diversão de um R O L E P L A Y

ID: mtasa://54.39.244.81:22853
DISCORD: discord.gg/jEyd4J3 
PAGINA: https://www.facebook.com/VidaDeJovemBR/
WhatsApp: 71 987647252

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