1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Add data on YAML

Discussion in 'Development' started by Qeis2007, Aug 22, 2018.

  1. Qeis2007

    Qeis2007 Witch

    Messages:
    70
    GitHub:
    FrostingBita
    I want to wonder how to change config.yml from this:
    Code:
    player-1: one
    Into this:
    Code:
    player-1: one
    player-2: two
     
  2. corytortoise

    corytortoise Skeleton

    Messages:
    825
    GitHub:
    corytortoise
    Here's a very useful thread about how to handle the Config class for data.
     
  3. Qeis2007

    Qeis2007 Witch

    Messages:
    70
    GitHub:
    FrostingBita
    ?? I doesn't understand that post, i only want how to add it like EconomyAPI
     
  4. corytortoise

    corytortoise Skeleton

    Messages:
    825
    GitHub:
    corytortoise
    Once you get your config like mentioned in the thread I linked, use:
    PHP:
     $config->set("player-2""two");
     
    $config->save();
    I'd suggest using integers rather than strings, and you'll have to define the data you want in it yourself, but that snippet sets and saves data to a file.
     
    Qeis2007 likes this.
  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.