Jump to content

MySQL Problem


Shingeki

Recommended Posts

Hey i have a problem with mysql,

I dont know how to do it.

At the moment i have this:

Server:

function showPlayerData(player, money) 
local money = getMysqlData(player,"Money") 
    triggerClientEvent(player,"showMoney", getRootElement(), money) 
end 
addEventHandler("onResourceStart", getRootElement(), showPlayerData) 

If i output money in clientside with outPutChatBox it wont work =(

(outputChatBox Expected string at argument 1)

Link to comment
If i output money in clientside with outPutChatBox it wont work =(

...

(outputChatBox Expected string at argument 1)

You need to post your client-side code.

Oh, and you shouldn't really use triggerClientEvent with the root element as your source parameter. Use player instead.

Link to comment

ju555W2.png

...

addEventHandler('onResourceStart', resourceRoot, 
function () 
    for _,player in pairs (getElementsByType('player')) do 
        local money = getMysqlData(player,"Money") 
        if (money) then 
            triggerClientEvent(player,"showMoney", root, money) 
        end 
    end 
end) 

Link to comment
  • 1 month later...
Hey i have a problem with mysql,

I dont know how to do it.

At the moment i have this:

Server:

function showPlayerData(player, money) 
local money = getMysqlData(player,"Money") 
    triggerClientEvent(player,"showMoney", getRootElement(), money) 
end 
addEventHandler("onResourceStart", getRootElement(), showPlayerData) 

If i output money in clientside with outPutChatBox it wont work =(

(outputChatBox Expected string at argument 1)

Show clientside scripts.

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