Jump to content

[Help]Custom Wanted Stars


Xierra

Recommended Posts

For things like repeating same code but with little change in one of the lines, you should consider using a for loop.

I've noticed that you draw stars away from each other by an average of 22 pixels. So, it's easy to do with a for loop..

wantedLevels = { 100, 250, 500, 1000, 2000, 4000 }; -- global table of levels 
... 
  
local wantedlevel = getElementData (getLocalPlayer(),"crimerange") 
for i=5, 0, -1 do -- you want 6 stars, start drawing last due to last star being 1st wanted level 
    local y = 556 + (22 * i); -- y value will increase every time by 22 
    local col; -- colour 
    for j, level in ipairs( wantedLevels ) do -- iterate through levels 
        col = (wantedlevel >= level) and tocolor( 255, 255, 255, 200 ) or tocolor( 0, 0, 0, 100 ); -- set "col" to color depending on the level 
    end 
    dxDrawImage(1003.0, y, 16.0,19.0,"images/star.png",0.0,0.0,0.0, col, false); 
end 

I wrote this code quickly because I'm in a rush to work, but if there is anything wrong with the code, say it or fix it if you can :)

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