ciruja1 Posted June 12, 2012 Share Posted June 12, 2012 Hola soy nuevo en esto del mta y desidi armarme un server de zombies haci que encontre este recurso pero no sirve me dicen por que?? 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 UP! YOU'RE NOW LEVEL ".. 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("Experience gained +5! total ".. tonumber(exp)+5,killer,0,255,0) else setElementData(killer,"exp",5) end end addEvent("onZombieWasted",true) addEventHandler ( "onZombieWasted", getRootElement(), rewardOnWasted ) Link to comment
Castillo Posted June 12, 2012 Share Posted June 12, 2012 Ese script es mi "exp_system" pero una version muy vieja y con errores seguro, descarga la ultima version que es mucho mejor: https://community.multitheftauto.com/ind ... ls&id=1253 Link to comment
ciruja1 Posted June 12, 2012 Author Share Posted June 12, 2012 ok gracias pero una pregunta como hacer que abajo en un cuadradito aparesca el level Link to comment
Castillo Posted June 12, 2012 Share Posted June 12, 2012 Podrias usar las funciones de DirectX: dxDrawRectangle dxDrawText Link to comment
Recommended Posts