Klesh Posted November 24, 2012 Posted November 24, 2012 Hello this code not works as well, when the map loads or player spawn the data is 0 again, how it can check this data some every time ? i tried but nothing, here is the try: localPlayer = getLocalPlayer() function addColumns() exports.scoreboard:scoreboardAddColumn("Money") setElementData(localPlayer,"Money",0) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), addColumns) function updateScoreboardMoney() local money = getPlayerMoney(localPlayer) setElementData(localPlayer,"Money",tonumber(money)) end setTimer(updateScoreboardMoney,1000,0)
Klesh Posted November 24, 2012 Author Posted November 24, 2012 When the maps start again, in race, the cash in the scoreboard returns to 0 and is not getting the current!
Castillo Posted November 24, 2012 Posted November 24, 2012 But the money is updated every second according to your script.
Klesh Posted November 24, 2012 Author Posted November 24, 2012 No works, every time the map starts again it returns to 0
Castillo Posted November 24, 2012 Posted November 24, 2012 What does the admin panel say? does it say the correct amount of money?
Klesh Posted November 24, 2012 Author Posted November 24, 2012 Yes, it shows the correct amount of money, the scoreboard only shows the money when the player login, when map change it returns to 0.
Castillo Posted November 24, 2012 Posted November 24, 2012 Seems like getPlayerMoney client side stops returning the right amount after the map started, I don't know why.
Klesh Posted November 24, 2012 Author Posted November 24, 2012 I know the code its fine, time ago was working but now its not.
HunT Posted November 24, 2012 Posted November 24, 2012 Server Side : exports.scoreboard:addScoreboardColumn('Money') addEvent("onMapStarting",true) addEventHandler("onMapStarting",getRootElement(), function () moneyScore () end ) function moneyScore (playerSource) local currentMoney = getPlayerMoney(playerSource) or 0 if currentMoney then setElementData ( playerSource, "Money", currentMoney) end end But No Tested
Renkon Posted November 24, 2012 Posted November 24, 2012 Editing data clientside won't be fine, obviously.
TAPL Posted November 24, 2012 Posted November 24, 2012 Server Side : exports.scoreboard:addScoreboardColumn('Money') addEvent("onMapStarting",true) addEventHandler("onMapStarting",getRootElement(), function () moneyScore () end ) function moneyScore (playerSource) local currentMoney = getPlayerMoney(playerSource) or 0 if currentMoney then setElementData ( playerSource, "Money", currentMoney) end end But No Tested exports.scoreboard:addScoreboardColumn('Money') addEvent("onMapStarting", true) addEventHandler("onMapStarting", root, function() for i, player in ipairs (getElementsByType("player")) do local currentMoney = getPlayerMoney(player) or 0 setElementData(player, "Money", currentMoney) end end)
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