Jump to content

Level


Electro88

Recommended Posts

Posted
function levelup ( ) 
    if isElement ( expLabel ) then 
        destroyElement ( expLabel ) 
    end 
  
    local Exp = getElementData ( localPlayer, "ExP" ) or 0 
    local Level = getElementData ( localPlayer, "Level" ) or 0 
    expLabel = guiCreateLabel ( 0.777, 0.22, 0.1708, 0.0963, "\nToplam Exp: ".. tostring ( Exp ) .."\nLevel: ".. tostring ( Level ), true ) 
    guiLabelSetColor ( expLabel, 0, 255, 0 ) 
    guiLabelSetVerticalAlign ( expLabel, "top" ) 
    guiLabelSetHorizontalAlign ( expLabel, "left", false ) 
    guiSetFont ( expLabel, "clear-normal" ) 
    setTimer ( levelup, 2000, 1 ) 
end 
setTimer ( levelup, 2000, 1 ) 
  
  
function onlabelCreate () 
    local ups= guiCreateLabel ( 0.45, 0.48, 0.10, 0.04, "", true) 
    if not guiGetVisible(ups) then 
        guiSetVisible(ups, true) 
        setTimer(guiSetVisible, 5000, 1, ups, false) 
        guiSetText(ups, "LEVEL ATLADIN ! "..getElementData(localPlayer, "Level")) 
    end 
end 
onlabelCreate () 
  
addEvent("Zomb_Jump", true) 

76561198095270230.png

Posted

You don't do anything with this event it needs a handler what function do you want to trigger?

addEvent("Zomb_Jump", true) 
addEventHandler("Zomb_Jump", getRootElement(), functionNameHere) 

"If debugging is the process of removing software bugs, then programming must be the process of putting them in."

Posted
exports.scoreboard:scoreboardAddColumn ( "Level" ) 
local levels = 
    { 
        50, 
        150, 
        300, 
        500, 
        900, 
        1000, 
        1400, 
        1555, 
        1850, 
        2000, 
        2255, 
        2400, 
        2650, 
        2750, 
        3000, 
        4755, 
        5000, 
        5500, 
        5999, 
        6599, 
        6850, 
        7000, 
        8500, 
        10000, 
        10500, 
        11000, 
        13500, 
        15000, 
        16500, 
        20000, 
  
         
    } 
  
addEvent ( "onZombieWasted", true ) 
addEventHandler ( "onZombieWasted", root, 
    function ( killer ) 
        addPlayerZombieKills ( killer ) 
    end 
) 
  
function addPlayerZombieKills ( killer ) 
    local account = getPlayerAccount ( killer ) 
    if isGuestAccount ( account ) then 
        return 
    end 
  
    local H = tonumber ( getElementData ( killer, "ExP" ) ) or 0 
    local L = tonumber ( getElementData ( killer, "Level" ) ) or 0 
    setElementData ( killer, "ExP", tonumber ( H ) + 50 ) 
    local H = ( H + 5 ) 
    local L = ( L + 1 ) 
    if ( L <= #levels ) and ( levels [ L ] ) and ( tonumber ( H ) >= tonumber ( levels [ L ] ) ) then 
        setElementData ( killer, "Level", L ) 
        triggerClientEvent ( killer, "playSound", killer ) 
    end 
end 
  
function onLogin ( _, account ) 
    setElementData ( source, "Level", getAccountData ( account, "lvl" ) or " 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 
) 
  

76561198095270230.png

Posted

There is no trigger to one of those events from the error, is this the full code or the error perhaps from another script?

Show the full error code, with line number and .lua file.

"If debugging is the process of removing software bugs, then programming must be the process of putting them in."

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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