Jump to content

Data Return ?


Klesh

Recommended Posts

Posted

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) 

Posted

I don't understand what do you mean.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

But the money is updated every second according to your script.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

What does the admin panel say? does it say the correct amount of money?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Seems like getPlayerMoney client side stops returning the right amount after the map started, I don't know why.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

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

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

CiTLh.png

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