#RooTs Posted February 10, 2015 Share Posted February 10, 2015 (edited) Hello, is there any way to join all the ability in one variable? I've tried everything friends Example: local stats01 = getPedStat (localPlayer,tonumber(69) ) local stats02 = getPedStat (localPlayer,tonumber(73) ) local stats03 = getPedStat (localPlayer,tonumber(78) ) local stats04 = getPedStat (localPlayer,tonumber(70) ) local stats05 = getPedStat (localPlayer,tonumber(74) ) local stats06 = getPedStat (localPlayer,tonumber(77) ) local stats07 = getPedStat (localPlayer,tonumber(71) ) local stats08 = getPedStat (localPlayer,tonumber(72) ) local stats09 = getPedStat (localPlayer,tonumber(75) ) local stats10 = getPedStat (localPlayer,tonumber(76) ) local stats11 = getPedStat (localPlayer,tonumber(79) ) local stats12 = getPedStat (localPlayer,tonumber(23) ) --my attempt local allstats = 1000*stats01/1000*stats02/1000*stats03/1000*stats04/1000*stats05/1000*stats06/1000*stats07/1000*stats08/1000*stats09/1000*stats10/1000*stats11/1000*stats12 dxDrawRectangle(cx*77, cy*530, cx*220/allstats, cy*7, tocolor(103, 188, 107 , 255), false) dxDrawText (allstats.."%", cx*69, cy*505, cx*150, cy*10, tocolor ( 0, 0, 0, 200 ), 1,"default-bold","left","top",false,false,false, true) Edited February 11, 2015 by Guest Link to comment
#RooTs Posted February 10, 2015 Author Share Posted February 10, 2015 use a table table? never seen it, can you give me an example? Link to comment
SkatCh Posted February 10, 2015 Share Posted February 10, 2015 (edited) i think you need something like this local stats = {69,73,78,70,74,77,71,72,75,76,79,23,} for i , v in ipairs (stats) do check = getPedStat (localPlayer,tonumber(v))/1000 end Edited February 10, 2015 by Guest Link to comment
xeon17 Posted February 10, 2015 Share Posted February 10, 2015 I would like to recommend you the tutorial of xXMADEXx which contain everything what you need to know about tables and also great examples https://forum.multitheftauto.com/viewtopic.php?f=148&t=75501 Link to comment
#RooTs Posted February 10, 2015 Author Share Posted February 10, 2015 i think you need something like this local stats = {69,73,78,70,74,77,71,72,75,76,79,23,} for i , v in ipairs (stats) do check = getPedStat (localPlayer,tonumber(v))/1000 end @SkatCh, I did the table, so I think there's something most wrong aii local stats = { {69,73,78,70,74,77,71,72,75,76,79,23}, } for _, v in ipairs (stats) do check = getPedStat (localPlayer,tonumber(v)) end dxDrawText (check.."%", cx*69, cy*505, cx*150, cy*10, tocolor ( 0, 0, 0, 200 ), 1,"default-bold","left","top",false,false,false, true) dxDrawText (check , cx*68, cy*504, cx*150, cy*10, tocolor ( 255, 165, 0, 255 ), 1,"default-bold","left","top",false,false,false, true) Link to comment
SkatCh Posted February 10, 2015 Share Posted February 10, 2015 Why you change it copy and past my code local stats = {69,73,78,70,74,77,71,72,75,76,79,23} for i, v in ipairs (stats) do check = getPedStat (localPlayer,tonumber(v)) end dxDrawText (check.."%", cx*69, cy*505, cx*150, cy*10, tocolor ( 0, 0, 0, 200 ), 1,"default-bold","left","top",false,false,false, true) dxDrawText (check , cx*68, cy*504, cx*150, cy*10, tocolor ( 255, 165, 0, 255 ), 1,"default-bold","left","top",false,false,false, true) Link to comment
#RooTs Posted February 10, 2015 Author Share Posted February 10, 2015 Why you change it copy and past my code local stats = {69,73,78,70,74,77,71,72,75,76,79,23} for i, v in ipairs (stats) do check = getPedStat (localPlayer,tonumber(v)) end dxDrawText (check.."%", cx*69, cy*505, cx*150, cy*10, tocolor ( 0, 0, 0, 200 ), 1,"default-bold","left","top",false,false,false, true) dxDrawText (check , cx*68, cy*504, cx*150, cy*10, tocolor ( 255, 165, 0, 255 ), 1,"default-bold","left","top",false,false,false, true) @SkatCh no work Link to comment
#RooTs Posted February 10, 2015 Author Share Posted February 10, 2015 post full code here. local screenW,screenH = guiGetScreenSize() local resW, resH = 1280, 720 local cx, cy = (screenW/resW), (screenH/resH) function Test ( ) local stats = {69,73,78,70,74,77,71,72,75,76,79,23} for i, v in ipairs (stats) do check = getPedStat (localPlayer,tonumber(v)) end dxDrawText (check.."%", cx*69, cy*505, cx*150, cy*10, tocolor ( 0, 0, 0, 200 ), 1,"default-bold","left","top",false,false,false, true) dxDrawText (check , cx*68, cy*504, cx*150, cy*10, tocolor ( 255, 165, 0, 255 ), 1,"default-bold","left","top",false,false,false, true) end addEventHandler("onClientRender", root, Test) Link to comment
SkatCh Posted February 10, 2015 Share Posted February 10, 2015 are you sure it's working fine local screenW,screenH = guiGetScreenSize() local resW, resH = 1280, 720 local cx, cy = (screenW/resW), (screenH/resH) local stats = {69,73,78,70,74,77,71,72,75,76,79,23} function Test ( ) for i, v in ipairs (stats) do check = getPedStat (localPlayer,tonumber(v)) end dxDrawText (check.."%", cx*69, cy*505, cx*150, cy*10, tocolor ( 0, 0, 0, 200 ), 1,"default-bold","left","top",false,false,false, true) dxDrawText (check , cx*68, cy*504, cx*150, cy*10, tocolor ( 255, 165, 0, 255 ), 1,"default-bold","left","top",false,false,false, true) end addEventHandler("onClientRender", root, Test) i can see it near to the radar Link to comment
#RooTs Posted February 10, 2015 Author Share Posted February 10, 2015 I can not understand. look all my stats and continue 0% and because the his it is 50%? Link to comment
RenanPG Posted February 11, 2015 Share Posted February 11, 2015 local stats = {69,73,78,70,74,77,71,72,75,76,79,23} local check = 0 for _, v in ipairs (stats) do check = check + getPedStat (localPlayer,v) end dxDrawText(check.....) 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