LiOneLMeSsIShoT Posted July 8, 2013 Share Posted July 8, 2013 This script got a lot of ERRORS..Also i'm wanted to add a Sound when i Level up.. 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( "onZombieWasted", 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) This script's not working..i get a lot of problems when i start it..but the cmd tells me Works..and i see the Scoreboard..but i cant Level up or EXP up...Nothing to do..Please help ...and i want to add a sound when i get Level up.. Link to comment
Lloyd Logan Posted July 8, 2013 Share Posted July 8, 2013 This script got a lot of ERRORS..Also i'm wanted to add a Sound when i Level up.. 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( "onZombieWasted", 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) This script's not working..i get a lot of problems when i start it..but the cmd tells me Works..and i see the Scoreboard..but i cant Level up or EXP up...Nothing to do..Please help ...and i want to add a sound when i get Level up.. Before I start to look through your script could you tell me the errors the console is outputting to you? Link to comment
LiOneLMeSsIShoT Posted July 8, 2013 Author Share Posted July 8, 2013 This script got a lot of ERRORS..Also i'm wanted to add a Sound when i Level up.. 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( "onZombieWasted", 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) This script's not working..i get a lot of problems when i start it..but the cmd tells me Works..and i see the Scoreboard..but i cant Level up or EXP up...Nothing to do..Please help ...and i want to add a sound when i get Level up.. Before I start to look through your script could you tell me the errors the console is outputting to you? Sure .. Warning: exp_system\Exp.lua:8: bad argument @ 'getElementData' Expected element at argument 1, got number ' 30' ...... Exp.lua:9: bad argument @ 'getPlayerName' [Expected element at argument 1, got number '30' .... Exp.lua:11: attempt to preform arithmtic on a nil value Link to comment
itoko Posted July 8, 2013 Share Posted July 8, 2013 The problems are probably from the onZombieWasted event, i checked the resource, and even if this event is similar to onPlayerWasted, it's not the same. The arguments are wrong in your win function, the onZombieWasted event doesn't inform about the ammo: function win(ammo, killer, weapon, bodypart) --------------- -- change to --------------- function win(killer, weapon, bodypart) Now it should work fine Link to comment
LiOneLMeSsIShoT Posted July 8, 2013 Author Share Posted July 8, 2013 The problems are probably from the onZombieWasted event, i checked the resource, and even if this event is similar to onPlayerWasted, it's not the same. The arguments are wrong in your win function, the onZombieWasted event doesn't inform about the ammo: function win(ammo, killer, weapon, bodypart) --------------- -- change to --------------- function win(killer, weapon, bodypart) Now it should work fine Gonna try ..and thanks Link to comment
LiOneLMeSsIShoT Posted July 8, 2013 Author Share Posted July 8, 2013 The problems are probably from the onZombieWasted event, i checked the resource, and even if this event is similar to onPlayerWasted, it's not the same. The arguments are wrong in your win function, the onZombieWasted event doesn't inform about the ammo: function win(ammo, killer, weapon, bodypart) --------------- -- change to --------------- function win(killer, weapon, bodypart) Now it should work fine Gonna try ..and thanks Look...Working 100%..but when i added some levels and exps i got ERROR in cmd screen.. Called ERROR: WARRNING: Loading Script Failed: exp_system\Exp.lua:3: '}' expected near '[' This problem happened when i added this local levels = {[1] = 1, [50] = 2, [75] = 3, [240] = 4, [950] = 5, [1200] = 6, [2000] = 7, [5000] = 8, [9963] = 9, [20000] = 10, [40000] = 11 [60000] = 12 [75000] = 13 [95000] = 14 [110000] = 15 [120000] = 16 [130000] = 17 [145000] = 18 [165000] = 19 [200000] = 20} more levels help please Link to comment
itoko Posted July 8, 2013 Share Posted July 8, 2013 in a table, you must put a coma after each argument, except for the last one, try this: local levels = {[1] = 1, [50] = 2, [75] = 3, [240] = 4, [950] = 5, [1200] = 6, [2000] = 7, [5000] = 8, [9963] = 9, [20000] = 10, [40000] = 11, [60000] = 12, [75000] = 13, [95000] = 14, [110000] = 15, [120000] = 16, [130000] = 17, [145000] = 18, [165000] = 19, [200000] = 20} Link to comment
LiOneLMeSsIShoT Posted July 8, 2013 Author Share Posted July 8, 2013 in a table, you must put a coma after each argument, except for the last one, try this: local levels = {[1] = 1, [50] = 2, [75] = 3, [240] = 4, [950] = 5, [1200] = 6, [2000] = 7, [5000] = 8, [9963] = 9, [20000] = 10, [40000] = 11, [60000] = 12, [75000] = 13, [95000] = 14, [110000] = 15, [120000] = 16, [130000] = 17, [145000] = 18, [165000] = 19, [200000] = 20} THANKS A LOT understanded now Thanks for helping ^^ Link to comment
LiOneLMeSsIShoT Posted July 8, 2013 Author Share Posted July 8, 2013 in a table, you must put a coma after each argument, except for the last one, try this: local levels = {[1] = 1, [50] = 2, [75] = 3, [240] = 4, [950] = 5, [1200] = 6, [2000] = 7, [5000] = 8, [9963] = 9, [20000] = 10, [40000] = 11, [60000] = 12, [75000] = 13, [95000] = 14, [110000] = 15, [120000] = 16, [130000] = 17, [145000] = 18, [165000] = 19, [200000] = 20} THANKS A LOT understanded now Thanks for helping ^^ but how i can control the level and exp ... like if i want to set level for some player or set exp for him How...may you tell me that script? but add level and exp with /commands Link to comment
itoko Posted July 8, 2013 Share Posted July 8, 2013 You should try making it by yourself, here's what you'll need: addCommandHandler() setAccountData() getAccountData() and this can be usefull https://wiki.multitheftauto.com/wiki/Ge ... omNamePart Link to comment
LiOneLMeSsIShoT Posted July 8, 2013 Author Share Posted July 8, 2013 You should try making it by yourself, here's what you'll need: addCommandHandler() setAccountData() getAccountData() and this can be usefull https://wiki.multitheftauto.com/wiki/Ge ... omNamePart Understand man..but can't you make one for me? Link to comment
Castillo Posted July 8, 2013 Share Posted July 8, 2013 We don't accept requests here, keep that in mind. Link to comment
-.Paradox.- Posted July 8, 2013 Share Posted July 8, 2013 try this 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 9, 2013 Share Posted July 9, 2013 addCommandHandler ( "setlvl", function ( thePlayer, _, who, theLevel ) local theLevel = tonumber ( theLevel ) or 0 local playerWho = getPlayerFromName ( who ) if ( playerWho ) then exports.exp_system:setPlayerLevel ( playerWho, theLevel ) end end ) Link to comment
Lloyd Logan Posted July 9, 2013 Share Posted July 9, 2013 don't post double -,- Ironically, contents of the scripts are different. Link to comment
iMr.3a[Z]eF Posted July 9, 2013 Share Posted July 9, 2013 don't post double -,- Ironically, contents of the scripts are different. he can Edit the first one and post the second post with the first one 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