Jump to content

about markers


SkatCh

Recommended Posts

Posted

hi guys please i have a question how can i change the marker type .

i know all markers type from wiki but i mean custom marker .

thank you .

Failure is simply an opportunity to begin again more intelligently - Henry Ford

Posted

i know that i need to use dxDrawLine3D but how to create it please help .

Failure is simply an opportunity to begin again more intelligently - Henry Ford

Posted

You can use the following function (credits to 50p for creating it)

function dxDrawCircle3D( x, y, z, radius, segments, color, width ) 
    segments = segments or 16; -- circle is divided into segments -> higher number = smoother circle = more calculations 
    color = color or tocolor( 255, 255, 0 ); 
    width = width or 1; 
    local segAngle = 360 / segments; 
    local fX, fY, tX, tY; -- drawing line: from - to 
    for i = 1, segments do 
        fX = x + math.cos( math.rad( segAngle * i ) ) * radius; 
        fY = y + math.sin( math.rad( segAngle * i ) ) * radius; 
        tX = x + math.cos( math.rad( segAngle * (i+1) ) ) * radius; 
        tY = y + math.sin( math.rad( segAngle * (i+1) ) ) * radius; 
        dxDrawLine3D( fX, fY, z, tX, tY, z, color, width ); 
    end 
end 

Use a loop on the client side to get all of the markers, set their alpha to 0 and then call the function.

  • 1 month later...
Posted

thx bro for ur help but i'm sorry i don't undrestand how

Failure is simply an opportunity to begin again more intelligently - Henry Ford

Posted

Can any one explane to me how can i use what xXMADEXx gave to me . please

Failure is simply an opportunity to begin again more intelligently - Henry Ford

Posted

Simply copy the function to your file. Then loop through all the markers, make them invisible (alpha=0) and draw the circle in the same spot.

addEventHandler( "onClientRender", root, 
    function( ) 
        for _, marker in pairs( getElementsByType("marker") ) do 
            if getMarkerType( marker ) == "cylinder" then 
                setElementAlpha( marker, 0 ); -- make the marker invisible 
                local x,y,z = getElementPosition( marker ); 
                local radius = getMarkerSize( marker ); 
                local color = tocolor( getMarkerColor( marker ) ); 
                dxDrawCircle3D( x, y, z, radius, 24, color ); 
            end 
        end 
    end 
) 
  

Posted

thx bro for help i changed all markers alpha to 0 but i can't see the dxDrawcircle. can you tell me how to create it is this right :

dxDrawCircle3D(1631.2060546875,1850.658203125,10.8203125,1.5,24,tocolor( 255, 255, 0 ),2)

Failure is simply an opportunity to begin again more intelligently - Henry Ford

Posted

thx 50p for your time , i fixed it and now i can see it but just stay 3 second .

Edit : Thank you so much bro i fixed it .

topic can be locked.

Failure is simply an opportunity to begin again more intelligently - Henry Ford

Posted

The script already get the positions of all markers in the server and draw the line by itself you don't need to get it manually. There's only one problem with alpha within 50p code.

local color = tocolor( getMarkerColor( marker ) ) 

Change to:

local r, g, b = getMarkerColor( marker ) 
local color = tocolor( r, g, b, 255 ) 

CiTLh.png
Posted

no it's working fine i already asked to close the topic , just i want to add something ;

50p you must add this :

addEventHandler( "onClientRender", root, 
    function( ) 
        for _, marker in pairs( getElementsByType("marker") ) do 
            if getMarkerType( marker ) == "cylinder" then 
                setElementAlpha( marker, 0 ); -- make the marker invisible 
                local x,y,z = getElementPosition( marker ); 
                local radius = getMarkerSize( marker ); 
                local color = tocolor( getMarkerColor( marker ) ); 
                dxDrawCircle3D( x, y, z, radius, 24, color ); 
            end 
        end 
    end 
end <---------------------------------- missing 
) 

Failure is simply an opportunity to begin again more intelligently - Henry Ford

Posted

ok bro i want to ask you what can i do if i want to draw a rectangle .

Failure is simply an opportunity to begin again more intelligently - Henry Ford

Posted

bro i tried my option but i can't draw a rectangle can you help me .

Failure is simply an opportunity to begin again more intelligently - Henry Ford

Posted

i'm sorry bro if i waste your time , i tried the same script this :

function dxDrawCircle3D( x, y, z, radius, segments, color, width ) 
    segments = segments or 16; -- circle is divided into segments -> higher number = smoother circle = more calculations 
    color = color or tocolor( 255, 255, 0 ); 
    width = width or 1; 
    local segAngle = 360 / segments; 
    local fX, fY, tX, tY; -- drawing line: from - to 
    for i = 1, segments do 
        fX = x + math.cos( math.rad( segAngle * i ) ) * radius; 
        fY = y + math.sin( math.rad( segAngle * i ) ) * radius; 
        tX = x + math.cos( math.rad( segAngle * (i+1) ) ) * radius; 
        tY = y + math.sin( math.rad( segAngle * (i+1) ) ) * radius; 
        dxDrawLine3D( fX, fY, z, tX, tY, z, color, width ); 
    end 
end 

i changed the seagnle etc but i got an other form not a rectangle , i think it's wrong . because i don't undrestand your last answer .

Failure is simply an opportunity to begin again more intelligently - Henry Ford

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