Jump to content

Call SQLite Data on clientside?


Recommended Posts

Hi. The title of the topic pretty much expalins what my question is. :lol:

But what I want to know is, how can I call values from my SQLiteDatabase, in a clientside script?

I'm sure its possible to do somehow, but I would like to see an example or have someone explain to me how it works.

Thank you.

Link to comment

Server:

  
function sql_query( ... )  
        executeSQLQuery( ... ) 
end 
addEvent( "sql_query", true ) 
addEventHandler( "sql_query", getRootElement(), sql_query ) 
  

Client:

  
function OnPlayerJoinServer( ) 
      triggerServerEvent( "sql_query", root, ... ) 
end 
  
addEventHandler("onClientPlayerJoin", getRootElement(), OnPlayerJoinServer ) 
  

The triple dots represent parameters. You can also check out the wiki's example.

Link to comment

This is a REALLY bad thing to do. Giving clients direct access to run queries on your database leaves you incredibly vulnerable to anyone who manages to add their own script to their client. They can then delete everything in your database.

For the most part, if a function isn't available on the client, then there's a good reason - normally either security or performance.

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