Jump to content

[Solved]


undefined

Recommended Posts

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
Link to comment
  • Moderators

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 
    ) 
  

Link to comment
  • Moderators
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.

Link to comment
  • Moderators
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.

Link to comment
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
Link to comment
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 
) 

Link to comment

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 
) 

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