Jump to content

Como funciona esto ?


AlvareZ_

Recommended Posts

Posted

pero osea, intente esto y menos sale:

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 ) 

bandera_de_Venezuela.png

Posted

Ese codigo es viejo, usa el ultimo.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Porque no?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Como sabes que no funciona? tenes algun script que diga tu experiencia?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Mostra el script

o Proba en la scoreboard agrega esto y mata zombies

exports.scoreboard:addScoreColumn("Exp") -- "Exp" creo que es no solid? 

Fijate si te sube la exp de esa score column

Visita Full GameZ DayZ Mod

Server IP: mtasa://158.69.125.144:29015

Posted

Podrias decir cual era el problema? podria ayudar a alguien en el futuro.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Lo que pasa es que vos no tenias nada para mostrar la experiencia del jugador, osea que no sabias si funcionaba o no.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...