FaydenFX. Posted April 24, 2017 Share Posted April 24, 2017 Hello, I have a question. What functions will be needed to make a fire hose? The photo I give below. Link to comment
Mr.Loki Posted April 25, 2017 Share Posted April 25, 2017 A video would be a better way of showing this but it's simply just dxDrawLine3D Link to comment
FaydenFX. Posted April 25, 2017 Author Share Posted April 25, 2017 (edited) Video and no, it is not dxDrawLine3D Edited April 25, 2017 by FaydenFX. 1 Link to comment
NeXuS™ Posted April 25, 2017 Share Posted April 25, 2017 For my guess too, it is dxDrawLine3D. Why do you think it is not? Link to comment
FaydenFX. Posted April 25, 2017 Author Share Posted April 25, 2017 (edited) Why does this line turn up? I think this is a function dxDrawMaterialLine3D. If I'm wrong, please give me an example of this feature :) Edited April 25, 2017 by FaydenFX. Link to comment
Function Posted April 25, 2017 Share Posted April 25, 2017 Yes it is dxDrawMaterialLine3D Link to comment
NeXuS™ Posted April 25, 2017 Share Posted April 25, 2017 Same as dxDrawLine3D, just uses a material instead of colors. Link to comment
Mr.Loki Posted April 25, 2017 Share Posted April 25, 2017 To make it look more like a hose they just use 2 lines on top of each other a white line then a grey line on top with a smaller width Link to comment
FaydenFX. Posted April 25, 2017 Author Share Posted April 25, 2017 firehose = {} function isEventHandlerAdded( sEventName, pElementAttachedTo, func ) if type(sEventName) == 'string' and isElement(pElementAttachedTo) and type(func) == 'function' then local aAttachedFunctions = getEventHandlers(sEventName, pElementAttachedTo) if type(aAttachedFunctions) == 'table' and #aAttachedFunctions > 0 then for i,v in ipairs(aAttachedFunctions) do if v == func then return true end end end end return false end addCommandHandler("firehose", function() local data = getElementData(localPlayer, "player:firehose") if not data then setElementData(localPlayer, "player:firehose", {["holder"] = "evidently"}) checkPlayerObject(localPlayer) else setElementData(localPlayer, "player:firehose", {["holder"] = "deficiency"}) end end) local function checkPlayerObject(player) if not player or not isElement(player) or getElementType(player) ~= "player" then return false end local data = getElementData(player, "player:firehose") if data["holder"] == "evidently" then local position = {getElementPosition(player)} table.insert(firehose, {x=position[1], y=position[2], z=position[3]}) if not isEventHandlerAdded("onClientRender", root, firehoseRender) then addEventHandler("onClientRender", root, firehoseRender) end else if isEventHandlerAdded("onClientRender", root, firehoseRender) then removeEventHandler("onClientRender", root, firehoseRender) end end end function firehoseRender() for i,v in pairs(firehose) do if (firehose[i + 1] ~= nil) then dxDrawLine3D(firehose[i].x, firehose[i].y, firehose[i].z+0.3, firehose[i + 1].x, firehose[i + 1].y, firehose[i + 1].z+0.3, tocolor(255, 255, 255, 255), 10) else dxDrawLine3D(firehose[i].x, firehose[i].y, firehose[i].z+0.3, firehose[i + 1].x, firehose[i + 1].y, firehose[i + 1].z+0.3, tocolor(255, 255, 255, 255), 10) end end end It does not work, any ideas? Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now