unknooooown Posted July 24, 2011 Share Posted July 24, 2011 Hi. The title of the topic pretty much expalins what my question is. 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
Cyanide Posted July 24, 2011 Share Posted July 24, 2011 Since it's only a server-side function, you will need to use triggerServerEvent. Link to comment
unknooooown Posted July 24, 2011 Author Share Posted July 24, 2011 Could you show me an example of how you would do it? You dont need to show me a full working script, just enough to give me an idea of how you would do it. Link to comment
Cyanide Posted July 24, 2011 Share Posted July 24, 2011 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
unknooooown Posted July 24, 2011 Author Share Posted July 24, 2011 The way you do it, its just gonna run all the values on the serverside isnt it? What I want is some way to get the data from the database, and use it for something like eg. Gui on the clientside. Link to comment
eAi Posted July 25, 2011 Share Posted July 25, 2011 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
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