Jump to content

GUI label retrieve mysql data & setTimer issue [problem]


Recommended Posts

Hello guys.

I`m really stuck with this triggerServerEvent thing.

Lets say i got in the client file this:

  
wdw = guiCreateWindow(left, top, windowWidth, windowHeight, "withdraw", false) 
guiCreateLabel(20, 25, 121, 16, "Balance: ", false, wdw) 
  

in server file i add this:

  
function balance() 
    local sql = mysql_query(handler, "SELECT cash FROM accounts WHERE username = '"..getPlayerName(source).."';") 
end 
addEvent("balance", true) 
addEventHandler("balance", getRootElement(), balance) 
  

How do i trigger balance event so that in the label after "Balance: " shows the value from cash column ?

PS. Another issue i got with setTimer

lets say i got this:

  
function time() 
local h ,m = getTime() 
    if (m == 0) then 
        outputChatBox("text", source, 255, 0, 0) 
    else 
        return 
    end 
end 
setTimer ( time, 600, 0 ) 
  

So... every 1 min the timmer is triggerd. Works great so far, but "text" appears twice. I read on the wiki page that is something to do with fames per secound and "shouldn't rely on the timer triggering at an exact point in the future". But i want that timer to be triggered at that point. How do i fix it ?

Thanks in advance.

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