undefined Posted March 16, 2014 Share Posted March 16, 2014 (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 March 27, 2014 by Guest Link to comment
Moderators IIYAMA Posted March 16, 2014 Moderators Share Posted March 16, 2014 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 Citizen Posted March 16, 2014 Moderators Share Posted March 16, 2014 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
undefined Posted March 16, 2014 Author Share Posted March 16, 2014 (edited) (Level 5) Unfortunately, the error occurs. What can I write instead of 350? Each level will change anything? Edited March 16, 2014 by Guest Link to comment
Moderators IIYAMA Posted March 16, 2014 Moderators Share Posted March 16, 2014 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. -_-" Link to comment
undefined Posted March 16, 2014 Author Share Posted March 16, 2014 What can I write instead of 350? Each level will change anything? Link to comment
Moderators IIYAMA Posted March 16, 2014 Moderators Share Posted March 16, 2014 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
undefined Posted March 16, 2014 Author Share Posted March 16, 2014 My english is bad. I can't understand Link to comment
Saml1er Posted March 16, 2014 Share Posted March 16, 2014 My english is bad. I can't understand Use castillo's code that exp table part. What's hard to understand in that? >.> Link to comment
Castillo Posted March 16, 2014 Share Posted March 16, 2014 The resource got a function called "getLevelData" which returns: level name, experience required. I believe you can use that to fix your problem. Link to comment
undefined Posted March 17, 2014 Author Share Posted March 17, 2014 (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 March 17, 2014 by Guest Link to comment
Castillo Posted March 17, 2014 Share Posted March 17, 2014 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
Castillo Posted March 17, 2014 Share Posted March 17, 2014 You have the resource with name "exp_system", right? it worked fine for me. Link to comment
undefined Posted March 17, 2014 Author Share Posted March 17, 2014 Oh sry. Thank you very much. Its worked. Link to comment
undefined Posted March 17, 2014 Author Share Posted March 17, 2014 (edited) This indicator is a showing 0 to 14000 exp so show 14000 exp in 10000. Edited March 18, 2014 by Guest Link to comment
undefined Posted March 17, 2014 Author Share Posted March 17, 2014 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? Link to comment
undefined Posted March 18, 2014 Author Share Posted March 18, 2014 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now