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!

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

Help with a number generator

Discussion in 'Requests' started by chasebennetthill, Feb 13, 2020 at 2:01 AM.

  1. chasebennetthill

    Joined:
    Thursday
    Messages:
    1
    Likes Received:
    0
    hello i have made some code to make a number gen all works fine but if the number is 5 then users can win with 55 15 25 or pretty much any number with five in it
    Code (Text):
    1.  
    2.  
    3. variables:
    4.     {number} =  0
    5.     {numberon} = 0
    6.  
    7.  
    8.        
    9.        
    10. every 100 seconds:
    11.     set {number} to random integer between 1 and 10
    12.     set {numberon} to 1
    13.     broadcast "&c&l[Dino&6&lVerse] &cI am thinking of a number between 1 and 10 try and guess it!"
    14.    
    15.  
    16. on chat:
    17.     if message contains "%{number}%":
    18.         if {numberon} = 1:
    19.             broadcast "&e&l[Dino&6&lVerse] &c%Player% Guessed my number!"
    20.             set {numberon} to 0
    21.    
    22.    
    23.  
    --- Double Post Merged, Feb 14, 2020 at 5:20 AM, Original Post Date: Feb 13, 2020 at 2:01 AM ---
    please i need help??
     
  2. Goose

    Goose Well-Known Member

    Joined:
    Nov 23, 2019
    Messages:
    217
    Likes Received:
    8
    Considering the parser is down, the code i'll work on to give you might have errors as I can't test it on a school chromebook. I'll notify you when it's done.
    --- Double Post Merged, Feb 16, 2020 at 4:03 PM, Original Post Date: Feb 16, 2020 at 3:57 PM ---
    Try this, it should work

    Code (Text):
    1. every 100 seconds:
    2.     set {number} to random integer between 1 and 10
    3.     set {numberon} to true
    4.     broadcast "&c&l[Dino&6&lVerse] &cI am thinking of a number between 1 and 10 try and guess it!"
    5. on chat:
    6.     if {numberon} is true:
    7.         if message is "%{number}%":
    8.             broadcast "&e&l[Dino&6&lVerse] &c%Player% Guessed my number!"
    9.             set {numberon} to false
     
Loading...