Jump to content

Help please


-.Paradox.-

Recommended Posts

You have to use either GUI Static images or DirectX image drawings. Here is an example on how to draw an image with dxDrawImage. Make sure you have put the file in the images folder inside the resource and make sure the extension is right.

Client-side

local sx, sy = guiGetScreenSize() -- Get screen width and height 
local imageWidth, imageHeight = 100, 100 -- Define image width and height 
local imageExtension = "png" -- Define image extension (i.e. 'png', 'jpg', 'gif'...) 
local imageAlpha = 255 -- Define image transparency (alpha) 
local postGUI = true -- Define whether the image will be drawn on top of GUIs or beneath the GUIs 
  
-- Start rendering 
addEventHandler("onClientRender", root, 
 function() 
  local level = getElementData(localPlayer, "Level") -- Get the element data for the level 
  if (not level) then return end -- If player has no level element data -> return end 
  dxDrawImage((sx-imageWidth)/2, (sy-imageHeight)/2, imageWidth, imageHeight, "images/" .. string.gsub(level, "Lvl ", "") .. "." .. imageExtension, 0, 0, 0, tocolor(255, 255, 255, imageAlpha), postGUI) -- Draw the image 
 end 
) 

Link to comment
StevyDK said:
@Mefisto_PL I'm using setElementData

@myonlake thanks but I know how to draw images my problem is what I must use to create the script

Take a look at the code I posted. That's an example on how to make it work with your system, should work, but you have to do the rest yourself.

Link to comment

Apparently it's just a random error whenever the rendering process begins, but that's normal behavior as the image isn't loaded yet. You can add a fileExists() function there if you want, but the image should still display. I tested it myself and it works just fine.

Make sure the element data is similar to this: "Lvl 1", "Lvl 2" and so on, otherwise the gsub doesn't work.

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