-.Paradox.- Posted July 1, 2013 Share Posted July 1, 2013 Hello i have this exp_system and i want two things on it i tryed but not working here is the lua exports.scoreboard:scoreboardAddColumn("ExP") exports.scoreboard:scoreboardAddColumn("Level") local levels = {[1] = 1, [50] = 2, [75] = 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)+75) if levels[tonumber(H)] then setElementData(killer, "Level", "Lvl ".. tostring(levels[tonumber(H)]) .." !") triggerClientEvent ( killer, "playSound", killer ) end end end addEventHandler( "onPlayerWasted", getRootElement(), win) function onLogin (_,account) setElementData(source, "Level", getAccountData(account, "lvl") or "Level 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) I want when player kill somebody he earn Random Experience i tryed adding this but not working math.random ( 5, 35 ) and when he get killed by somebody who had a higher exp he lose like math.random ( -5, -35 ) Thanks for helping Link to comment
Castillo Posted July 1, 2013 Share Posted July 1, 2013 Why is not working? I don't see math.random anywhere on your script either. Link to comment
-.Paradox.- Posted July 1, 2013 Author Share Posted July 1, 2013 that's the original one Link to comment
Castillo Posted July 1, 2013 Share Posted July 1, 2013 The script you've posted works? and you want to add random experience? Link to comment
-.Paradox.- Posted July 1, 2013 Author Share Posted July 1, 2013 Yeh and when player get killed he lost some experience Link to comment
Castillo Posted July 1, 2013 Share Posted July 1, 2013 exports.scoreboard:scoreboardAddColumn("ExP") exports.scoreboard:scoreboardAddColumn("Level") local levels = {[1] = 1, [50] = 2, [75] = 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 ( 5, 35 ) ) 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, 35 ) ) end addEventHandler( "onPlayerWasted", getRootElement(), win) function onLogin (_,account) setElementData(source, "Level", getAccountData(account, "lvl") or "Level 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 1, 2013 Author Share Posted July 1, 2013 Thanks a lot bro you're the best and one more thing please The command of get player experience dont work function getRep ( commandName, playerName ) if ( playerName ) then local thePlayer = getPlayerFromName ( playerName ) if ( thePlayer ) then local ExP = getElementData ( thePlayer, "ExP" ) outputChatBox ( getPlayerName ( thePlayer ) .." Reputation is ".. ExP "!", source ) else outputChatBox ( "Couldn't find '" .. playerName .. "'", source ) end end end addCommandHandler ( "getrep", getRep ) Link to comment
-.Paradox.- Posted July 1, 2013 Author Share Posted July 1, 2013 (edited) yes can i remove " Lvl " and "!" from setElementData(killer, "Level", "Lvl ".. tostring(levels[tonumber(H)]) .." !") because when i remove it the script being crashed Edited July 1, 2013 by Guest Link to comment
Castillo Posted July 1, 2013 Share Posted July 1, 2013 function getRep ( _, playerName ) if ( playerName ) then local thePlayer = getPlayerFromName ( playerName ) if ( thePlayer ) then local ExP = getElementData ( thePlayer, "ExP" ) or 0 outputChatBox ( getPlayerName ( thePlayer ) .." Reputation is ".. tostring ( ExP ) .."!" ) else outputChatBox ( "Couldn't find '" .. playerName .. "'", source ) end end end addCommandHandler ( "getrep", getRep ) Link to comment
-.Paradox.- Posted July 4, 2013 Author Share Posted July 4, 2013 Castillo, i tryed this but not working can you fix it please This for set player exp addCommandHandler ( "setexp", function ( thePlayer, commandName, theExP ) local theExP = tonumber ( theExP ) or 0 exports.exp_system:setPlayerExP ( thePlayer, theExP ) end ) and this for set player level addCommandHandler ( "setlevel", function ( thePlayer, commandName, theLevel ) local theLevel = tonumber ( theLevel ) or 1 exports.exp_system:setPlayerLevel ( thePlayer, theLEvel ) end ) Link to comment
-.Paradox.- Posted July 4, 2013 Author Share Posted July 4, 2013 no errors function ( thePlayer, commandName, theLevel , playerName) what about this ? Link to comment
Castillo Posted July 4, 2013 Share Posted July 4, 2013 The resource "exp_system" has these exported functions? Link to comment
-.Paradox.- Posted July 4, 2013 Author Share Posted July 4, 2013 yes on meta function="getPlayerLevel" type="server" /> -- arguments: thePlayer --> function="setPlayerLevel" type="server" /> -- arguments: thePlayer, theLevel --> function="getPlayerEXP" type="server" /> -- arguments: thePlayer --> function="setPlayerEXP" type="server" /> -- arguments: thePlayer, theExperience --> function="addPlayerEXP" type="server" /> -- arguments: thePlayer, theExperience --> function="getAccountLevel" type="server" /> -- arguments: theAccount --> function="setAccountLevel" type="server" /> -- arguments: theAccount, theLevel --> function="getAccountEXP" type="server" /> -- arguments: theAccount --> function="setAccountEXP" type="server" /> -- arguments: theAccount, theExperience --> function="addAccountEXP" type="server" /> -- arguments: theAccount, theExperience --> function="getLevelData" type="server" /> -- arguments: theLevel --> Link to comment
Castillo Posted July 4, 2013 Share Posted July 4, 2013 It's "setPlayerEXP" not "setPlayerExP". Link to comment
-.Paradox.- Posted July 4, 2013 Author Share Posted July 4, 2013 Oh ok, i will try it it set exp only for me not for other players Link to comment
Castillo Posted July 4, 2013 Share Posted July 4, 2013 That's because it's what the script does. Link to comment
-.Paradox.- Posted July 4, 2013 Author Share Posted July 4, 2013 ok but there isnt a solution for set player exp ? Link to comment
Castillo Posted July 4, 2013 Share Posted July 4, 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 ) Link to comment
-.Paradox.- Posted July 4, 2013 Author Share Posted July 4, 2013 thanks but what about the music script Link to comment
-.Paradox.- Posted July 4, 2013 Author Share Posted July 4, 2013 https://forum.multitheftauto.com/viewtop ... 1339a7be73 Link to comment
-.Paradox.- Posted July 6, 2013 Author Share Posted July 6, 2013 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 ? Link to comment
فاّرس Posted July 6, 2013 Share Posted July 6, 2013 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 ? 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