Solved How is it right?

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

entwickeln

Member
May 11, 2022
40
0
6
Hello guys, im new to skript and im just playing around with an gamemode command. Then i tried:
if arg 1 is greater than "3":
send message "&cWrong Usage: /gm <0, 1, 2, 3>"
but it's not working.. how is it right? i only saw "greather than"
[doublepost=1652307511,1652307437][/doublepost]options:
prefix: &c✕ &7Server &c✕ &7|
command /gm [<string>]:
permission: server.gm
permission message: "{@prefix} &cDas darfst du nicht!"
trigger:
if arg 1 is "survival" or "s" or "0":
set player's gamemode to survival
send message "{@prefix} &eDu bist nun im &6Überlebensmodus&e." to player

else if arg 1 is "creative" or "c" or "1":
set player's gamemode to creative
send message "{@prefix} &eDu bist nun im &6Kreativmodus&e." to player

else if arg 1 is "adventure" or "a" or "2":
set player's gamemode to adventure
send message "{@prefix} &eDu bist nun im &6Abenteuermodus&e." to player

else if arg 1 is "spectator" or "spec" or "3":
set player's gamemode to spectator
send message "{@prefix} &eDu bist nun im &6Zuschauermodus&e." to player

else if arg 1 is not set:
send message "{@prefix} &cFalscher Syntax: /gm <0, 1, 2, 3>"

else if arg 1 is greater than "3":
send message "{@prefix} &cFalscher Syntax: /gm <0, 1, 2, 3>"
This is my full code..
 
greater than doesn't work because it is registered as a string, and you can't compare strings/texts with numbers/integers. What you could do is check if the first argument contains the numbers "0", "1", "2" or "3" and if they do, set a variable to the argument where you parse it as a number. Afterwards, you can check if arg-1 is greater than 3 or not.
 
Status
Not open for further replies.