Jump to content

how get Bankbalance


daKillar2000

Recommended Posts

Posted

isnt it easier to open script and check whats inside?

probably you have to do:

getAccountData(account_variable, "bank.amout") 

or it was "bank.money"?

I dont have it, just open this script and look inside..

Posted
DaPlayerBank = guiCreateLabel(15, 138, 217, 15, "Bank:", false, PlayerinfoW) 
    guiLabelSetHorizontalAlign(DaPlayerBank, "left", false) 
    guiLabelSetVerticalAlign(DaPlayerBank, "center") 
  
  
  
    guiSetText(DaPlayerBank,"Bank:  $   "  ..tostring(getElementData(lp,"bank.money"))) 

Posted

oh my god.

at least read my posts when i'm giving you direct answer.

getAccountData, not getElementData.

again - take a peek into bank resource.

And i dont know why you are trying to re-create the gui?

Posted

well, getAccountData is server side, so you have to trigger client side event..

just look inside 50p's resource!

omg,

that is my last reply to this topic, i have enough with your ignorance to any suggestions

Posted

Bank resource has a number of exported functions, 2 of them are:

setBankAccountBalance( player or accountName, newBalance ) 
getBankAccountBalance( player or accountName ) 

They are obviously server-side functions to be safer.

Posted

-client side

  
    addEvent("banklabel", true ) 
    function banklabel( ) 
       bank = tonumber(balance) 
       guiSetText(DaPlayerBank,"Bank:  $   "  ..tostring(thePlayer,balance)) 
    end   
  

serverside

  function bankstatus (source) 
 local account = getPlayerAccount (source); 
 if not isGuestAccount(account) then 
      local balance = getBankAccountBalance(source)  
      triggerClientEvent (source,"banklabel",source,balance) 
     end 
 end 
  

Posted

these functions are exported functions. you can't just call them this way!

i have never used exported functions but probably you need to use this:

  
local something = call(getResourceFromName("bank"), "getBankAccountBalance", source) 
-- remember - source is player element or account name 
  

Posted
... 
local balance = exports.bank:getBankAccountBalance( source ) -- make sure source is player element or account name 
... 

... 
function banklabel( balance ) 
    guiSetText(DaPlayerBank,"Bank:  $   "  ..tostring(balance)) 
... 

Posted

ok i put that but not works again

i do this:

----Serverside

     function bankstatus (source) 
          local account = getPlayerAccount (source); 
          local balance = exports.bank:getBankAccountBalance( source )  
          triggerClientEvent (source,"banklabel",source,balance) 
        end 

-----ClientSide

    addEvent("banklabel", true ) 
     function banklabel( balance ) 
       guiSetText(DaPlayerBank,"Bank:  $   "  ..tostring(balance)) 
   end   

I Dont Know Why Not Works

Posted
FIXED

-------CLOSED-------

What was wrong then? Tell us and then we can close the topic.

i will tell us what was wrong since i had to fix it ;), he wasn't calling getstatus function that way it won't ever work, so i added a triggerServerEvent and now is working.

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...