Jump to content

[Solved]


undefined

Recommended Posts

Posted (edited)

Hi Guys.

Im using Castillo's Exp system. I want to do an indicator for the level and im do it. But it does not work the way I want. When i jump level rectangle is not reset.

addEventHandler("onClientRender",root, 
    function() 
        exp =( getElementData ( localPlayer, "exp" )) 
        ExpBar = 150 * ( exp / 350 ) 
        dxDrawRectangle(sWidth-185,sHeight-186.5, 154, 6.5, tocolor ( 0, 0, 0, 255 ), false)-- Exp Bar 
        dxDrawRectangle(sWidth-183,sHeight-185,ExpBar,3.5,tocolor(255,255,255,255) ,false) -- Exp 
    end 
) 

...Sry my bad English...

Edited by Guest
  • Moderators
Posted

Because the xp isn't reset.....

Try this:

  
    addEventHandler("onClientRender",root, 
        function() 
            local exp_ =( getElementData ( localPlayer, "exp" ) or 0) 
            local ExpBar = 150 * (( exp_ % 350 )/350) 
            dxDrawRectangle(sWidth-185,sHeight-186.5, 154, 6.5, tocolor ( 0, 0, 0, 255 ), false)-- Exp Bar 
            dxDrawRectangle(sWidth-183,sHeight-185,ExpBar,3.5,tocolor(255,255,255,255) ,false) -- Exp 
        end 
    ) 
  

  • Moderators
Posted
Because the xp isn't reset.....

Try this:

local ExpBar = 150 * (( exp_ % 350 )/350) 

It will surely only work for the 1st level, then he will get the same problem (the expbar going outside) because it's probably not 350 for each level.

Please send us the link of that exp system and the configuration file if there is one.

Posted (edited)

(Level 5)

w1R3Bj.png

Unfortunately, the error occurs.

What can I write instead of 350? Each level will change anything?

Edited by Guest
  • Moderators
Posted

Then use castillo his exp table at clientside or what ever.

I am not going to download his resource just to copy things out of it. -_-"

  • Moderators
Posted
Then use castillo his exp table at clientside or what ever.

I am not going to download his resource just to copy things out of it. -_-"

What can I write instead of 350? Each level will change anything?

Then use castillo his exp table at clientside or what ever.

Posted

The resource got a function called "getLevelData" which returns: level name, experience required.

I believe you can use that to fix your problem.

Posted (edited)
addEventHandler("onClientRender",root, 
        function( ) 
            local level = ( getElementData ( localPlayer, "level" ) or 0 ) 
            local exp_ = ( getElementData ( localPlayer, "exp" ) or 0 ) 
            local ExpBar = 150 * (( exp_ % level )/level) 
            dxDrawRectangle(sWidth-185,sHeight-136.5, 154, 6.5, tocolor ( 0, 0, 0, 255 ), false)-- Exp Bar 
            dxDrawRectangle(sWidth-183,sHeight-135,ExpBar,3.5,tocolor(255,255,255,255) ,false) -- Exp 
        end 
    ) 

Where is the my mistake?

Edited by Guest
Posted
addEventHandler ( "onClientRender", root, 
    function ( ) 
        local level = ( getElementData ( localPlayer, "level" ) or 0 ) 
        local _, required = exports [ "exp_system" ]:getLevelData ( level ) 
        if ( required ) then 
            local exp_ = ( getElementData ( localPlayer, "exp" ) or 0 ) 
            local ExpBar = ( 150 * ( ( exp_ % required ) / required ) ) 
            dxDrawRectangle ( sWidth - 185, sHeight - 186.5, 154, 6.5, tocolor ( 0, 0, 0, 255 ), false )-- Exp Bar 
            dxDrawRectangle ( sWidth - 183, sHeight - 185, ExpBar, 3.5, tocolor ( 255, 255, 255, 255 ), false ) -- Exp 
        end 
    end 
) 

Posted

10 level 10000 exp

11 level 14000 exp

This indicator is a showing 0 to 14000 exp so show 14000 exp in 10000.

I want to show 10000 to 14000 exp so 4000 exp.

Do you understand me?

Posted

Watch pls!

Help me pls :(

addEventHandler ( "onClientRender", root, 
    function ( ) 
        local level = ( getElementData ( localPlayer, "level" ) or 0 ) 
        local _, required = exports [ "Jack" ]:getLevelData ( level ) 
        if ( required ) then 
            local exp_ = ( getElementData ( localPlayer, "exp" ) or 0 ) 
            local ExpBar = ( 150 * ( ( exp_ % required ) / required ) ) 
            dxDrawRectangle ( sWidth - 185, sHeight - 186.5, 154, 6.5, tocolor ( 0, 0, 0, 255 ), false )-- Exp Bar 
            dxDrawRectangle ( sWidth - 183, sHeight - 185, ExpBar, 3.5, tocolor ( 255, 255, 255, 255 ), false ) -- Exp 
        end 
    end 
) 

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