kewizzle Posted July 15, 2014 Share Posted July 15, 2014 exports.scoreboard:addScoreboardColumn('Level') addEvent("onPlayerLevelUp",true) addEventHandler("onPlayerLevelUp",root, function (source) givePlayerMoney(source,math.random(1000)) addPlayerLevel(source) end) function addPlayerLevel(source) local account = getPlayerAccount(source) if isGuestAccount(account) then return end local Level = getAccountData(account,"Level") if not Level then setAccountData(account,"Level",0) end setAccountData(account,"Level",tonumber(Level)+1) end addEventHandler("onPlayerLogin",root, function () local account = getPlayerAccount(source) if isGuestAccount(account) then return end local Level = getAccountData(account,"Level") if zombieKills then setElementData(source,"Level",tostring(Level)) else setElementData(source,"Level",0) end end) All it does is show 0 in scoreboard i think i have the elements wrong but help me out here i know it only shows 0 in the scoreboard cause of the login function Link to comment
kewizzle Posted July 16, 2014 Author Share Posted July 16, 2014 I FUCKING DID IT MYSELF :') exports.scoreboard:addScoreboardColumn('level') addEvent("onPlayerlevelUp",true) addEventHandler("onPlayerlevelUp",root, function (source) givePlayerMoney(source,math.random(1000)) addPlayerlevel(source) end) function addPlayerlevel(source) local account = getPlayerAccount(source) if isGuestAccount(account) then return end local level = tonumber ( getElementData ( player, "level" ) or 0 ) if not level then setAccountData(account,"level",0) end setAccountData(account,"level",tonumber(level)+1) end addEventHandler("onPlayerLogin",root, function () local account = getPlayerAccount(source) if isGuestAccount(account) then return end local level = tonumber ( getElementData ( player, "level" ) or 0 ) if level then setElementData(source,"level",tostring(level)) else setElementData(source,"level",0) end end) 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