-.Paradox.- Posted July 6, 2013 Author Share Posted July 6, 2013 im not using level.xml im using this exports.scoreboard:scoreboardAddColumn("ExP") exports.scoreboard:scoreboardAddColumn("Level") local levels = {[50] = 1, [100] = 2, [175] = 3, [240] = 4, [950] = 5, [1200] = 6, [2000] = 7, [5000] = 8, [9963] = 9, [20000] = 10, [100000] = 11} 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) and if i want change levels to like Example Level 1 : Rookie Level 2 : Amateur Level 3 : Semi-pro Level 4 : Pro Level 5 : ELITE Level 6 : Boss can you help me ? Do you want set the player level if write [[command]] ? or do you want set the level name ? Level change local levels to level name Link to comment
Castillo Posted July 6, 2013 Share Posted July 6, 2013 First, stop DOUBLE/TRIPLE posting, because is annoying. Second, you can add a second value to your levels table, defining the name of the level. Link to comment
-.Paradox.- Posted July 6, 2013 Author Share Posted July 6, 2013 Like that ? exports.scoreboard:scoreboardAddColumn("ExP") exports.scoreboard:scoreboardAddColumn("Level") local levels = {[50] = Rookie, [100] = Amateur, [175] = SemiPro, [240] = Pro, [950] = Elite, [1200] = Boss, [2000] = Hero, [5000] = Evil, [9963] = Demon, [20000] = Criminal} 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) Link to comment
-.Paradox.- Posted July 6, 2013 Author Share Posted July 6, 2013 Is there a solution that if i removed the local levels local levels = {[1] = 1, [50] = 2, [75] = 3, [240] = 4, [950] = 5, [1200] = 6, [2000] = 7, [5000] = 8, [9963] = 9, [20000] = 10, [100000] = 11} it load levels from levels.xml ? "Rookie" experienceRequired = "2" /> "Amateur" experienceRequired = "100" /> "Semi-Pro" experienceRequired = "150" /> "Pro" experienceRequired = "200" /> "ELITE" experienceRequired = "2000" /> Link to comment
Castillo Posted July 6, 2013 Share Posted July 6, 2013 Why don't you just use my latest script? Link to comment
-.Paradox.- Posted July 6, 2013 Author Share Posted July 6, 2013 i used it but i dont know how it works(how much player earn if he killed someone or how much he lost if he get killed) Link to comment
-.Paradox.- Posted July 6, 2013 Author Share Posted July 6, 2013 addCommandHandler ( "setexp", function ( thePlayer, _, who, theExP ) local theExP = tonumber ( theExP ) or 0 local playerWho = getPlayerFromName ( who ) if ( playerWho ) then exports.exp_system:setPlayerEXP ( playerWho, theExP ) end end ) it was working fine now it show a error in console ERROR: attempt to call a nil value [string"?"] ERROR: call:failed to call 'exp_system:setPlayerEXP' [string"?"] help Link to comment
Castillo Posted July 6, 2013 Share Posted July 6, 2013 Does the resource export these functions? Link to comment
-.Paradox.- Posted July 6, 2013 Author Share Posted July 6, 2013 Yes addCommandHandler ( "setexp", function ( thePlayer, _, who, theExP ) local theExP = tonumber ( theExP ) or 0 local playerWho = getPlayerFromName ( who ) if ( playerWho ) then exports.exp_system:setPlayerEXP ( playerWho, theExP ) end end ) Link to comment
Castillo Posted July 6, 2013 Share Posted July 6, 2013 You don't understand, does the resource "exp_system" have the functions that are being exported? Link to comment
-.Paradox.- Posted July 6, 2013 Author Share Posted July 6, 2013 i don't understand sorry. Link to comment
Castillo Posted July 6, 2013 Share Posted July 6, 2013 To me, it looks like you've copied the exports from the meta.xml of my "exp_system" and pasted it on that resource, without the actual functions, it won't work. Link to comment
-.Paradox.- Posted July 6, 2013 Author Share Posted July 6, 2013 yes, that what i do, there isn't a solution? anything else ? Link to comment
-.Paradox.- Posted July 6, 2013 Author Share Posted July 6, 2013 Castillo, can you explain me please? Link to comment
iPrestege Posted July 6, 2013 Share Posted July 6, 2013 You're using 'Castillo's' Exp's system? Link to comment
-.Paradox.- Posted July 6, 2013 Author Share Posted July 6, 2013 no another one using this exports.scoreboard:scoreboardAddColumn("ExP") exports.scoreboard:scoreboardAddColumn("Level") local levels = {[50] = 1, [100] = 2, [175] = 3, [240] = 4, [950] = 5, [1200] = 6, [2000] = 7, [5000] = 8, [9963] = 9, [20000] = 10, [100000] = 11} 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) Link to comment
-.Paradox.- Posted July 7, 2013 Author Share Posted July 7, 2013 Castillo can u help me ? Link to comment
Castillo Posted July 8, 2013 Share Posted July 8, 2013 You can't copy the exported functions from one resource without having them on the script itself. Link to comment
-.Paradox.- Posted July 8, 2013 Author Share Posted July 8, 2013 So what i need to do? Link to comment
Castillo Posted July 8, 2013 Share Posted July 8, 2013 Create your own functions or just set element data. 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