yoya99 Posted October 19, 2014 Share Posted October 19, 2014 (edited) Hello friends ...here is my codefor my lvl system...i have a problem i want it to draw images for each lvl...But for some reason it is not working....here are all codes: a part only_: function win(ammo, killer, weapon, bodypart) if (killer and getElementType(killer) == "player" and killer ~= source) then local H = getElementData(killer, "XP") or 5 local S = getElementData(killer, "Level") local killer1 = getPlayerName(killer) local noob = getPlayerName(source) local X = 1 setElementData(killer, "XP", tonumber(H)+X) local H = tonumber(H) + X if tonumber(H) == 2 then setElementData(killer, "Level", "1") elseif tonumber(H) == 5 then setElementData(killer, "Level", "2") elseif tonumber(H) == 10 then setElementData(killer, "Level", "3") addEventHandler("onPlayerSpawn",root, function() local account = getPlayerAccount(source) local S = getElementData(killer, "Level") if tonumber(S) == 0 then setElementData(source,"Emblems","ranks/lvl_0.png") elseif tonumber(S) == 1 then setElementData(source,"Emblems","ranks/lvl_1.png") elseif tonumber(S) == 2 then setElementData(source,"Emblems","ranks/lvl_2.png") elseif tonumber(S) == 3 then setElementData(source,"Emblems","ranks/lvl_3.png") elseif tonumber(S) == 4 then setElementData(source,"Emblems","ranks/lvl_4.png") elseif tonumber(S) == 5 then setElementData(source,"Emblems","ranks/lvl_5.png") elseif tonumber(S) == 6 then setElementData(source,"Emblems","ranks/lvl_6.png") elseif tonumber(S) == 7 then setElementData(source,"Emblems","ranks/lvl_7.png") elseif tonumber(S) == 8 then setElementData(source,"Emblems","ranks/lvl_8.png") elseif tonumber(S) == 9 then setElementData(source,"Emblems","ranks/lvl_9.png") elseif tonumber(S) == 10 then setElementData(source,"Emblems","ranks/lvl_10.png") elseif tonumber(S) == 11 then setElementData(source,"Emblems","ranks/lvl_11.png") elseif tonumber(S) == 12 then setElementData(source,"Emblems","ranks/lvl_12.png") elseif tonumber(S) == 13 then setElementData(source,"Emblems","ranks/lvl_13.png") elseif tonumber(S) == 14 then setElementData(source,"Emblems","ranks/lvl_14.png") elseif tonumber(S) == 15 then setElementData(source,"Emblems","ranks/lvl_15.png") elseif tonumber(S) == 16 then setElementData(source,"Emblems","ranks/lvl_16.png") elseif tonumber(S) == 17 then setElementData(source,"Emblems","ranks/lvl_17.png") elseif tonumber(S) == 18 then setElementData(source,"Emblems","ranks/lvl_18.png") elseif tonumber(S) == 19 then setElementData(source,"Emblems","ranks/lvl_19.png") elseif tonumber(S) == 20 then setElementData(source,"Emblems","ranks/lvl_20.png") elseif tonumber(S) == 21 then setElementData(source,"Emblems","ranks/lvl_21.png") elseif tonumber(S) == 22 then setElementData(source,"Emblems","ranks/lvl_22.png") elseif tonumber(S) == 23 then setElementData(source,"Emblems","ranks/lvl_23.png") end end ) addEventHandler("onPlayerSpawn",root, function () local account = getPlayerAccount(source) if isGuestAccount(account) then return end local Emblems = getAccountData(account,"LV") if emblems then setElementData(source,"Emblems", emblems) end end ) hud part: if XP then dxDrawText("XP: "..XP, (336/1024)*sWidth, (745/768)*sHeight, (289/1024)*sWidth, (250/768)*sHeight, tocolor (255, 255, 255, 255), (0.85/1366)*sWidth,(0.9/768)*sHeight,"bankgothic","left","top",false,false,false,true) end if Level then dxDrawText("LV: "..Level, (466/1024)*sWidth, (745/768)*sHeight, (289/1024)*sWidth, (250/768)*sHeight, tocolor (255, 255, 255, 255), (0.85/1366)*sWidth,(0.9/768)*sHeight,"bankgothic","left","top",false,false,false,true) end if emblems and fileExists ( ":experiences/ranks/lvl_"..Rank..".png" ) then size = dxGetFontHeight((0.7/1366)*sWidth, "bankgothic") dxDrawImage((557/1024)*sWidth, (745/768)*sHeight, size, size, ":experiences/ranks/lvl_"..Rank..".png") I would be happy ifthis topic would be done ....thx in advance Edited October 19, 2014 by Guest Link to comment
manawydan Posted October 19, 2014 Share Posted October 19, 2014 i see some erros(i think), yoy try get one number from one string? Link to comment
yoya99 Posted October 19, 2014 Author Share Posted October 19, 2014 (edited) EDIt : in debugscript it says server lua:4 Bad argument @get element data at argument 1 , got nil] Edited October 19, 2014 by Guest Link to comment
yoya99 Posted October 19, 2014 Author Share Posted October 19, 2014 EDIt : in debugscript it says server lua:4 Bad argument @get element data (expected element at argument 1) , got nil] Link to comment
manawydan Posted October 19, 2014 Share Posted October 19, 2014 local account = getPlayerAccount(source) local S = getElementData(killer, "Level") killer no definid Link to comment
yoya99 Posted October 19, 2014 Author Share Posted October 19, 2014 oh...how to definid it? Link to comment
manawydan Posted October 19, 2014 Share Posted October 19, 2014 how you save the level and exp from player? you have use setAccountData(onPlayerQuit), and (onPlayerLogin) use getAccountData and setElementData, to set the exp and level data to player. ps: have other ways too, and you exp e level work fine?(only error in image or in all?)? Link to comment
yoya99 Posted October 19, 2014 Author Share Posted October 19, 2014 All work fine....pls just tell me how to definid it...ye the lvl and xp get saved...and my system working fine Link to comment
yoya99 Posted October 19, 2014 Author Share Posted October 19, 2014 oh...how to definid it? Just want to know that Link to comment
pa3ck Posted October 20, 2014 Share Posted October 20, 2014 You don't need to 'definid' it, source is 'definid' by the event ( actually it's define(d)). Just replace killer with 'source' at the onPlayerspawn event. Link to comment
yoya99 Posted October 24, 2014 Author Share Posted October 24, 2014 still doesnt draws any image... Link to comment
Recommended Posts