Klesh Posted November 24, 2012 Share 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) Link to comment
Castillo Posted November 24, 2012 Share Posted November 24, 2012 I don't understand what do you mean. Link to comment
Klesh Posted November 24, 2012 Author Share 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! Link to comment
Castillo Posted November 24, 2012 Share Posted November 24, 2012 But the money is updated every second according to your script. Link to comment
Klesh Posted November 24, 2012 Author Share Posted November 24, 2012 No works, every time the map starts again it returns to 0 Link to comment
Castillo Posted November 24, 2012 Share Posted November 24, 2012 What does the admin panel say? does it say the correct amount of money? Link to comment
Klesh Posted November 24, 2012 Author Share 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. Link to comment
Castillo Posted November 24, 2012 Share Posted November 24, 2012 Seems like getPlayerMoney client side stops returning the right amount after the map started, I don't know why. Link to comment
Klesh Posted November 24, 2012 Author Share Posted November 24, 2012 I know the code its fine, time ago was working but now its not. Link to comment
HunT Posted November 24, 2012 Share 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 Link to comment
Renkon Posted November 24, 2012 Share Posted November 24, 2012 Editing data clientside won't be fine, obviously. Link to comment
TAPL Posted November 24, 2012 Share 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) 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