Jump to content

Question


Scripting

Recommended Posts

In the wiki page you'll find a example of how it works.

Wiki example:

function makeLineAppear() 
    testVehicle = createVehicle ( 411, 0, 0, 5 ) -- Create our test vehicle. 
    addEventHandler("onClientRender", getRootElement(), createLine)        -- onClientRender keeps the 3D Line visible. 
end 
function createLine ( ) 
    x1, y1, z1 = getElementPosition ( testVehicle )                       -- Get test vehicles position. 
    x2, y2, z2 = getElementPosition ( getLocalPlayer ())                  -- Get local players position. 
    dxDrawLine3D ( x1, y1, z1, x2, y2, z2, tocolor ( 0, 255, 0, 230 ), 2) -- Create 3D Line between test vehicle and local player. 
end 
addCommandHandler("test", makeLineAppear) 

Link to comment
addEventHandler( 'onClientRender',root, 
    function( ) 
        local x,y,z = getElementPosition( localPlayer ) 
        dxDrawLine3D( x,y,z,x,y+2,z,tocolor ( 0, 255, 0, 230 ), 2 ) 
        dxDrawLine3D( x,y,z,x,y-2,z,tocolor ( 0, 255, 0, 230 ), 2 ) 
        dxDrawLine3D( x,y,z,x+2,y,z,tocolor ( 0, 255, 0, 230 ), 2 ) 
        dxDrawLine3D( x,y,z,x-2,y,z,tocolor ( 0, 255, 0, 230 ), 2 ) 
        dxDrawLine3D( x,y,z,x,y,z+2,tocolor ( 0, 255, 0, 230 ), 2 ) 
        dxDrawLine3D( x,y,z,x,y,z-2,tocolor ( 0, 255, 0, 230 ), 2 ) 
    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...