Solved Help with a number generator

  • 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!

Feb 13, 2020
3
0
0
40
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:
variables:
    {number} =  0
    {numberon} = 0


        
        
every 100 seconds:
    set {number} to random integer between 1 and 10
    set {numberon} to 1
    broadcast "&c&l[Dino&6&lVerse] &cI am thinking of a number between 1 and 10 try and guess it!"
    

on chat:
    if message contains "%{number}%":
        if {numberon} = 1:
            broadcast "&e&l[Dino&6&lVerse] &c%Player% Guessed my number!"
            set {numberon} to 0
[doublepost=1581657620,1581559279][/doublepost]please i need help??
 
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.
[doublepost=1581868997,1581868663][/doublepost]Try this, it should work

Code:
every 100 seconds:
    set {number} to random integer between 1 and 10
    set {numberon} to true
    broadcast "&c&l[Dino&6&lVerse] &cI am thinking of a number between 1 and 10 try and guess it!"
on chat:
    if {numberon} is true:
        if message is "%{number}%":
            broadcast "&e&l[Dino&6&lVerse] &c%Player% Guessed my number!"
            set {numberon} to false
 
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.
[doublepost=1581868997,1581868663][/doublepost]Try this, it should work

Code:
every 100 seconds:
    set {number} to random integer between 1 and 10
    set {numberon} to true
    broadcast "&c&l[Dino&6&lVerse] &cI am thinking of a number between 1 and 10 try and guess it!"
on chat:
    if {numberon} is true:
        if message is "%{number}%":
            broadcast "&e&l[Dino&6&lVerse] &c%Player% Guessed my number!"
            set {numberon} to false
Thanks I used this and now it works
 
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}"