papam77 Posted July 29, 2013 Posted July 29, 2013 Hello, I've made this: Client: dxDrawText("$"..getElementData(k,"MyMoney").."",820*(sw/1920),((middle+55)*(sh/1080))+((28*(sh/1080))*(i-1)),819*(sw/1920),448*(sh/1080),tocolor(255,255,255,255),1.8*(sh/1080),"default","left","top",false,false,false,true) Server: addEventHandler("onPlayerJoin",root,function() local MyCountry = exports.admin:getPlayerCountry(source) if ( MyCountry ) then setElementData(source,"MyCountryData",MyCountry) else setElementData(source,"MyCountryData","none") end setElementData(source,"MyMoney","?") end) addEvent("UpState",true) addEventHandler("UpState",root,function() local Acc = getPlayerAccount(source) if ( Acc ) then if not (isGuestAccount(Acc)) then local MoneyData = getAccountData(Acc,"cash") if ( MoneyData ) then setElementData(source,"MyMoney",MoneyData) else setElementData(source,"MyMoney","?") end end end local MyCountry = exports.admin:getPlayerCountry(source) if ( MyCountry ) then setElementData(source,"MyCountryData",MyCountry) else setElementData(source,"MyCountryData","none") end end) addEventHandler("onPlayerLogin",root,function() local Acc = getPlayerAccount(source) if ( Acc ) then if not (isGuestAccount(Acc)) then local MoneyData = getAccountData(Acc,"cash") if ( MoneyData ) then setElementData(source,"MyMoney",MoneyData) else setElementData(source,"MyMoney","?") end end end end) But i need to refresh it when player get new money by userpanel. How can do it? I must restart scoreboard to see current money. I need to make when userpanel give to player +Money it will refresh it and show the current money.
Castillo Posted July 29, 2013 Posted July 29, 2013 Well, and what stops you from doing it? if you already know what you have to do. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
PaiN^ Posted July 29, 2013 Posted July 29, 2013 Try triggering an event from the userpanel and then add it handler to your script . e.g. : -- Something like this on your userpanel givePlayerMoney( player, amount ) triggerEvent( "onPlayerGetMoney", player, amount ) And then, But in the other code : addEvent( "onPlayerGetMoney", true ) addEventHandler( "onPlayerGetMoney", root, function( amount ) local current_money = getElementData( source, "MyMoney" ) setElementData( source, "MyMoney",current_money + amount ) end ) " Keep Thinking Different . " - Steve Jops -------------------- Don't send me PMs asking for help, I Won't reply !
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