Solved command response in MySQL

Discussion in 'Plugin Help' started by Loosty, Nov 6, 2019.

  1. Loosty

    Loosty Spider

    Messages:
    11
    GitHub:
    Loosty
    Hello, I would like an example of a command that his answer is in MySQL. (Example /coins, and show how many coins the player has).


    * This message was translated into Google Translator. Sorry, my English is not good.

    My function getDatabase:

    public function getDatabase() {
    new \mysqli("localhost", "root", "test", "stone");
    }
     
  2. HimbeersaftLP

    HimbeersaftLP Chicken

    Messages:
    1,786
    GitHub:
    HimbeersaftLP
    I recommend using the libasynql Virion, it's easier to use than mysqli and also works asynchronously, because otherwise your server will hang while executing the query which could make the gameplay choppy when a lot of players use your command: https://github.com/poggit/libasynql
     
    Muqsit likes this.
  3. Loosty

    Loosty Spider

    Messages:
    11
    GitHub:
    Loosty
  4. HimbeersaftLP

    HimbeersaftLP Chicken

    Messages:
    1,786
    GitHub:
    HimbeersaftLP
    Sorry, I don't have any simple examples, try taking a look at the plugins that are mentioned at the bottom of that README.
    You can also check out other plugins that use it: https://github.com/search?q=libasynql&type=Code

    If I had the time, I'd quickly write an example plugin for you, but I have a lot of exams the following days.
     
  5. Loosty

    Loosty Spider

    Messages:
    11
    GitHub:
    Loosty
    Thanks, solved my problem
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.