Jump to content

Fire hose


developa

Recommended Posts

Hello, I would like to make a script for a fire hose. I already have half, but now I have one problem - I do not know how to get around the fire hose. Can anyone help me?

Below I upload a part of the movie (there is what I want to get in my code moment in the movie: 0:26)

 

Code:

local firehose = {}
local texture = dxCreateTexture("line.png")

addCommandHandler("hose", function()
	firehose[1] = {x=2495.24,  y=-1653.7,  z=12.5}
end)

addEventHandler("onClientRender", root, function()
	local bx, by, bz = getPedBonePosition(localPlayer, 35)
	local position = firehose[#firehose]
	local x,y,z = position.x, position.y, position.z
	
	if getDistanceBetweenPoints3D(bx, by, bz, x, y, z) > 1 then
		table.insert(firehose, {x=bx, y=by, z=getGroundPosition(bx, by, bz)})
	end

	for i=1,#firehose do
		if not firehose[i+1] then
			local p = firehose[i]
			dxDrawMaterialLine3D(p.x, p.y, p.z+0.2, bx, by, bz+0.2, texture, 0.13)
		end
			
		if firehose[i] and firehose[i+1] then
			local p = firehose[i]
			local b = firehose[i+1]
			dxDrawMaterialLine3D(p.x, p.y, p.z+0.2, b.x, b.y, b.z+0.2, texture, 0.13)
		end
	end
end)

 

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