bosslorenz Posted May 2, 2015 Share Posted May 2, 2015 exports.scoreboard:addScoreboardColumn('Zombie Kills') addEvent("onZombieWasted",true) addEventHandler("onZombieWasted",root, function (killer) givePlayerMoney(killer, 10) addPlayerZombieKills(killer) end) function addPlayerZombieKills(killer) local account = getPlayerAccount(killer) if isGuestAccount(account) then return end local zombieKills = getAccountData(account,"Zombie Kills") if not zombieKills then setAccountData(account,"Zombie Kills",0) end setAccountData(account,"Zombie Kills",tonumber(zombieKills)+1) end addEventHandler("onPlayerLogin",root, function () local account = getPlayerAccount(source) if isGuestAccount(account) then return end local zombieKills = getAccountData(account,"Zombie Kills") if zombieKills then setElementData(source,"Zombie Kills",tostring(zombieKills)) else setElementData(source,"Zombie Kills",0) end end) Theres no problem in debug, but it does not update the scoreboard. Scoreboard is just updating when player reconnects. How can I update the zombie kills scoreboard just like in 5 secs. Link to comment
Enargy, Posted May 2, 2015 Share Posted May 2, 2015 function addPlayerZombieKills(killer) local account = getPlayerAccount(killer) if isGuestAccount(account) then return end local zombieKills = getAccountData(account,"Zombie Kills") if not zombieKills then setAccountData(account,"Zombie Kills",0) end setAccountData(account,"Zombie Kills",tonumber(zombieKills)+1) setElementData(killer, "Zombie Kills", tonumber(zombieKills)+1) end Link to comment
Walid Posted May 2, 2015 Share Posted May 2, 2015 You must add setElementData when you kill a zombie example: * Code function addPlayerZombieKills(killer) local account = getPlayerAccount(killer) if isGuestAccount(account) then return end local zombieKills = getAccountData(account,"Zombie Kills") or 0 setAccountData(account,"Zombie Kills",tonumber(zombieKills)+1) setElementData(killer, "Zombie Kills", tonumber(zombieKills)+1) end * Scoreboard scoreboardAddColumn("Zombie Kills", root, 55, "Kills") 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