E-mail Posted August 17, 2011 Share Posted August 17, 2011 Hi i start the debugscript 3 see attempt to index field "?" (a nill value) local rootElement = getRootElement() levels = {} levels[0] = {"Test 0", "10"} levels[1] = {"Test 1", "20"} levels[2] = {"Test 2", "100"} levels[3] = {"Test 3", "150"} levels[4] = {"Test 4", "200"} function ResourceStart () executeSQLCreateTable("levels", "accountname STRING, level INT") end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), ResourceStart) function addPlayer() local account = getPlayerAccount(source) local playername = getPlayerName(source) CheckPlayer = executeSQLSelect ( "levels", "accountname", "accountname = '" .. getAccountName(account) .. "'" ) if ( type( CheckPlayer ) == "table" and #CheckPlayer == 0 ) or not CheckPlayer then executeSQLInsert ( "levels", "'".. getAccountName(account) .."','0'" ) end end addEventHandler("onPlayerLogin",rootElement,addPlayer) addEventHandler( "onElementDataChange", rootElement, function () if getElementType(source) == "player" then local acc = getPlayerAccount(source) local accountname = getAccountName(acc) local playername = getPlayerName(source) local data = getElementData(source,"exp") local sqldata = executeSQLSelect ( "levels", "level","accountname = '" .. accountname .. "'") lvl = sqldata[1]["level"] if tostring(data) == tostring(levels[lvl][2]) then outputChatBox("*Level system: congratulations ".. playername .." you're now a ".. levels[lvl][1] .."!",getRootElement(),0,255,0) local textDis = textCreateDisplay () local item = textCreateTextItem( "Level+1ف ".. tostring(sqldata[1]["level"]), 0.5, 0.4, 2, 0, 255, 0, 255, 4, "center", "center" ) textDisplayAddText ( textDis, item ) textDisplayAddObserver ( textDis, source ) setTimer ( textDestroyTextItem, 5000, 1, item ) setTimer ( textDestroyDisplay, 5000, 1, textDis ) sql = tonumber(sqldata[1]["level"]) + 1 executeSQLUpdate("levels", "level = '".. sql .."'", "accountname = '".. accountname .."'") end end end) function rewardOnWasted ( killer ) local exp = getElementData(killer,"exp") if exp then setElementData(killer,"exp",tonumber(getElementData(killer,"exp"))+5) outputChatBox(" +5Points ".. tonumber(exp)+5,killer,0,255,0) else setElementData(killer,"exp",5) end end addEvent("onClientPlayerWasted",true) addEventHandler ( "onClientPlayerWasted", getRootElement(), rewardOnWasted ) Link to comment
Baseplate Posted August 17, 2011 Share Posted August 17, 2011 Don't double post just wait from someone to answer u Link to comment
EL BERE Posted August 17, 2011 Share Posted August 17, 2011 You have to modify the script to work. But it is not easy Link to comment
Baseplate Posted August 17, 2011 Share Posted August 17, 2011 and why did he posted it here then? Link to comment
Castillo Posted August 17, 2011 Share Posted August 17, 2011 I've noticed of many bugs in my exp_system, so I decided to spend some time updating it, adding new things, and making it more efficient. Link to comment
TAPL Posted August 18, 2011 Share Posted August 18, 2011 this not needed becuase onClientPlayerWasted is not custom Event addEvent("onClientPlayerWasted",true) and onClientPlayerWasted is Client-Side addEventHandler ( "onClientPlayerWasted", getRootElement(), rewardOnWasted ) Link to comment
Castillo Posted August 18, 2011 Share Posted August 18, 2011 (edited) E-mail, I have uploaded a new version of the exp_system, I would download it if I was you. With the new version you can do something like this: addEventHandler("onPlayerWasted",root, function (_,killer) exports.exp_system:addPlayerEXP(killer,5) end) P.S: The killer has to be logged in. Edited August 18, 2011 by Guest Link to comment
E-mail Posted August 18, 2011 Author Share Posted August 18, 2011 P.S Script dont work New Exp_System SolidSnake14 NoThing Fix Please Link to comment
Castillo Posted August 18, 2011 Share Posted August 18, 2011 Script does work, I've tested it with zombies by Slothman, everything worked fine, if you know how to use it of course. P.S: Copy my example again, I've fixed something. P.S2: Don't just copy & paste, try to fix something yourself. Link to comment
will briggs Posted August 18, 2011 Share Posted August 18, 2011 to be honest, im not sure castillo would have spent the time remaking it, and releasing it if it didnt work. 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