1. Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Skript Round Number

Discussion in 'Skript' started by jonawoning, Feb 2, 2020.

Thread Status:
Not open for further replies.
  1. jonawoning

    jonawoning Member

    Joined:
    May 24, 2019
    Messages:
    29
    Likes Received:
    2
    The numbers on a variable in my skript are giving like 10.0.. and i want it round like 10.

    Not like this:

    https://gyazo.com/93353b34cce58962d4011a0ba42b5f93

    Code:
    Code (Text):
    1. every real minute:
    2.     loop all players:
    3.         if {kd.influence.%loop-player%} is not 2000:
    4.             add 1 to {kd.influence.%loop-player%}
     
    #1 jonawoning, Feb 2, 2020
    Last edited: Feb 2, 2020
  2. Goose

    Supporter

    Joined:
    Nov 23, 2019
    Messages:
    429
    Likes Received:
    30
    give this a shot
    Code (Text):
    1. every real minute:
    2.     loop all players:
    3.         if {kd.influence.%loop-player%} is not 2000:
    4.             add 1 to {kd.influence.%loop-player%}
    5.             if {kd.influence.%loop-player%} contains ".0":
    6.                 set {kd.influence.%loop-player%} to subtext of {kd.influence.%loop-player%} from characters (length of {kd.influence.%loop-player%} - 2) to (length of {kd.influence.%loop-player%})
     
    • Like Like x 1
  3. jonawoning

    jonawoning Member

    Joined:
    May 24, 2019
    Messages:
    29
    Likes Received:
    2
    Hmmm gives a error.

    WARN Empty configuration section! You might want to indent one or more of the subsequent lines to make them belong to this section or remove the colon at the end of the line if you don't want this line to start a section. (kingdom.sk, line 1868: if {kd.influence.%loop-player%} contains ".0":')
     
  4. Goose

    Supporter

    Joined:
    Nov 23, 2019
    Messages:
    429
    Likes Received:
    30
    try this
    Code (Text):
    1. every real minute:
    2.     loop all players:
    3.         if {kd.influence.%loop-player%} is not 2000:
    4.             add 1 to {kd.influence.%loop-player%}
    5.             set {kd.influence.%loop-player%} to subtext of {kd.influence.%loop-player%} from characters (length of {kd.influence.%loop-player%} - 2) to (length of {kd.influence.%loop-player%})
     
  5. TPGamesNL

    Supporter Addon Developer Dev Programme

    Joined:
    Jan 20, 2018
    Messages:
    1,501
    Likes Received:
    107
    Medals:
    Use the round function or expression
     
  6. PlaySkyHd

    PlaySkyHd New Member

    Joined:
    Oct 20, 2017
    Messages:
    5
    Likes Received:
    0
    You can use

    set {_number} to 3/4 rounded to 3 decimal places
     
    • Agree Agree x 1
Thread Status:
Not open for further replies.

Share This Page

Loading...