Jump to content

Need help with scoreboard


Recommended Posts

for kills:

exports.scoreboard:addScoreboardColumn("Kills",getRootElement(),7,55)
addEventHandler("onPlayerWasted",root,function(totalAmmo,killer,killerWeapon,bodypart,stealth) 
    if ( killer ) then 
        local accountKiller = getPlayerAccount ( killer ) 
        if ( getElementType(killer) == "player" ) then 
            setAccountData(accountKiller,"Kills",tonumber(getAccountData(accountKiller,"Kills") or 0 ) + 1 ) 
            setElementData(killer,"Kills",tonumber(getAccountData(accountKiller,"Kills"))) 
        end 
    end 
end) 

addEventHandler("onPlayerLogin",root,function(thePreviousAccount,theCurrentAccount,autoLogin) 
    local account = getPlayerAccount ( source ) 
    if not getAccountData( account,"account:Kills" ) then 
        setAccountData( account,"account:Kills",0 ) 
    end 
    setElementData(source,"Kills",tonumber(getAccountData(account,"account:Kills" ) or 0 ) ) 
end) 

 

For total time

(This is give +1 level every played hours)

 

setTimer(function()
    if getElementData(localPlayer,"Level") then
        setElementData(localPlayer,"Level",getElementData(localPlayer,"Level") + 1)
    end
end, 36*100000, 0)

 

Link to comment
  • Administrators

Please don't use file upload sites to share your code, paste it into code blocks instead (using the "<>" formatting button in the topic editor). Provide us with the relevant piece of code and the error messages you're receiving with the code you've already tried, rather than the entire resource.

Most people won't be as kind as @TheMOG; to write it for you, if you don't give us any relevant information.

Edited by LopSided_
Link to comment

Thank you so much for your replies. The problem is i never tried anything because i don't know how to start. I'm so lame that i don't  even know where to paste the code that TheMOG sent me. Don't judge me please. :/

1 hour ago, LopSided_ said:

Please don't use file upload sites to share your code, paste it into code blocks instead (using the "<>" formatting button in the topic editor). 

I'll remember.

Thanks.

Link to comment

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...