Jump to content

dxDrawMaterialLine3D wont work, No Errors/Warnings


Recommended Posts

Hi,

Atm i´m Making a Script that gangs can draw their "Tag" on walls,

but i doesn´t get any errors/Warnings

what is wrong ?

Server :

local tags = {} 
  
function async_tags () 
    triggerClientEvent("sync_tags_client",getRootElement(),tags) 
end 
  
function addTag(hx,hy,hz,hx,hy,hz,mx,my,mz ) 
    table.insert(tags,{hx,hy,hz,hx,hy,hz,mx,my,mz }) 
    async_tags () 
end 
addEvent("sync_tags_server",true) 
addEventHandler("sync_tags_server",getRootElement(),addTag) 
  

Client :

visible_tags = {} 
  
tex = dxCreateTexture("dot.png") 
addEventHandler("onClientPreRender",getRootElement(),function () 
    for tag,data in pairs(visible_tags) do 
        local x1 = data[1] 
        local y1 = data[2] 
        local z1 = data[3] 
        local x2 = data[4] 
        local y2 = data[5] 
        local z2 = data[6] 
        local nx = data[7] 
        local ny = data[8] 
        local nz = data[9] 
  
        dxDrawMaterialLine3D(x1,y1,z1,x2,y2,z2,tex,3,tocolor(255,255,255,128),nx,ny,nz) 
         
    end 
end) 
     
  
     
function addSpray ( hx,hy,hz,hx,hy,hz,mx,my,mz ) 
    triggerServerEvent("sync_tags_server",getRootElement(),hx,hy,hz,hx,hy,hz,mx,my,mz) 
end 
  
function sync_tags ( tagtbl ) 
    visible_tags = tagtbl 
end 
addEvent("sync_tags_client",true) 
addEventHandler("sync_tags_client",getRootElement(),sync_tags) 
  
     
step = 0 
addEventHandler("onClientPlayerWeaponFire",root,     
function (weapon,ammo,inclip,hx,hy,hz,hitel) 
    step = step + 5 
        if weapon ~= 41 then return end 
            if (step >= 100) then 
                step = 0 
                    local mx,my,mz = getPedBonePosition(source,23) 
                    local wall,x0,y0,z0,hit,zx,zy,zz = processLineOfSight(mx,my,mz,hx,hy,hz) 
                    if hit then return end 
                    if wall then return end 
                addSpray(hx,hy,hz+1.5,hx,hy,hz-1.5,mx,my,mz) 
                table.insert(visible_tags,{hx,hy,hz,hx,hy,hz,mx,my,mz }) 
  
            end 
end) 
  

Hope you can help me,

Regards

Link to comment

You're painting in the same place or you're passing wrong coords to the tags table.

Check the addTag and addSpray functions parameters because 3 of them are the same that might be causing the problem.

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