-.Paradox.- Posted August 7, 2013 Share Posted August 7, 2013 Hello all, i have a bug with this script, it wont level up when somebody reach the experience required for here is the code. function win(ammo, killer, weapon, bodypart) if (killer and killer ~= source) then local H = getElementData(killer, "XP") local S = getElementData(killer, "Level") local killer1 = getPlayerName(killer) local noob = getPlayerName(source) setElementData(killer, "XP", tonumber(H)+math.random ( 5, 70 ) ) if tonumber(H) == 100 then setElementData(killer, "Level", "Lvl 1") elseif tonumber(H) == 400 then setElementData(killer, "Level", "Lvl 2") elseif tonumber(H) == 600 then setElementData(killer, "Level", "Lvl 3") elseif tonumber(H) == 800 then setElementData(killer, "Level", "Lvl 4") elseif tonumber(H) == 1000 then setElementData(killer, "Level", "Lvl 5") elseif tonumber(H) == 1200 then setElementData(killer, "Level", "Lvl 6") elseif tonumber(H) == 1400 then setElementData(killer, "Level", "Lvl 7") elseif tonumber(H) == 1600 then setElementData(killer, "Level", "Lvl 8") elseif tonumber(H) == 1800 then setElementData(killer, "Level", "Lvl 9") elseif tonumber(H) == 2000 then setElementData(killer, "Level", "Lvl 10") elseif tonumber(H) == 2200 then setElementData(killer, "Level", "Lvl 11") elseif tonumber(H) == 2400 then setElementData(killer, "Level", "Lvl 12") elseif tonumber(H) == 2600 then setElementData(killer, "Level", "Lvl 13") elseif tonumber(H) == 2800 then setElementData(killer, "Level", "Lvl 14") elseif tonumber(H) == 4000 then setElementData(killer, "Level", "Lvl 15") elseif tonumber(H) == 4200 then setElementData(killer, "Level", "Lvl 16") elseif tonumber(H) == 4400 then setElementData(killer, "Level", "Lvl 17") elseif tonumber(H) == 4600 then setElementData(killer, "Level", "Lvl 18") elseif tonumber(H) == 4800 then setElementData(killer, "Level", "Lvl 19") elseif tonumber(H) == 4900 then setElementData(killer, "Level", "Lvl 20") elseif tonumber(H) == 7000 then setElementData(killer, "Level", "Lvl 21") elseif tonumber(H) == 9000 then setElementData(killer, "Level", "Lvl 22") elseif tonumber(H) == 15999 then setElementData(killer, "Level", "Lvl 23") end end end addEventHandler( "onPlayerWasted", getRootElement(), win) function onLogin (_,account) setElementData(source, "Level", getAccountData(account, "LV") or "0") setElementData(source, "XP", getAccountData(account, "EXP") or "0") end addEventHandler ("onPlayerLogin", root, onLogin) function saveData(thePlayer, theAccount) local theAccount = getPlayerAccount(source) if (theAccount and not isGuestAccount(theAccount)) then setAccountData (theAccount, "LV", getElementData(thePlayer, "Level")) setAccountData (theAccount, "EXP", getElementData(thePlayer, "XP")) end end addEventHandler ("onPlayerQuit", root, function () saveData(source, getPlayerAccount(source)) end) addEventHandler ("onPlayerLogout", root, function (prev) saveData(source, prev) end) Link to comment
TAPL Posted August 8, 2013 Share Posted August 8, 2013 function win(ammo, killer, weapon, bodypart) if (killer and getElementType(killer) == "player" and killer ~= source) then local H = getElementData(killer, "XP") or 0 local S = getElementData(killer, "Level") local killer1 = getPlayerName(killer) local noob = getPlayerName(source) local X = math.random(5, 70) setElementData(killer, "XP", tonumber(H)+X) local H = tonumber(H) + X if tonumber(H) == 100 then setElementData(killer, "Level", "Lvl 1") elseif tonumber(H) == 400 then setElementData(killer, "Level", "Lvl 2") elseif tonumber(H) == 600 then setElementData(killer, "Level", "Lvl 3") elseif tonumber(H) == 800 then setElementData(killer, "Level", "Lvl 4") elseif tonumber(H) == 1000 then setElementData(killer, "Level", "Lvl 5") elseif tonumber(H) == 1200 then setElementData(killer, "Level", "Lvl 6") elseif tonumber(H) == 1400 then setElementData(killer, "Level", "Lvl 7") elseif tonumber(H) == 1600 then setElementData(killer, "Level", "Lvl 8") elseif tonumber(H) == 1800 then setElementData(killer, "Level", "Lvl 9") elseif tonumber(H) == 2000 then setElementData(killer, "Level", "Lvl 10") elseif tonumber(H) == 2200 then setElementData(killer, "Level", "Lvl 11") elseif tonumber(H) == 2400 then setElementData(killer, "Level", "Lvl 12") elseif tonumber(H) == 2600 then setElementData(killer, "Level", "Lvl 13") elseif tonumber(H) == 2800 then setElementData(killer, "Level", "Lvl 14") elseif tonumber(H) == 4000 then setElementData(killer, "Level", "Lvl 15") elseif tonumber(H) == 4200 then setElementData(killer, "Level", "Lvl 16") elseif tonumber(H) == 4400 then setElementData(killer, "Level", "Lvl 17") elseif tonumber(H) == 4600 then setElementData(killer, "Level", "Lvl 18") elseif tonumber(H) == 4800 then setElementData(killer, "Level", "Lvl 19") elseif tonumber(H) == 4900 then setElementData(killer, "Level", "Lvl 20") elseif tonumber(H) == 7000 then setElementData(killer, "Level", "Lvl 21") elseif tonumber(H) == 9000 then setElementData(killer, "Level", "Lvl 22") elseif tonumber(H) == 15999 then setElementData(killer, "Level", "Lvl 23") end end end addEventHandler( "onPlayerWasted", getRootElement(), win) function onLogin (_,account) setElementData(source, "Level", getAccountData(account, "LV") or "0") setElementData(source, "XP", getAccountData(account, "EXP") or "0") end addEventHandler ("onPlayerLogin", root, onLogin) function saveData(thePlayer, theAccount) local theAccount = getPlayerAccount(source) if (theAccount and not isGuestAccount(theAccount)) then setAccountData (theAccount, "LV", getElementData(thePlayer, "Level")) setAccountData (theAccount, "EXP", getElementData(thePlayer, "XP")) end end addEventHandler ("onPlayerQuit", root, function () saveData(source, getPlayerAccount(source)) end) addEventHandler ("onPlayerLogout", root, function (prev) saveData(source, prev) end) Link to comment
-.Paradox.- Posted August 9, 2013 Author Share Posted August 9, 2013 Not working the XP returning false, can somebod yhelp me please. Link to comment
TAPL Posted August 9, 2013 Share Posted August 9, 2013 Not false, it's just your comparison won't equal. if you want it work, you'll have to change this line local X = math.random(5, 70) to local X = 100 Otherwise you have to change your comparison and use < and > and <= and >= Link to comment
-.Paradox.- Posted September 20, 2013 Author Share Posted September 20, 2013 Same problem help please Link to comment
-.Paradox.- Posted September 22, 2013 Author Share Posted September 22, 2013 (edited) Help Edited September 24, 2013 by Guest Link to comment
Moderators IIYAMA Posted September 23, 2013 Moderators Share Posted September 23, 2013 function win(ammo, killer, weapon, bodypart) if (killer and getElementType(killer) == "player" and killer ~= source) then local H = getElementData(killer, "XP") or 0 --local S = getElementData(killer, "Level") local killer1 = getPlayerName(killer) local noob = getPlayerName(source) local X = math.random(5, 70) setElementData(killer, "XP", tonumber(H)+X) local H = tonumber(H) + X if tonumber(H) <= 100 then setElementData(killer, "Level", "Lvl 0") elseif tonumber(H) <= 400 then setElementData(killer, "Level", "Lvl 1") elseif tonumber(H) <= 600 then setElementData(killer, "Level", "Lvl 2") elseif tonumber(H) <= 800 then setElementData(killer, "Level", "Lvl 3") elseif tonumber(H) <= 1000 then setElementData(killer, "Level", "Lvl 4") elseif tonumber(H) <= 1200 then setElementData(killer, "Level", "Lvl 5") elseif tonumber(H) <= 1400 then setElementData(killer, "Level", "Lvl 6") elseif tonumber(H) <= 1600 then setElementData(killer, "Level", "Lvl 7") elseif tonumber(H) <= 1800 then setElementData(killer, "Level", "Lvl 8") elseif tonumber(H) <= 2000 then setElementData(killer, "Level", "Lvl 9") elseif tonumber(H) <= 2200 then setElementData(killer, "Level", "Lvl 10") elseif tonumber(H) <= 2400 then setElementData(killer, "Level", "Lvl 11") elseif tonumber(H) <= 2600 then setElementData(killer, "Level", "Lvl 12") elseif tonumber(H) <= 2800 then setElementData(killer, "Level", "Lvl 13") elseif tonumber(H) <= 4000 then setElementData(killer, "Level", "Lvl 14") elseif tonumber(H) <= 4200 then setElementData(killer, "Level", "Lvl 15") elseif tonumber(H) <= 4400 then setElementData(killer, "Level", "Lvl 16") elseif tonumber(H) <= 4600 then setElementData(killer, "Level", "Lvl 17") elseif tonumber(H) <= 4800 then setElementData(killer, "Level", "Lvl 18") elseif tonumber(H) <= 4900 then setElementData(killer, "Level", "Lvl 19") elseif tonumber(H) <= 7000 then setElementData(killer, "Level", "Lvl 20") elseif tonumber(H) <= 9000 then setElementData(killer, "Level", "Lvl 21") elseif tonumber(H) <= 15999 then setElementData(killer, "Level", "Lvl 22") elseif tonumber(H) > 15999 then setElementData(killer, "Level", "Lvl 23") end end end addEventHandler( "onPlayerWasted", getRootElement(), win) function onLogin (_,account) setElementData(source, "Level", getAccountData(account, "LV") or "Lvl 0") setElementData(source, "XP", getAccountData(account, "EXP") or 0) end addEventHandler ("onPlayerLogin", root, onLogin) function saveData(thePlayer, theAccount) --local theAccount = getPlayerAccount(source) -- you already have the account..... fu nonsens ! if (theAccount and not isGuestAccount(theAccount)) then setAccountData (theAccount, "LV", getElementData(thePlayer, "Level") or 0) setAccountData (theAccount, "EXP", getElementData(thePlayer, "XP") or 0) end end addEventHandler ("onPlayerQuit", root, function () saveData(source, getPlayerAccount(source)) end) addEventHandler ("onPlayerLogout", root, function (prev) saveData(source, prev) end) If you say again that it didn't work or bumb again I will start give sarcastic comments on all your fu topics. Link to comment
-.Paradox.- Posted September 24, 2013 Author Share Posted September 24, 2013 Thank you. Link to comment
K4stic Posted September 25, 2013 Share Posted September 25, 2013 function win(ammo, killer, weapon, bodypart) if (killer and getElementType(killer) == "player" and killer ~= source) then local H = getElementData(killer, "XP") or 0 --local S = getElementData(killer, "Level") local killer1 = getPlayerName(killer) local noob = getPlayerName(source) local X = math.random(5, 70) setElementData(killer, "XP", tonumber(H)+X) local H = tonumber(H) + X if tonumber(H) <= 100 then setElementData(killer, "Level", "Lvl 0") elseif tonumber(H) <= 400 then setElementData(killer, "Level", "Lvl 1") elseif tonumber(H) <= 600 then setElementData(killer, "Level", "Lvl 2") elseif tonumber(H) <= 800 then setElementData(killer, "Level", "Lvl 3") elseif tonumber(H) <= 1000 then setElementData(killer, "Level", "Lvl 4") elseif tonumber(H) <= 1200 then setElementData(killer, "Level", "Lvl 5") elseif tonumber(H) <= 1400 then setElementData(killer, "Level", "Lvl 6") elseif tonumber(H) <= 1600 then setElementData(killer, "Level", "Lvl 7") elseif tonumber(H) <= 1800 then setElementData(killer, "Level", "Lvl 8") elseif tonumber(H) <= 2000 then setElementData(killer, "Level", "Lvl 9") elseif tonumber(H) <= 2200 then setElementData(killer, "Level", "Lvl 10") elseif tonumber(H) <= 2400 then setElementData(killer, "Level", "Lvl 11") elseif tonumber(H) <= 2600 then setElementData(killer, "Level", "Lvl 12") elseif tonumber(H) <= 2800 then setElementData(killer, "Level", "Lvl 13") elseif tonumber(H) <= 4000 then setElementData(killer, "Level", "Lvl 14") elseif tonumber(H) <= 4200 then setElementData(killer, "Level", "Lvl 15") elseif tonumber(H) <= 4400 then setElementData(killer, "Level", "Lvl 16") elseif tonumber(H) <= 4600 then setElementData(killer, "Level", "Lvl 17") elseif tonumber(H) <= 4800 then setElementData(killer, "Level", "Lvl 18") elseif tonumber(H) <= 4900 then setElementData(killer, "Level", "Lvl 19") elseif tonumber(H) <= 7000 then setElementData(killer, "Level", "Lvl 20") elseif tonumber(H) <= 9000 then setElementData(killer, "Level", "Lvl 21") elseif tonumber(H) <= 15999 then setElementData(killer, "Level", "Lvl 22") elseif tonumber(H) > 15999 then setElementData(killer, "Level", "Lvl 23") end end end addEventHandler( "onPlayerWasted", getRootElement(), win) function onLogin (_,account) setElementData(source, "Level", getAccountData(account, "LV") or "Lvl 0") setElementData(source, "XP", getAccountData(account, "EXP") or 0) end addEventHandler ("onPlayerLogin", root, onLogin) function saveData(thePlayer, theAccount) --local theAccount = getPlayerAccount(source) -- you already have the account..... fu nonsens ! if (theAccount and not isGuestAccount(theAccount)) then setAccountData (theAccount, "LV", getElementData(thePlayer, "Level") or 0) setAccountData (theAccount, "EXP", getElementData(thePlayer, "XP") or 0) end end addEventHandler ("onPlayerQuit", root, function () saveData(source, getPlayerAccount(source)) end) addEventHandler ("onPlayerLogout", root, function (prev) saveData(source, prev) end) If you say again that it didn't work or bumb again I will start give sarcastic comments on all your fu topics. relax Bro Link to comment
Moderators IIYAMA Posted September 25, 2013 Moderators Share Posted September 25, 2013 @CastielRecords Maybe you should find the definition of 'bro', because I am not even close your "bro". I am relaxed, telling me that I should relax will cause the opposite. I will not visiting this subtopic any more, post anything after this towards me would be useless. Link to comment
K4stic Posted September 25, 2013 Share Posted September 25, 2013 i just call you friendly ("Bro") not the Bro like Brother Link to comment
-.Paradox.- Posted September 27, 2013 Author Share Posted September 27, 2013 Didn't work Link to comment
K4stic Posted September 27, 2013 Share Posted September 27, 2013 function win( ammo, killer, weapon, bodypart ) if ( killer and getElementType( killer ) == "player" and killer ~= source ) then local H = tonumber( getElementData( killer, "XP" ) ) or 0 local S = getElementData( killer, "Level" ) local killer1 = getPlayerName( killer ) local noob = getPlayerName( source ) local X = math.random( 5, 70 ) setElementData( killer, "XP", H + X ) local H = H + X if ( H == 100 ) then setElementData(killer, "Level", "Lvl 1") elseif ( H == 400 ) then setElementData(killer, "Level", "Lvl 2") elseif ( H == 600 ) then setElementData(killer, "Level", "Lvl 3") elseif ( H == 800 ) then setElementData(killer, "Level", "Lvl 4") elseif ( H == 1000 ) then setElementData(killer, "Level", "Lvl 5") elseif ( H == 1200 ) then setElementData(killer, "Level", "Lvl 6") elseif ( H == 1400 ) then setElementData(killer, "Level", "Lvl 7") elseif ( H == 1600 ) then setElementData(killer, "Level", "Lvl 8") elseif ( H == 1800 ) then setElementData(killer, "Level", "Lvl 9") elseif ( H == 2000 ) then setElementData(killer, "Level", "Lvl 10") elseif ( H == 2200 ) then setElementData(killer, "Level", "Lvl 11") elseif ( H == 2400 ) then setElementData(killer, "Level", "Lvl 12") elseif ( H == 2600 ) then setElementData(killer, "Level", "Lvl 13") elseif ( H == 2800 ) then setElementData(killer, "Level", "Lvl 14") elseif ( H == 4000 ) then setElementData(killer, "Level", "Lvl 15") elseif ( H == 4200 ) then setElementData(killer, "Level", "Lvl 16") elseif ( H == 4400 ) then setElementData(killer, "Level", "Lvl 17") elseif ( H == 4600 ) then setElementData(killer, "Level", "Lvl 18") elseif ( H == 4800 ) then setElementData(killer, "Level", "Lvl 19") elseif ( H == 4900 ) then setElementData(killer, "Level", "Lvl 20") elseif ( H == 7000 ) then setElementData(killer, "Level", "Lvl 21") elseif ( H == 9000 ) then setElementData(killer, "Level", "Lvl 22") elseif ( H == 15999 ) then setElementData(killer, "Level", "Lvl 23") end end end addEventHandler( "onPlayerWasted", root, win) function onLogin ( ) local account = getAccountName ( getPlayerAccount ( source ) ) if ( account ) then setElementData(source, "Level", getAccountData(account, "LV") or "0" ) setElementData(source, "XP", getAccountData(account, "EXP") or "0" ) end end addEventHandler ("onPlayerLogin", root, onLogin) function saveData(quitType, reason, responsibleElement) local theAccount = getPlayerAccount( source ) if (theAccount and not isGuestAccount(theAccount)) then setAccountData (theAccount, "LV", getElementData(source, "Level")) setAccountData (theAccount, "EXP", getElementData(source, "XP")) end end addEventHandler ("onPlayerQuit", root, saveData ) addEventHandler ("onPlayerLogout", root, saveData ) This Must work You was make some fails :3 at save and load data and at function win Link to comment
-.Paradox.- Posted September 27, 2013 Author Share Posted September 27, 2013 OMFG ! thanks man you are the best :DDD Link to comment
K4stic Posted September 28, 2013 Share Posted September 28, 2013 OMFG ! thanks man you are the best :DDD Your Welcome! 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