Jump to content

iDannz [Breno]

Members
  • Posts

    38
  • Joined

  • Last visited

Posts posted by iDannz [Breno]

  1. On 02/02/2019 at 08:04, Tommy. said:

    Tente isso:
     

    
    local screenW, screenH = guiGetScreenSize()
    local x, y = (screenW/1280), (screenH/720)
    
    function hud ()         
        dxDrawImage(x*918, y*0, x*362, y*58, ":br_hud/shruk.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)         
        dxDrawText("$", x*955, y*19, x*1089, y*68, tocolor(0, 177, 142, 255), 1.30, "default-bold", "left", "top", false, false, false, false, false)    
    end     
    addEventHandler("onClientRender", root, hud)
    

    EDIT 1: Verifique se na pasta br_hud tem o arquivo shruk.png

    EDIT 2: Não testei!

    e verifica se tem no meta tb

     

  2. 2 hours ago, IIYAMA said:

    If do not know why your error occur, it looks like you are drawing before the resource has been fully loaded.

    But you could try this: (untested, experimental code and overkill)

    
    do -- no errors when drawing without a given texture
    	local dxDrawImage_ = dxDrawImage
    	function dxDrawImage (...)
    		if ({...})[5] then
    			dxDrawImage_(...)
    		end
    	end
    end
    
    do
    	local blackList = {}
    	local nextTimeConvertToTexture = 0
    	function getImage(name)
    		if not descricoes[name] then return nil end
      
    		local texture = descricoes[name].texture
    		if not texture then
    			local timeNow = getTickCount()
    			if timeNow > nextTimeConvertToTexture and not blackList[filePath] then
    				local filePath = 'imagens/'..descricoes[name].img
    				if fileExists(filePath) then
    					texture = dxCreateTexture(filePath)
    					descricoes[name].texture = texture
    					nextTimeConvertToTexture = timeNow + (1000 / 60) --  convert at a  MAX speed of 60 fps
    				else
    					blackList[filePath] = true
    				end
    			end
    		end
    		return texture
    	end
    end
    

    It will also optimise your code in a later state of the game. (speed up drawing)

     

    its working so good, the only one problem is at the line 20,  local filePath... the table returns the filename without the file extension, so i used filepath = 'imagens/'..descricoes[name]..'.png' and its working, thnx, but i dont know if the real problem is fixed too with dxCreateTexture
     

    2 hours ago, Mr.Loki said:

    This can also be caused when your client runs out of vmemory. make sure that you are cleaning up unused fonts, textures, render targets and shaders properly.

    To check your client memory use the /showmemstat command.

    Spam a few Windows and check to see if it depletes your memory each time it's opened.

    If the FreeForMTA number is too low functions like these stop working.

      Reveal hidden contents

    XKj7GhP.png

     

    Hi loki, how are u?
    i didnot know this command, so i didnt tested it when the error appears, but using the userful function from iiyama, the problem is fixed for now, but ill still here seeing the memstat, thnx so much bro. xD

    guys, im thinking here...

    the table is in an shared type archive, the problem could be here?

    • Like 2
  3. i use too many tables to do it, wait just a little

    --\\this is inside a for, and getImage is an userful function that takes the item name and returns the image filefrom other table

     

    --\\code in onclientrender to show image  **** itens[indexSelected][pageSelected]  is the name of item taken from other table.

    dxDrawImage (screenW *0.2000+i*screenW*0.0630, screenH * 0.31, screenW * 0.0615, screenH * 0.0917, getImage(itens[indexSelected][pageSelected][i])..'.png', 0, 0,0 )    

     

    --\\userful function getImage (used to return the filename using the itemname)

    function getImage(name)
    if not descricoes[name] then return 'imagens/error' end
    	return 'imagens/'..descricoes[name].img
    end

    --\\ table descricoes. (used in getImage function)

    descricoes = {
    --// CRAFTING PAGE 1 \\--
    	['Machado'] = {img = 'machado', desc = 'Usado para facilitar a coleta de madeira.'},
    	['all the others items'] = {img = 'xxx', description = 'item description.'},
    }

     

     

  4. this isnt the correct page to do this ask,  but you can try to use setTimer like this


    timer = {} --\\ create a table for all timers
    function fix (playerSource) 
        if isTimer(timer[playerSource]) then return outputChatBox("Wait just a litte.",playerSource) end --\\ send an error msg to player, if he is spamming
        local interval = 15000 --\\ set up the interval in milliseconds
        local theVehicle = getPedOccupiedVehicle (playerSource) 
        if theVehicle and getVehicleController ( theVehicle ) == playerSource then  
             fixVehicle (theVehicle)  
             outputChatBox ("Your vehicle has been repaired !" , thePlayer) 
            
            timer[playerSource] = setTimer(function(playerSource)  --\\ finally create the timer when player type the command.
                timer[playerSource] = nil 
            end,interval,1,playerSource)
        end
    end
    addCommandHandler ("repair" , fix) 

  5. Hello everyone, I'm having problems with this ...
    I have a DX panel, and the problem is this:
    Sometimes when the player is too long time on the server, or even randomly, the panel stops working due to the following warning: "WARNING: directory/client.lua: line xxx: Error loading image @dxDrawImage [:resourcename/folder/file.png "

    I do not consider myself to be a mta professional, but I'm also not a beginner, and I'm aware that this error happens when you try to display an image that does not exist in "meta.xml", for example. But in this case all images are listed perfectly within the "meta.xml" and within the client file that displays the images. Does anyone know what might be causing this?

    Remember that this is an intermittent error, that is, it happens in a random way, usually you connect, the panel is 100% normal, and as time passes the error occurs in several of the images, but also sometimes you already connect with the error.

    (It's happening in most of my resources that use dxDrawImage.)

    BUGGED: 


    NORMAL: 

     

×
×
  • Create New...