-Doc- Posted June 30, 2015 Share Posted June 30, 2015 (edited) * Cut * Edited December 30, 2015 by Guest Link to comment
KariiiM Posted June 30, 2015 Share Posted June 30, 2015 You want these direct x lines show in the screen when you press a "button"? You didnt explain well what you wanted to do,so it will be easy to help after understanding your point. Link to comment
-Doc- Posted June 30, 2015 Author Share Posted June 30, 2015 OMG Do u saw handler? when i enter hydra to show the crosshair Link to comment
KariiiM Posted June 30, 2015 Share Posted June 30, 2015 OMG Do u saw handler? when i enter hydra to show the crosshair Ah sorry i didnt take attention try this function crosshair () if getPedOccupiedVehicle(localPlayer) then if getElementModel(getPedOccupiedVehicle(localPlayer)) == 520 then local col2 = getElementData(veh, "r.col2") local col1 = getElementData(veh, "r.col1") if not(col2) or not(col1) then return end local x, y, z = getElementPosition(col2) local x1, y1, z1 = getElementPosition(col1) z1 = z1+getElementDistanceFromCentreOfMassToBaseOfModel(veh)*2 local hit, x2, y2, z2 = processLineOfSight(x, y, z, x1, y1, z1) if not(x2) or not(y2) or not(z2) then x2, y2, z2 = x, y, z end local sx, sy = getScreenFromWorldPosition(x2, y2, z2) if not(sx) or not(sy) then return end dxDrawLine(sx, sy-12.9, sx, sy+12.9, tocolor(0, 255, 0), 2) dxDrawLine(sx-12.9, sy, sx+12.9, sy, tocolor(0, 255, 0), 2) end end end addEventHandler("onClientRender", root, crosshair) Link to comment
-Doc- Posted June 30, 2015 Author Share Posted June 30, 2015 Rechange the script function crosshair () if getPedOccupiedVehicle(localPlayer) then if getElementModel(getPedOccupiedVehicle(localPlayer)) == 520 then --there local veh = getPedOccupiedVehicle(gMe) --there local col2 = getElementData(veh, "r.col2") --there local col1 = getElementData(veh, "r.col1") if not(col2) or not(col1) then return end local x, y, z = getElementPosition(col2) local x1, y1, z1 = getElementPosition(col1) z1 = z1+getElementDistanceFromCentreOfMassToBaseOfModel(veh)*2 local hit, x2, y2, z2 = processLineOfSight(x, y, z, x1, y1, z1) if not(x2) or not(y2) or not(z2) then x2, y2, z2 = x, y, z end local sx, sy = getScreenFromWorldPosition(x2, y2, z2) if not(sx) or not(sy) then return end dxDrawLine(sx, sy-12.9, sx, sy+12.9, tocolor(0, 255, 0), 2) dxDrawLine(sx-12.9, sy, sx+12.9, sy, tocolor(0, 255, 0), 2) end end end addEventHandler("onClientRender", root, crosshair) Link to comment
-Doc- Posted June 30, 2015 Author Share Posted June 30, 2015 Where is --there is error Link to comment
KariiiM Posted June 30, 2015 Share Posted June 30, 2015 (edited) Your error is about getPedOccupiedVehicle ,if this didnt works inform me to edit my post function crosshair () if getPedOccupiedVehicle(localPlayer) then if getElementModel(getPedOccupiedVehicle(localPlayer)) == 520 true then --there local veh = getPedOccupiedVehicle(gMe) --there local col2 = getElementData(veh, "r.col2") --there local col1 = getElementData(veh, "r.col1") if not(col2) or not(col1) then return end local x, y, z = getElementPosition(col2) local x1, y1, z1 = getElementPosition(col1) z1 = z1+getElementDistanceFromCentreOfMassToBaseOfModel(veh)*2 local hit, x2, y2, z2 = processLineOfSight(x, y, z, x1, y1, z1) if not(x2) or not(y2) or not(z2) then x2, y2, z2 = x, y, z end local sx, sy = getScreenFromWorldPosition(x2, y2, z2) if not(sx) or not(sy) then return end dxDrawLine(sx, sy-12.9, sx, sy+12.9, tocolor(0, 255, 0), 2) dxDrawLine(sx-12.9, sy, sx+12.9, sy, tocolor(0, 255, 0), 2) end end end addEventHandler("onClientRender", root, crosshair) Edited June 30, 2015 by Guest Link to comment
KariiiM Posted June 30, 2015 Share Posted June 30, 2015 function crosshair () local vehicle = getPedOccupiedVehicle ( thePlayer ) if vehicle == 520 then Link to comment
Tomas Posted June 30, 2015 Share Posted June 30, 2015 addEventHandler("onClientRender", getRootElement(), function ( ) if isPedInVehicle(localPlayer) then if getElementModel( getPedOccupiedVehicle(localPlayer) ) == 520 then local veh = getPedOccupiedVehicle(localPlayer) local col2 = getElementData(veh, "r.col2") local col1 = getElementData(veh, "r.col1") if not(col2) or not(col1) then return end local x, y, z = getElementPosition(col2) local x1, y1, z1 = getElementPosition(col1) z1 = z1+getElementDistanceFromCentreOfMassToBaseOfModel(veh)*2 local hit, x2, y2, z2 = processLineOfSight(x, y, z, x1, y1, z1) if not(x2) or not(y2) or not(z2) then x2, y2, z2 = x, y, z end local sx, sy = getScreenFromWorldPosition(x2, y2, z2) if not(sx) or not(sy) then return end dxDrawLine(sx, sy-12.9, sx, sy+12.9, tocolor(0, 255, 0), 2) dxDrawLine(sx-12.9, sy, sx+12.9, sy, tocolor(0, 255, 0), 2) end end end ) Link to comment
Moderators IIYAMA Posted June 30, 2015 Moderators Share Posted June 30, 2015 Why don't you take a look of what really happens? If you don't know how your code behaves, you will have a hard time fixing it... addEventHandler("onClientRender", getRootElement(), function ( ) if isPedInVehicle(localPlayer) then if getElementModel( getPedOccupiedVehicle(localPlayer) ) == 520 then local veh = getPedOccupiedVehicle(localPlayer) local col2 = getElementData(veh, "r.col2") local col1 = getElementData(veh, "r.col1") if not isElement(col2) or not isElement(col1) then return end local x, y, z = getElementPosition(col2) local x1, y1, z1 = getElementPosition(col1) -- dxDrawLine3D(x, y, z,x1, y1, z1,tocolor(255, 0, 0)) -- debug line 1 -- z1 = z1+getElementDistanceFromCentreOfMassToBaseOfModel(veh)*2 -- dxDrawLine3D(x, y, z,x1, y1, z1,tocolor(0, 0, 255)) -- debug line 2 -- local hit, x2, y2, z2 = processLineOfSight(x, y, z, x1, y1, z1) if not(x2) or not(y2) or not(z2) then x2, y2, z2 = x, y, z end -- dxDrawLine3D( x1, y1, z1,x2, y2, z2,tocolor(0, 255, 0)) -- debug line 3 -- local sx, sy = getScreenFromWorldPosition(x2, y2, z2) if not(sx) or not(sy) then return end dxDrawLine(sx, sy-12.9, sx, sy+12.9, tocolor(0, 255, 0), 2) dxDrawLine(sx-12.9, sy, sx+12.9, sy, tocolor(0, 255, 0), 2) end end end ) Link to comment
-.Paradox.- Posted July 1, 2015 Share Posted July 1, 2015 Or at least say what debug outputs Link to comment
-Doc- Posted July 1, 2015 Author Share Posted July 1, 2015 Nothing. And please go away from my topics. Link to comment
-.Paradox.- Posted July 1, 2015 Share Posted July 1, 2015 You're asking help on a public forum made for its members, And if you want a specific person to do it for you, Contact him/them in private and not post here your topic and then ask us to leave. I'm reporting this Link to comment
Moderators IIYAMA Posted July 1, 2015 Moderators Share Posted July 1, 2015 Blue, I just gave you code to debug your code. What is the result? Link to comment
Moderators IIYAMA Posted July 1, 2015 Moderators Share Posted July 1, 2015 No errors nothing Stupid answer, bye. Link to comment
-Doc- Posted July 2, 2015 Author Share Posted July 2, 2015 Whats stupid there i said no errorrs, or... Link to comment
Moderators IIYAMA Posted July 2, 2015 Moderators Share Posted July 2, 2015 Whats stupid there i said no errorrs, or... It is stupid, because the code I posted doesn't show any debug text, but 3D lines. It seems you didn't even looked at it, you are wasting my time. Link to comment
//_Dragon Posted December 27, 2015 Share Posted December 27, 2015 (edited) Removed Edited December 27, 2015 by Guest 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