Jump to content

Data Return ?


Klesh

Recommended Posts

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

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

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