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
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
Most helpful comment
You are making a new texture every time
onClientPreRendergets 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?