OrbTanT Posted August 21, 2014 Share Posted August 21, 2014 Good, this is the first time that I am messing with experience, and I would like to know how can I use the function of resource exp_system Castillo, I have to download the exp_system for using or only export the functions? Link to comment
Karuzo Posted August 21, 2014 Share Posted August 21, 2014 Both, if i understand you right. Link to comment
OrbTanT Posted August 21, 2014 Author Share Posted August 21, 2014 I can create the script only exporting functions, or do I have to have the resource of EXP_system Link to comment
DNL291 Posted August 21, 2014 Share Posted August 21, 2014 You must use the resource and you can use the exported functions too... Link to comment
OrbTanT Posted August 21, 2014 Author Share Posted August 21, 2014 How can I leave on the scoreboard, the value of "Level". exports [ "scoreboard" ]:addScoreboardColumn ( "Level", 4 ) function level ( player, Level ) for index, player in ipairs ( getElementsByType "player" ) do local account = getAccountData ( player ) local Level = 1 local myExp = setAccountData ( account, player) end end MUST have some errors, first time with getAccountData and setAccountData. Link to comment
Castillo Posted August 21, 2014 Share Posted August 21, 2014 You must use setElementData. Link to comment
OrbTanT Posted August 21, 2014 Author Share Posted August 21, 2014 Is not working, create a column "level" more does not show the level of the player, right way to use setElementData? exports [ "scoreboard" ]:addScoreboardColumn ( "Level", 4 ) addCommandHandler ( "mylevel", function ( player, theLevel ) for index, player in ipairs ( getElementsByType "player" ) do local account = getAccountData ( player ) local theLevel = 1 local myExp = setAccountData ( account, player) setElementData ( player, "Level", theLevel ) end end ) Link to comment
Castillo Posted August 21, 2014 Share Posted August 21, 2014 If you are using my resource, then you must create the scoreboard column with data name "level" lowercase. Link to comment
OrbTanT Posted August 21, 2014 Author Share Posted August 21, 2014 Yes I am trying to use, your Resource, more i do not understand very well, how should I use to create the level and exp Link to comment
OrbTanT Posted August 22, 2014 Author Share Posted August 22, 2014 How can I save the XPs and LVLs when the player exits the game and load, xp and lvl when you enter. exports.scoreboard:scoreboardAddColumn("EXP") exports.scoreboard:scoreboardAddColumn("Level") function level () for index, player in ipairs ( getElementsByType "player" ) do setElementData( player, "Level", "lvl 1") setElementData( player, "EXP", 0) end end addEventHandler("onPlayerLogin", getRootElement(), level) function levelup (ammo, killer, weapon, bodypart) local XP = getElementData(killer, "EXP") local LVL = getElementData(killer, "Level") if killer and killer ~=source then setElementData(killer, "EXP", tonumber(XP)+10) if tonumber(XP) == 100 then setElementData(killer, "Level", "lvl 2") elseif tonumber(XP) == 200 then setElementData(killer, "Level", "lvl 3") elseif tonumber(XP) == 300 then setElementData(killer, "Level", "lvl 4") elseif tonumber(XP) == 400 then setElementData(killer, "Level", "lvl 5") elseif tonumber(XP) == 500 then setElementData(killer, "Level", "lvl 6") elseif tonumber(XP) == 600 then setElementData(killer, "Level", "lvl 7") elseif tonumber(XP) == 700 then setElementData(killer, "Level", "lvl 8") elseif tonumber(XP) == 800 then setElementData(killer, "Level", "lvl 9") elseif tonumber(XP) == 900 then setElementData(killer, "Level", "lvl 10") end end end addEventHandler("onPlayerWasted", getRootElement(), levelup) Link to comment
Max+ Posted August 22, 2014 Share Posted August 22, 2014 How can I save the XPs and LVLs when the player exits the game and load, xp and lvl when you enter. exports.scoreboard:scoreboardAddColumn("EXP") exports.scoreboard:scoreboardAddColumn("Level") function level () for index, player in ipairs ( getElementsByType "player" ) do setElementData( player, "Level", "lvl 1") setElementData( player, "EXP", 0) end end addEventHandler("onPlayerLogin", getRootElement(), level) function levelup (ammo, killer, weapon, bodypart) local XP = getElementData(killer, "EXP") local LVL = getElementData(killer, "Level") if killer and killer ~=source then setElementData(killer, "EXP", tonumber(XP)+10) if tonumber(XP) == 100 then setElementData(killer, "Level", "lvl 2") elseif tonumber(XP) == 200 then setElementData(killer, "Level", "lvl 3") elseif tonumber(XP) == 300 then setElementData(killer, "Level", "lvl 4") elseif tonumber(XP) == 400 then setElementData(killer, "Level", "lvl 5") elseif tonumber(XP) == 500 then setElementData(killer, "Level", "lvl 6") elseif tonumber(XP) == 600 then setElementData(killer, "Level", "lvl 7") elseif tonumber(XP) == 700 then setElementData(killer, "Level", "lvl 8") elseif tonumber(XP) == 800 then setElementData(killer, "Level", "lvl 9") elseif tonumber(XP) == 900 then setElementData(killer, "Level", "lvl 10") end end end addEventHandler("onPlayerWasted", getRootElement(), levelup) I , Just hate when someone's steal My Codes , Why Don't you meak your Own ? Link to comment
xeon17 Posted August 22, 2014 Share Posted August 22, 2014 How can I save the XPs and LVLs when the player exits the game and load, xp and lvl when you enter. exports.scoreboard:scoreboardAddColumn("EXP") exports.scoreboard:scoreboardAddColumn("Level") function level () for index, player in ipairs ( getElementsByType "player" ) do setElementData( player, "Level", "lvl 1") setElementData( player, "EXP", 0) end end addEventHandler("onPlayerLogin", getRootElement(), level) function levelup (ammo, killer, weapon, bodypart) local XP = getElementData(killer, "EXP") local LVL = getElementData(killer, "Level") if killer and killer ~=source then setElementData(killer, "EXP", tonumber(XP)+10) if tonumber(XP) == 100 then setElementData(killer, "Level", "lvl 2") elseif tonumber(XP) == 200 then setElementData(killer, "Level", "lvl 3") elseif tonumber(XP) == 300 then setElementData(killer, "Level", "lvl 4") elseif tonumber(XP) == 400 then setElementData(killer, "Level", "lvl 5") elseif tonumber(XP) == 500 then setElementData(killer, "Level", "lvl 6") elseif tonumber(XP) == 600 then setElementData(killer, "Level", "lvl 7") elseif tonumber(XP) == 700 then setElementData(killer, "Level", "lvl 8") elseif tonumber(XP) == 800 then setElementData(killer, "Level", "lvl 9") elseif tonumber(XP) == 900 then setElementData(killer, "Level", "lvl 10") end end end addEventHandler("onPlayerWasted", getRootElement(), levelup) I , Just hate when someone's steal My Codes , Why Don't you meak your Own ? Cuz it's easier to steal Link to comment
Et-win Posted August 22, 2014 Share Posted August 22, 2014 Cuz it's easier to steal Continue like that and you never will learn. Link to comment
xeon17 Posted August 22, 2014 Share Posted August 22, 2014 Cuz it's easier to steal Continue like that and you never will learn. Keep calm it's just a joke. Link to comment
-.Paradox.- Posted August 22, 2014 Share Posted August 22, 2014 exports.scoreboard:scoreboardAddColumn("EXP") exports.scoreboard:scoreboardAddColumn("Level") function levelup (ammo, killer, weapon, bodypart) if (killer and getElementType(killer) == "player" and killer ~= source) then local XP = getElementData(killer, "EXP") or 0 local LVL = getElementData(killer, "Level") or 1 setElementData(killer, "EXP", tonumber(XP)+10) if tonumber(XP) == 100 then setElementData(killer, "Level", 2) elseif tonumber(XP) == 200 then setElementData(killer, "Level", 3) elseif tonumber(XP) == 300 then setElementData(killer, "Level", 4) elseif tonumber(XP) == 400 then setElementData(killer, "Level", 5) elseif tonumber(XP) == 500 then setElementData(killer, "Level", 6) elseif tonumber(XP) == 600 then setElementData(killer, "Level", 7) elseif tonumber(XP) == 700 then setElementData(killer, "Level", 7) elseif tonumber(XP) == 800 then setElementData(killer, "Level", 7) elseif tonumber(XP) == 900 then setElementData(killer, "Level", 10) end end end addEventHandler("onPlayerWasted", getRootElement(), levelup) function onLogin (_,account) setElementData(source, "Level", getAccountData(account, "Level") or 1) setElementData(source, "EXP", getAccountData(account, "EXP") or 0) end addEventHandler ("onPlayerLogin", root, onLogin) function onLogout (_,account) setElementData(source, "Level", 0) setElementData(source, "EXP", 0) end addEventHandler ("onPlayerLogout", root, onLogout) function saveData(thePlayer, theAccount) local theAccount = getPlayerAccount(source) if (theAccount and not isGuestAccount(theAccount)) then setAccountData (theAccount, "Level", getElementData(thePlayer, "Level")) setAccountData (theAccount, "EXP", getElementData(thePlayer, "EXP")) end end addEventHandler ("onPlayerQuit", root, function () saveData(source, getPlayerAccount(source)) end) addEventHandler ("onPlayerLogout", root, function () saveData(source, getPlayerAccount(source)) end) Link to comment
OrbTanT Posted August 22, 2014 Author Share Posted August 22, 2014 thanks, Nightfury =) Link to comment
-.Paradox.- Posted August 22, 2014 Share Posted August 22, 2014 thanks, Nightfury =) You're 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