undefined Posted March 16, 2014 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
Moderators IIYAMA Posted March 16, 2014 Moderators 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 ) Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
Moderators Citizen Posted March 16, 2014 Moderators 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. The rEvolution is coming ...
undefined Posted March 16, 2014 Author 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
Moderators IIYAMA Posted March 16, 2014 Moderators 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. -_-" Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
undefined Posted March 16, 2014 Author Posted March 16, 2014 What can I write instead of 350? Each level will change anything?
Moderators IIYAMA Posted March 16, 2014 Moderators 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. Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
Saml1er Posted March 16, 2014 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? >.>
Castillo Posted March 16, 2014 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. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
undefined Posted March 17, 2014 Author 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
Castillo Posted March 17, 2014 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 ) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Castillo Posted March 17, 2014 Posted March 17, 2014 You have the resource with name "exp_system", right? it worked fine for me. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
undefined Posted March 17, 2014 Author Posted March 17, 2014 Oh sry. Thank you very much. Its worked.
Castillo Posted March 17, 2014 Posted March 17, 2014 You're welcome. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
undefined Posted March 17, 2014 Author 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
Castillo Posted March 17, 2014 Posted March 17, 2014 I don't understand. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
undefined Posted March 17, 2014 Author 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?
undefined Posted March 18, 2014 Author 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 )
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