Trilon Posted April 6, 2016 Share Posted April 6, 2016 I have a big problem with level system. I wrote a level system script but it isn't working. The problem is, i get xp but i didn't get the levels. Somebody can help me? Server: function killZombie(killer,headshot) if killer then local xp = getElementData(killer,"xp") --outputChatBox("Megöltél egy Zombie-t ! Kaptál 1 XP pontot érte.", killer) if (xp == false or xp == "false") then setElementData(killer,"xp","0") setElementData(killer,"xp",xp+1) else setElementData(killer,"xp",xp+1) if (getElementData(killer,"xp") == 10 ) then if (getElementData(killer,"lvl") == "0" ) then setElementData(killer,"lvl","1") setElementData(killer,"xp","0") outputChatBox("Elérted az első szintet!") end end if (getElementData(killer,"xp") == 25) then if (getElementData(killer,"lvl") == "1") then setElementData(killer,"lvl","2") setElementData(killer,"xp","0") outputChatBox("Elérted a második szintet!") end end if (getElementData(killer,"xp") == 40) then if (getElementData(killer,"lvl") == "2") then setElementData(killer,"lvl","3") setElementData(killer,"xp","0") outputChatBox("Elérted a harmadik szintet!") end end if (getElementData(killer,"xp") == 60) then if (getElementData(killer,"lvl") == "3") then setElementData(killer,"lvl","4") setElementData(killer,"xp","0") outputChatBox("Elérted a negyedik szintet! ") end end if (getElementData(killer,"xp") == 75) then if (getElementData(killer,"lvl") == "4") then setElementData(killer,"lvl","5") setElementData(killer,"xp","0") outputChatBox("Elérted az ötödik szintet!") end end if (getElementData(killer,"xp") == 200) then if (getElementData(killer,"lvl") == "5") then setElementData(killer,"lvl","6") setElementData(killer,"xp","0") outputChatBox("Elérted a hatodik szintet!") end end if (getElementData(killer,"xp") == 230) then if (getElementData(killer,"lvl") == "6") then setElementData(killer,"lvl","7") setElementData(killer,"xp","0") outputChatBox("Elérted a hetedik szintet!") end end if (getElementData(killer,"xp") == 250) then if (getElementData(killer,"lvl") == "7") then setElementData(killer,"lvl","8") setElementData(killer,"xp","0") outputChatBox("Elérted a nyolcadik szintet!") end end if (getElementData(killer,"xp") == 270) then if (getElementData(killer,"lvl") == "8") then setElementData(killer,"lvl","9") setElementData(killer,"xp","0") outputChatBox("Elérted a kilencedik szintet!") end end if (getElementData(killer,"xp") == 290) then if (getElementData(killer,"lvl") == "9") then setElementData(killer,"lvl","10") setElementData(killer,"xp","0") outputChatBox("Elérted a tizedik szintet!") end end if (getElementData(killer,"xp") == 350) then if (getElementData(killer,"lvl") == "10") then setElementData(killer,"lvl","0") setElementData(killer,"xp","0") outputChatBox("Elérted az utolsó szintet! Az XP pontjaid és a szinted nullázódik.") end end end endendaddEvent("onZombieGetsKilled",true)addEventHandler("onZombieGetsKilled",root,killZombie) Clien: ablak = guiCreateWindow(0.8, 0.90, 0.09, 0.1, "XP", true) guiWindowSetMovable(ablak, false) guiWindowSetSizable(ablak, false) szoveg = guiCreateLabel(0.1, 0.52, 0.90, 0.35, "XP:0/10", true, ablak) szoveg2 = guiCreateLabel(0.1, 0.30, 0.90, 0.35, "Szint:0/10", true, ablak) guiSetVisible(ablak, true) function ujratolt() if getElementData(getLocalPlayer(),"logedin") then local xp = getElementData(getLocalPlayer(), "xp") local lvl = getElementData(getLocalPlayer(), "lvl") if (getElementData(getLocalPlayer(),"xp") == false or getElementData(getLocalPlayer(),"xp") == "false") then xp = "0/10" end if (getElementData(getLocalPlayer(),"lvl") == false or getElementData(getLocalPlayer(),"lvl") == "false") then lvl = "0/10" end if (getElementData(getLocalPlayer(), "lvl") == "0") or (getElementData(getLocalPlayer(), "lvl") == false) then xp = xp.. "/" .. "10" elseif (getElementData(getLocalPlayer(), "lvl") == "1") then xp = xp.. "/" .. "25" elseif (getElementData(getLocalPlayer(), "lvl") == "2") then xp = xp.. "/" .. "40" elseif (getElementData(getLocalPlayer(), "lvl") == "3") then xp = xp.. "/" .. "60" elseif (getElementData(getLocalPlayer(), "lvl") == "4") then xp = xp.. "/" .. "75" elseif (getElementData(getLocalPlayer(), "lvl") == "5") then xp = xp.. "/" .. "200" elseif (getElementData(getLocalPlayer(), "lvl") == "6") then xp = xp.. "/" .. "230" elseif (getElementData(getLocalPlayer(), "lvl") == "7") then xp = xp.. "/" .. "250" elseif (getElementData(getLocalPlayer(), "lvl") == "8") then xp = xp.. "/" .. "270" elseif (getElementData(getLocalPlayer(), "lvl") == "9") then xp = xp.. "/" .. "290" elseif (getElementData(getLocalPlayer(), "lvl") == "10") then xp = xp.. "/" .. "350" end guiSetText(szoveg2,"Szint: "..lvl) guiSetText(szoveg,"XP: "..xp) end endsetTimer(ujratolt,1000,0) Link to comment
Trilon Posted April 6, 2016 Author Share Posted April 6, 2016 I have a big problem with level system. I wrote a level system script but it isn't working. The problem is, i get xp but i didn't get the levels. Somebody can help me? Server: function killZombie(killer,headshot) if killer then local xp = getElementData(killer,"xp") --outputChatBox("Megöltél egy Zombie-t ! Kaptál 1 XP pontot érte.", killer) if (xp == false or xp == "false") then setElementData(killer,"xp","0") setElementData(killer,"xp",xp+1) else setElementData(killer,"xp",xp+1) if (getElementData(killer,"xp") == 10 ) then if (getElementData(killer,"lvl") == "0" ) then setElementData(killer,"lvl","1") setElementData(killer,"xp","0") outputChatBox("Elérted az első szintet!") end end if (getElementData(killer,"xp") == 25) then if (getElementData(killer,"lvl") == "1") then setElementData(killer,"lvl","2") setElementData(killer,"xp","0") outputChatBox("Elérted a második szintet!") end end if (getElementData(killer,"xp") == 40) then if (getElementData(killer,"lvl") == "2") then setElementData(killer,"lvl","3") setElementData(killer,"xp","0") outputChatBox("Elérted a harmadik szintet!") end end if (getElementData(killer,"xp") == 60) then if (getElementData(killer,"lvl") == "3") then setElementData(killer,"lvl","4") setElementData(killer,"xp","0") outputChatBox("Elérted a negyedik szintet! ") end end if (getElementData(killer,"xp") == 75) then if (getElementData(killer,"lvl") == "4") then setElementData(killer,"lvl","5") setElementData(killer,"xp","0") outputChatBox("Elérted az ötödik szintet!") end end if (getElementData(killer,"xp") == 200) then if (getElementData(killer,"lvl") == "5") then setElementData(killer,"lvl","6") setElementData(killer,"xp","0") outputChatBox("Elérted a hatodik szintet!") end end if (getElementData(killer,"xp") == 230) then if (getElementData(killer,"lvl") == "6") then setElementData(killer,"lvl","7") setElementData(killer,"xp","0") outputChatBox("Elérted a hetedik szintet!") end end if (getElementData(killer,"xp") == 250) then if (getElementData(killer,"lvl") == "7") then setElementData(killer,"lvl","8") setElementData(killer,"xp","0") outputChatBox("Elérted a nyolcadik szintet!") end end if (getElementData(killer,"xp") == 270) then if (getElementData(killer,"lvl") == "8") then setElementData(killer,"lvl","9") setElementData(killer,"xp","0") outputChatBox("Elérted a kilencedik szintet!") end end if (getElementData(killer,"xp") == 290) then if (getElementData(killer,"lvl") == "9") then setElementData(killer,"lvl","10") setElementData(killer,"xp","0") outputChatBox("Elérted a tizedik szintet!") end end if (getElementData(killer,"xp") == 350) then if (getElementData(killer,"lvl") == "10") then setElementData(killer,"lvl","0") setElementData(killer,"xp","0") outputChatBox("Elérted az utolsó szintet! Az XP pontjaid és a szinted nullázódik.") end end end end end addEvent("onZombieGetsKilled",true) addEventHandler("onZombieGetsKilled",root,killZombie) Clien: ablak = guiCreateWindow(0.8, 0.90, 0.09, 0.1, "XP", true) guiWindowSetMovable(ablak, false) guiWindowSetSizable(ablak, false) szoveg = guiCreateLabel(0.1, 0.52, 0.90, 0.35, "XP:0/10", true, ablak) szoveg2 = guiCreateLabel(0.1, 0.30, 0.90, 0.35, "Szint:0/10", true, ablak) guiSetVisible(ablak, true) function ujratolt() if getElementData(getLocalPlayer(),"logedin") then local xp = getElementData(getLocalPlayer(), "xp") local lvl = getElementData(getLocalPlayer(), "lvl") if (getElementData(getLocalPlayer(),"xp") == false or getElementData(getLocalPlayer(),"xp") == "false") then xp = "0/10" end if (getElementData(getLocalPlayer(),"lvl") == false or getElementData(getLocalPlayer(),"lvl") == "false") then lvl = "0/10" end if (getElementData(getLocalPlayer(), "lvl") == "0") or (getElementData(getLocalPlayer(), "lvl") == false) then xp = xp.. "/" .. "10" elseif (getElementData(getLocalPlayer(), "lvl") == "1") then xp = xp.. "/" .. "25" elseif (getElementData(getLocalPlayer(), "lvl") == "2") then xp = xp.. "/" .. "40" elseif (getElementData(getLocalPlayer(), "lvl") == "3") then xp = xp.. "/" .. "60" elseif (getElementData(getLocalPlayer(), "lvl") == "4") then xp = xp.. "/" .. "75" elseif (getElementData(getLocalPlayer(), "lvl") == "5") then xp = xp.. "/" .. "200" elseif (getElementData(getLocalPlayer(), "lvl") == "6") then xp = xp.. "/" .. "230" elseif (getElementData(getLocalPlayer(), "lvl") == "7") then xp = xp.. "/" .. "250" elseif (getElementData(getLocalPlayer(), "lvl") == "8") then xp = xp.. "/" .. "270" elseif (getElementData(getLocalPlayer(), "lvl") == "9") then xp = xp.. "/" .. "290" elseif (getElementData(getLocalPlayer(), "lvl") == "10") then xp = xp.. "/" .. "350" end guiSetText(szoveg2,"Szint: "..lvl) guiSetText(szoveg,"XP: "..xp) end end setTimer(ujratolt,1000,0) Link to comment
Seba500PLK Posted April 8, 2016 Share Posted April 8, 2016 --Server function killZombie(killer,headshot) if killer then local xp = getElementData(killer,"xp") if not xp then setElementData(killer,"xp",0) setElementData(killer,"xp",xp+1) else setElementData(killer,"xp",xp+1) if (getElementData(killer,"xp") == 10 ) then if (getElementData(killer,"lvl") == 0 ) then setElementData(killer,"lvl",1) setElementData(killer,"xp",0) outputChatBox("Elérted az első szintet!",killer) end end if (getElementData(killer,"xp") == 25) then if (getElementData(killer,"lvl") == 1) then setElementData(killer,"lvl",2) setElementData(killer,"xp",0) outputChatBox("Elérted a második szintet!",killer) end end if (getElementData(killer,"xp") == 40) then if (getElementData(killer,"lvl") == 2) then setElementData(killer,"lvl",3) setElementData(killer,"xp",0) outputChatBox("Elérted a harmadik szintet!",killer) end end if (getElementData(killer,"xp") == 60) then if (getElementData(killer,"lvl") == 3) then setElementData(killer,"lvl",4) setElementData(killer,"xp",0) outputChatBox("Elérted a negyedik szintet! ",killer) end end if (getElementData(killer,"xp") == 75) then if (getElementData(killer,"lvl") == 4) then setElementData(killer,"lvl",5) setElementData(killer,"xp",0) outputChatBox("Elérted az ötödik szintet!",killer) end end if (getElementData(killer,"xp") == 200) then if (getElementData(killer,"lvl") == 5) then setElementData(killer,"lvl",6) setElementData(killer,"xp",0) outputChatBox("Elérted a hatodik szintet!",killer) end end if (getElementData(killer,"xp") == 230) then if (getElementData(killer,"lvl") == 6) then setElementData(killer,"lvl",7) setElementData(killer,"xp",0) outputChatBox("Elérted a hetedik szintet!",killer) end end if (getElementData(killer,"xp") == 250) then if (getElementData(killer,"lvl") == 7) then setElementData(killer,"lvl",8) setElementData(killer,"xp",0) outputChatBox("Elérted a nyolcadik szintet!",killer) end end if (getElementData(killer,"xp") == 270) then if (getElementData(killer,"lvl") == 8 ) then setElementData(killer,"lvl",9) setElementData(killer,"xp",0) outputChatBox("Elérted a kilencedik szintet!",killer) end end if (getElementData(killer,"xp") == 290) then if (getElementData(killer,"lvl") == 9) then setElementData(killer,"lvl",10) setElementData(killer,"xp",0) outputChatBox("Elérted a tizedik szintet!",killer) end end if (getElementData(killer,"xp") == 350) then if (getElementData(killer,"lvl") == 10) then setElementData(killer,"lvl",0) setElementData(killer,"xp",0) outputChatBox("Elérted az utolsó szintet! Az XP pontjaid és a szinted nullázódik.",killer) end end end end end addEvent("onZombieGetsKilled",true) addEventHandler("onZombieGetsKilled",root,killZombie) --Client ablak = guiCreateWindow(0.8, 0.90, 0.09, 0.1, "XP", true) guiWindowSetMovable(ablak, false) guiWindowSetSizable(ablak, false) szoveg = guiCreateLabel(0.1, 0.52, 0.90, 0.35, "XP:0/10", true, ablak) szoveg2 = guiCreateLabel(0.1, 0.30, 0.90, 0.35, "Szint:0/10", true, ablak) guiSetVisible(ablak, true) function ujratolt() if getElementData(getLocalPlayer(),"logedin") then local xp = getElementData(getLocalPlayer(), "xp") local lvl = getElementData(getLocalPlayer(), "lvl") if not xp then XP = "0/10" end if not lvl then LVL = "0/10" else LVL = lvl.."/10" end if (lvl == 0) or (not lvl) then XP = xp.. "/" .. "10" elseif (getElementData(getLocalPlayer(), "lvl") == 1) then XP = xp.. "/" .. "25" elseif (getElementData(getLocalPlayer(), "lvl") == 2) then XP = xp.. "/" .. "40" elseif (getElementData(getLocalPlayer(), "lvl") == 3) then XP = xp.. "/" .. "60" elseif (getElementData(getLocalPlayer(), "lvl") == 4) then XP = xp.. "/" .. "75" elseif (getElementData(getLocalPlayer(), "lvl") == 5) then XP = xp.. "/" .. "200" elseif (getElementData(getLocalPlayer(), "lvl") == 6) then XP = xp.. "/" .. "230" elseif (getElementData(getLocalPlayer(), "lvl") == 7) then XP = xp.. "/" .. "250" elseif (getElementData(getLocalPlayer(), "lvl") == 8 ) then XP = xp.. "/" .. "270" elseif (getElementData(getLocalPlayer(), "lvl") == 9) then XP = xp.. "/" .. "290" elseif (getElementData(getLocalPlayer(), "lvl") == 10) then XP = xp.. "/" .. "350" end guiSetText(szoveg2,"Szint: "..LVL) guiSetText(szoveg,"XP: "..XP) end end setTimer(ujratolt,1000,0) Link to comment
Seba500PLK Posted April 8, 2016 Share Posted April 8, 2016 --Server function killZombie(killer,headshot) if killer then local xp = getElementData(killer,"xp") if not xp then setElementData(killer,"xp",0) setElementData(killer,"xp",xp+1) else setElementData(killer,"xp",xp+1) if (getElementData(killer,"xp") == 10 ) then if (getElementData(killer,"lvl") == 0 ) then setElementData(killer,"lvl",1) setElementData(killer,"xp",0) outputChatBox("Elérted az első szintet!",killer) end end if (getElementData(killer,"xp") == 25) then if (getElementData(killer,"lvl") == 1) then setElementData(killer,"lvl",2) setElementData(killer,"xp",0) outputChatBox("Elérted a második szintet!",killer) end end if (getElementData(killer,"xp") == 40) then if (getElementData(killer,"lvl") == 2) then setElementData(killer,"lvl",3) setElementData(killer,"xp",0) outputChatBox("Elérted a harmadik szintet!",killer) end end if (getElementData(killer,"xp") == 60) then if (getElementData(killer,"lvl") == 3) then setElementData(killer,"lvl",4) setElementData(killer,"xp",0) outputChatBox("Elérted a negyedik szintet! ",killer) end end if (getElementData(killer,"xp") == 75) then if (getElementData(killer,"lvl") == 4) then setElementData(killer,"lvl",5) setElementData(killer,"xp",0) outputChatBox("Elérted az ötödik szintet!",killer) end end if (getElementData(killer,"xp") == 200) then if (getElementData(killer,"lvl") == 5) then setElementData(killer,"lvl",6) setElementData(killer,"xp",0) outputChatBox("Elérted a hatodik szintet!",killer) end end if (getElementData(killer,"xp") == 230) then if (getElementData(killer,"lvl") == 6) then setElementData(killer,"lvl",7) setElementData(killer,"xp",0) outputChatBox("Elérted a hetedik szintet!",killer) end end if (getElementData(killer,"xp") == 250) then if (getElementData(killer,"lvl") == 7) then setElementData(killer,"lvl",8) setElementData(killer,"xp",0) outputChatBox("Elérted a nyolcadik szintet!",killer) end end if (getElementData(killer,"xp") == 270) then if (getElementData(killer,"lvl") == 8 ) then setElementData(killer,"lvl",9) setElementData(killer,"xp",0) outputChatBox("Elérted a kilencedik szintet!",killer) end end if (getElementData(killer,"xp") == 290) then if (getElementData(killer,"lvl") == 9) then setElementData(killer,"lvl",10) setElementData(killer,"xp",0) outputChatBox("Elérted a tizedik szintet!",killer) end end if (getElementData(killer,"xp") == 350) then if (getElementData(killer,"lvl") == 10) then setElementData(killer,"lvl",0) setElementData(killer,"xp",0) outputChatBox("Elérted az utolsó szintet! Az XP pontjaid és a szinted nullázódik.",killer) end end end end end addEvent("onZombieGetsKilled",true) addEventHandler("onZombieGetsKilled",root,killZombie) --Client ablak = guiCreateWindow(0.8, 0.90, 0.09, 0.1, "XP", true) guiWindowSetMovable(ablak, false) guiWindowSetSizable(ablak, false) szoveg = guiCreateLabel(0.1, 0.52, 0.90, 0.35, "XP:0/10", true, ablak) szoveg2 = guiCreateLabel(0.1, 0.30, 0.90, 0.35, "Szint:0/10", true, ablak) guiSetVisible(ablak, true) function ujratolt() if getElementData(getLocalPlayer(),"logedin") then local xp = getElementData(getLocalPlayer(), "xp") local lvl = getElementData(getLocalPlayer(), "lvl") if not xp then XP = "0/10" end if not lvl then LVL = "0/10" else LVL = lvl.."/10" end if (lvl == 0) or (not lvl) then XP = xp.. "/" .. "10" elseif (getElementData(getLocalPlayer(), "lvl") == 1) then XP = xp.. "/" .. "25" elseif (getElementData(getLocalPlayer(), "lvl") == 2) then XP = xp.. "/" .. "40" elseif (getElementData(getLocalPlayer(), "lvl") == 3) then XP = xp.. "/" .. "60" elseif (getElementData(getLocalPlayer(), "lvl") == 4) then XP = xp.. "/" .. "75" elseif (getElementData(getLocalPlayer(), "lvl") == 5) then XP = xp.. "/" .. "200" elseif (getElementData(getLocalPlayer(), "lvl") == 6) then XP = xp.. "/" .. "230" elseif (getElementData(getLocalPlayer(), "lvl") == 7) then XP = xp.. "/" .. "250" elseif (getElementData(getLocalPlayer(), "lvl") == 8 ) then XP = xp.. "/" .. "270" elseif (getElementData(getLocalPlayer(), "lvl") == 9) then XP = xp.. "/" .. "290" elseif (getElementData(getLocalPlayer(), "lvl") == 10) then XP = xp.. "/" .. "350" end guiSetText(szoveg2,"Szint: "..LVL) guiSetText(szoveg,"XP: "..XP) end end setTimer(ujratolt,1000,0) 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