Jump to content

dbConnection in use warning?


Pirulax

Recommended Posts

  • Discord Moderators

So, friend of mine got this error: Picture

He was like: dbConnection was in use, this is why it happened, but i was like: thats impossible, so this is why i ask you guys.

btw: This is just a question, and i dont need a script-fix for is, just an answer about it.Thx in advance.

 

Link to comment
  • Moderators

The variable that contains the database connection is nil, as simple as that. If this variable contains a nil value, you should cancel the event onResourceStart so the resource doesn't start. Without database connection / database the script wouldn't be working correctly in most cases.

 

Here is where the script probably failed to connect:

https://wiki.multitheftauto.com/wiki/DbConnect

 

Link to comment
  • Discord Moderators

No, you misunderstand me, he had a resource called mtd_database, this is where he called dbConnectionm and then, he just exported the getConnection() function,it worked totally fine, but then he got this warning, do you understand me now?

Link to comment
  • Moderators

I didn't misunderstand you, you just did forget half of the information so I couldn't understand you.

There are so many ways why this might fail and give the exact same error, at the moment I can only guess.

 

  • He should try to use the call function instead of exports to insure that the export arguments are successfully transferred.
  • He should learn to debug his code properly, not just waiting for errors and warnings to show up.
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...