-.Paradox.- Posted July 8, 2013 Author Posted July 8, 2013 function="getPlayerLevel" type="server" /> function="setPlayerLevel" type="server" /> function="getPlayerExP" type="server" /> function="setPlayerExP" type="server" /> function="getLevelData" type="server" /> like that ?
-.Paradox.- Posted July 11, 2013 Author Posted July 11, 2013 I have another trouble if player like example have in experience 112 he don't move to level 1. P.S : It was working fine. here's the lua exports.scoreboard:scoreboardAddColumn("Level") local levels = {[100] = 1, [200] = 2, [300] = 3, [400] = 4, [500] = 5, [1000] = 6, [2500] = 7, [5000] = 8, [7000] = 9, [10000] = 10, [15000] = 11, [20000] = 12, [30000] = 13, [55000] = 14, [65000] = 15} function win(ammo, killer, weapon, bodypart) if (killer and killer ~= source) then local H = getElementData(killer, "ExP") local S = getElementData(killer, "Level") local killer1 = getPlayerName(killer) local noob = getPlayerName(source) setElementData(killer, "ExP", tonumber(H)+math.random ( 10, 80 ) ) if levels[tonumber(H)] then setElementData(killer, "Level", "Lvl ".. tostring(levels[tonumber(H)]) .." ! ") triggerClientEvent ( killer, "playSound", killer ) end end local H = getElementData ( source, "ExP" ) or 0 setElementData ( source, "ExP", tonumber ( H ) - math.random ( 5, 50 ) ) end addEventHandler( "onPlayerWasted", getRootElement(), win) function onLogin (_,account) setElementData(source, "Level", getAccountData(account, "lvl") or "0") setElementData(source, "ExP", getAccountData(account, "exp") or "0") end addEventHandler ("onPlayerLogin", root, onLogin) function saveData(thePlayer, theAccount) if (theAccount and not isGuestAccount(theAccount)) then setAccountData (theAccount, "lvl", getElementData(thePlayer, "Level")) setAccountData (theAccount, "exp", getElementData(thePlayer, "ExP")) end end addEventHandler ("onPlayerQuit", root, function () saveData(source, getPlayerAccount(source)) end) addEventHandler ("onPlayerLogout", root, function (prev) saveData(source, prev) end)
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