Mtasa-blue: dxDrawMaterialLine3D cannot get the texture

Created on 6 Oct 2019  路  2Comments  路  Source: multitheftauto/mtasa-blue

Describe the bug

dxDrawMaterialLine3D cannot get the texture after one minute that the onClientPreRender was triggered.
debug: dxDrawMaterialLine3D got nil at argument 7

Code
The dxDrawImageOnElement is as same as the official wiki one in the useful function page.
client:

addEventHandler("onClientPreRender",root,function()
  for k,v in ipairs(getElementsByType("player")) do
    if getElementData(v,"accountData_state") == "true" then
      local x,y,z = getElementPosition(v)
      local policeduty = dxCreateTexture( "file/policeduty.png" )
      exports.srp_usefulfunctions:dxDrawImageOnElement(v,policeduty,20,0.02,0.01)
    end
  end
end)

meta.xml

<meta>
    <script type="client" src="c_nametag.lua"/>


    <file src="file/policeduty.png"/>
</meta>

Version

bug

Most helpful comment

You are making a new texture every time onClientPreRender gets ran.
It should be created only once and reused after.
Are you sure youre not just running out of memory because of the amount of textures created?

All 2 comments

You are making a new texture every time onClientPreRender gets ran.
It should be created only once and reused after.
Are you sure youre not just running out of memory because of the amount of textures created?

Thanks a lot

Was this page helpful?
0 / 5 - 0 ratings

Related issues

StrixG picture StrixG  路  3Comments

ALw7sH picture ALw7sH  路  3Comments

qaisjp picture qaisjp  路  4Comments

rk-r picture rk-r  路  4Comments

qaisjp picture qaisjp  路  3Comments