Jump to content

Como arrumo isso ? / Bad argument @ 'getDistanceBetweenPoint3D ' got boolean


Recommended Posts

local LojinhaDsujo = math.random(1000, 3500)

Caixas = {
	--LS
	[1] = {2080.4318847656,2057.5776367188,11.0546875};
	[2] = {1106.7760009766,-1365.8386230469,13.973905563354};
}

Marker = {}

Roubando = {
	[1] = false;
	[2] = false;
}

function CriarMarkers()
    for i, MarkerTable in pairs(Caixas) do
        Marker[i] = createMarker(MarkerTable[1], MarkerTable[2], MarkerTable[3] -1, "cylinder", 1.2, 255,0, 0, 0)
    end
end
addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), CriarMarkers)

function roubarCaixa(source)
	if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Everyone")) then
		for ii, vv in pairs(Marker) do
			if (isElementWithinMarker(source, vv)) then
				inn = ii
			end
		end
		for i, MarkerTable in pairs(Caixas) do
			if (i == inn) then
				if Roubando[i] then 
					return triggerClientEvent(source, "serverNotifys2", root, "Essa loja já foi roubada recentemente !", "error")
				end
				local xp, yp, zp = getElementPosition(source)
				local x, y, z = getElementPosition(MarkerTable)
				local dist = getDistanceBetweenPoints3D(xp, yp, zp, x, y, z)
				if (dist >= 5) then 
					return
				end
				Roubando[i] = true
				if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Policial")) then
				triggerClientEvent(source, "serverNotifys2", root, "Uma lojinha está sendo assaltada !", "error")
				end
				setPedAnimation(source, "SHOP", "SHP_Gun_Aim", 15000, true, false, false, false)
				setTimer(function()
					triggerClientEvent(source, "FB:TempoPainelAtivadoLojinha", getRootElement())
					setPedAnimation(source)
					triggerClientEvent(source, "serverNotifys2", root, "Não vá para longe você esta assaltando uma lojinha", "error")
					setTimer(function()
					    triggerClientEvent("serverNotifys2", root, "Uma lojinha foi assaltada !", "error")
						setTimer(function()   
							if (isElement(source)) then
							local xp, yp, zp = getElementPosition(source)
							local dist = getDistanceBetweenPoints3D(xp, yp, zp, x, y, z)
							if (dist <= 25) then 
                            givePlayerMoney(source, LojinhaDsujo)
							end
							setTimer(function()
			
								setTimer(function()
									Roubando[i] = false
								end, 600000, 1) 
							end, 600000, 1) 
						end, 1000, 1)
					end, 180000, 1) 
				end, 15000, 1) 
			end
		end
	else
	    triggerClientEvent(source, "serverNotifys2", root, "Você não tem permissão para assaltar essa loja", "error")
	end
end
addCommandHandler("assaltar", roubarCaixa)

 

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
×
×
  • Create New...