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.

Solved Help with a number generator

Discussion in 'Requests' started by chasebennetthill, Feb 13, 2020.

  1. chasebennetthill

    Joined:
    Feb 13, 2020
    Messages:
    2
    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, Original Post Date: Feb 13, 2020 ---
    please i need help??
     
  2. Best Answer:
    Post #2 by Goose, Feb 16, 2020
  3. Goose

    Goose Well-Known Member

    Joined:
    Nov 23, 2019
    Messages:
    261
    Likes Received:
    9
    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, Original Post Date: Feb 16, 2020 ---
    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
     
  4. chasebennetthill

    Joined:
    Feb 13, 2020
    Messages:
    2
    Likes Received:
    0
    Thanks I used this and now it works
     
    • Friendly Friendly x 1
  5. Goose

    Goose Well-Known Member

    Joined:
    Nov 23, 2019
    Messages:
    261
    Likes Received:
    9
    No problem, make sure to mark the post as solved!
     
  6. TheCringleYT

    TheCringleYT Well-Known Member

    Joined:
    Sep 29, 2019
    Messages:
    99
    Likes Received:
    1
    Waaaaaaaiiiiiiiii.... School Chromebook? I have them too lmao.
     
  7. TenToTu Sho

    TenToTu Sho Member

    Joined:
    Dec 30, 2019
    Messages:
    7
    Likes Received:
    0
    Also, for the future, you put "if message contains {number}", which would work, even if a player types "12345678910", because the message does indeed contain the number. So careful about that, and remember to replace it with "if message is {number}"
     
Loading...