Solved Hm.... Chances not working with Json?

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

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

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

Adrihun

Member
Feb 1, 2017
368
6
0
So Here is my prefix script
Why aren't chances not working? When i write a message in chat, and click my name, it will always suggest "/tell"

code_language.skript:
on chat:
    player has permission "owner.user"
    cancel event
    set {_to} to "%player%"
    chance of 50%:
        set {_msg} to "test &5%player%&7%message%||sgt:/msg %player%"
    chance of 50%:
        set {_msg} to "test &6%player%&2 %message%||sgt:/tell %player%"
    json({_to}, {_msg})
 
code_language.skript:
on chat:
    player has permission "owner.user"
    cancel event
    set {_to} to "%player%"
    chance of 50%:
        set {_msg} to "test &5%player%&7%message%||sgt:/msg %player%"
    else:
        set {_msg} to "test &6%player%&2 %message%||sgt:/tell %player%"
    json({_to}, {_msg})

But thats kinda useless, why do you want to do this?
 
code_language.skript:
on chat:
    player has permission "owner.user"
    cancel event
    set {_to} to "%player%"
    set {_random.command} to random integer between 1 and 3 # Amount of commands
    {_random.command} is 1:
        set {_msg} to "test &5%player%&7%message%||sgt:/msg %player%"
    {_random.command} is 2:
        set {_msg} to "test &5%player%&7%message%||sgt:/tell %player%"
    {_random.command} is 3:
        set {_msg} to "test &5%player%&7%message%||sgt:/rip %player%"
    json({_to}, {_msg})
 
You post so much I think we need a sub forum dedicated to just you... as for your problem, it does work but it will almost always suggest /tell because even if it chose /msg then it will still have a chance to pick /tell so for it to be /msg it would have to choose /msg AND not choose /tell if that makes sense. Do something like this instead:

code_language.skript:
on chat:
    player has permission "owner.user"
    cancel event
    set {_to} to "%player%"
    set {_option2} to true
    chance of 50%:
        set {_msg} to "test &5%player%&7%message%||sgt:/msg %player%"
        set {_option2} to false
    if {_option2} is true:
        set {_msg} to "test &6%player%&2 %message%||sgt:/tell %player%"
    json({_to}, {_msg})
 
Status
Not open for further replies.