Lachuks Posted November 20, 2017 Share Posted November 20, 2017 (edited) Hello there! Tryed to make stats script but... I don't understand how to make dx list. It shows only 1 language when my character know ~2. Hope you can understand what I mean. It should look like this Code for i = 1, 3 do local lang = getElementData(localPlayer, "languages.lang" .. i) if lang and lang ~= 0 then local skill = getElementData(localPlayer, "languages.lang" .. i .. "skill") local langname = exports['language-system']:getLanguageName(lang) if langname then valoda = "\n - "..langname.."("..skill.."%)" end end end -- and dxDrawText("Valodas: "..valoda, screenW * 0.2161, screenH * 0.4981, screenW * 0.4130, screenH * 0.5574, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", true, true, false, false, false) Edited November 20, 2017 by Emix Link to comment
msyyn Posted November 20, 2017 Share Posted November 20, 2017 (edited) valoda = valoda .. "\n - "..langname.."("..skill.."%)" You're overwriting the valoda variable each time it loops, so you need to include the previous content of the variable to show all the languages. Edited November 20, 2017 by msyyn 1 Link to comment
Lachuks Posted November 20, 2017 Author Share Posted November 20, 2017 27 minutes ago, msyyn said: valoda = valoda .. "\n - "..langname.."("..skill.."%)" You're overwriting the valoda variable each time it loops, so you need to include the previous content of the variable to show all the languages. Thank you for help but it's not working. Link to comment
msyyn Posted November 20, 2017 Share Posted November 20, 2017 (edited) 24 minutes ago, Emix said: Thank you for help but it's not working. What does the debug console say? Try defining variable valoda before the loop (e.g. local valoda = "") Make sure that dxDraw doesn't clip the text. EDIT: local valoda = "" for i = 1, 3 do local lang = getElementData(localPlayer, "languages.lang" .. i) if lang and lang ~= 0 then local skill = getElementData(localPlayer, "languages.lang" .. i .. "skill") local langname = exports['language-system']:getLanguageName(lang) if langname then valoda = valoda .. "\n - "..langname.."("..skill.."%)" end end end -- and dxDrawText("Valodas: "..valoda, screenW * 0.2161, screenH * 0.4981, screenW * 0.4130, screenH * 0.5574, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, true, false, false, false) Edited November 20, 2017 by msyyn 1 Link to comment
Lachuks Posted November 20, 2017 Author Share Posted November 20, 2017 (edited) I forgot to add local valoda = " " Thank you! ^.^ Works great Edited November 20, 2017 by Emix 1 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