Jump to content

Help please


-.Paradox.-

Recommended Posts

Posted

Hello I want a little help,

I have a ranking system with levels and I want use if player level is 1 then draw an image "lvl_1.png" and if player level is 0 then draw "lvl_0.png" can somebody suggest to me what I could use for that and thanks

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted

How are you saving the level?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Can't understand

It's the XP system that you helped me with

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted

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 
) 

If I helped you, please click the like button on the right ;) Thanks!

Posted

@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

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

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

If I helped you, please click the like button on the right ;) Thanks!

Posted

Thanks a lot but where I can write the name of image like example

"experience/ranks/lvl_"..Level..".png"

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted

In the fifth argument of dxDrawImage, change "images" to "experience/ranks/lvl_".

If I helped you, please click the like button on the right ;) Thanks!

Posted

Ok thanks and can I use LV instead of Lvl because that's what I'm using and thanks

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted

Sure, the main point being that you understand what the code does.

You're welcome.

If I helped you, please click the like button on the right ;) Thanks!

Posted

I need one more thing, the image of levels are

lvl_1.png

lvl_2.png

...........

lvl_23.png

Were i have to define the name of the png file?

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted
Quote

In the fifth argument of dxDrawImage, change "images" to "experience/ranks/lvl_".

 

If I helped you, please click the like button on the right ;) Thanks!

Posted

Ok thanks and sorry i tought it's wrong that why i asked. :P

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted

Won't work :/ there is an error in debug

dxDrawImage[Can't load]

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted

What's the full error. It should display the file path. Apparently there is no file in the path specified.

Also, make sure you've added the file into the meta.xml.

If I helped you, please click the like button on the right ;) Thanks!

Posted

Yes I did

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted

Actually there is another error in guiGetScreenSize

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted

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.

If I helped you, please click the like button on the right ;) Thanks!

Posted

I'm using LV and name of the images are lvl_1.png etc

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted

If the element data value is "LV1", "LV2"... then you have to change the string.gsub's second argument to match "LV" or so.

If I helped you, please click the like button on the right ;) Thanks!

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