If / else statement problems / Variables not working

Discussion in 'Skript' started by Artist, Aug 10, 2018.

  1. Hello! I've got another issue regarding to the skript i wanted to write

    Code (Text):
    # ##############
    # MOTD OPTIONS #
    # ##############
    options:
        servermodtline1:&r                        &7&l&m--&9&8&l[&r &6&lBetterMotd &8&l]&7&l&m--
        servermodtline2:&r&6The &linnovative&r&6 way to attract players! &7By @Pandu

    # ####################
    # MAX PLAYER OPTIONS #
    # ####################
    variables:

    # Random, Changing max player slots between the set numbers nr1 - nr2 [true or false] [If false Slots will be changed to the amount set in the static Slots.
        {RandomSlots} = "false"

    #    Random numbers between:
        {nr1} = 100
        {nr2} = 200


    # Static Slots [Number] [Is used when random slots is turned to "false"]
        {staticslots} = 100

    on server list ping:
        set motd to "{@servermodtline1}%nl%{@servermodtline2}"
        if {RandomSlots} is "true":
            set max player count to random integer between {nr1} and {nr2}
        else:
            set max player count to {staticslots}
    Always I set the random slots variable to false it does not affect the max player count. Any ideas whats the issue?
    I know its a basic problem but since im quite a beginner sorry for that ^-^

    Best regars,
    Pandu

    btw: Thanks again :3
     
  2. I think the issue is from the variables being set. For some dumb reason, that never seems to work for me either. I personally never use it that way. I just do an on load event, or change the variable with a command.
     
    • Like Like x 2
  3. "if you add a 'variables:' section to your script, the variables defined there will be set to the given value if they don't exist when the script is loaded. You cannot change an existing variable's value this way however, in particular if you change the variables' values here the actual variables will not be changed at all."
     
    • Like Like x 1
  4. I would appreciate if you give some small example so I can see what you mean ;) thanks
     
  5. You can see the values of the variables: section as replacers for the default none. For example if you have a money variable you define {money::%uuid of player%}: 100 so the starter money will be 100 for every player
     
    • Agree Agree x 1
  6. Yeah. But still. Any solution for my problem... how would you solve this?
     
  7. If you want to do it with the variables: part, I would check if all of the variable needed are set in the script, if not, use a different method (like using options)
     
  8. Code (Text):
    on load:
        set {variable} to false
     
    • Like Like x 1
  9. Thanks! And do you know how to change the player count in the server list? N it the max player count.. the one were you can see the current online players
     

Share This Page