Problem with warning system

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

Ryan Meikle

Member
Feb 11, 2017
5
0
0
Hello,
I'm currently trying to make a warning system in skript.

But for some odd reason the command refuses to send.

No errors on reload: http://prntscr.com/efzc5c

The console does log the command http://prntscr.com/efzcdl

Any suggestions to this?

Code:

Code:
command /warn [<player>] [<text>]:
 permission: edgemc.warn
 permission message: {@noperm}
 trigger:
  if player has permission "edgemc.warn":
   if arg 1 is not set:
    if arg 2 is not set:
     send "{@prefix} You did not specify a player and a reason."
     stop
   if arg 1 is set:
    if arg 2 is not set:
     send "{@prefix} You did not specify a reason"
     stop
   if arg 1 is set:
    if arg 2 is set:
     if {warning1::%uuid of arg 1%} is false:
      set {warning1::%uuid of arg 1%} to true
      send "{@prefix} You received your first warning. Reason below"
      send "{@prefix} %arg 2%"
      stop
     if {warning1::%uuid of arg 1%} is true:
      if {warning2::%uuid of arg 1%} is false:
       set {warning2::%uuid of arg 1%} to true
       send "{@prefix} You received your second warning."
       send "{@prefix} Third warning will be a kick and a cleared inventory."
       send "{@prefix} Reason: %arg 2%"
       stop
     if {warning1::%uuid of arg 1%} is true:
      if {warning2::%uuid of arg 1%} is true:
       if {warning3::%uuid of arg 1%} is false:
        set {warning3::%uuid of arg 1%} to true
        clear the inventory of arg 1
        stop
  else:
   send "{@noperm}"
   stop
 
This code is very weird. You have "if arg 1 is set" twice, and you're not using else statements properly. When programming, if you want something to happen if an "if" statement DOESN'T go through, you can use "else" instead of just putting the opposite. So instead of doing this:

code_language.skript:
if arg 1 is set:
    <code>
if arg 1 is not set:
    <code>

You should do

code_language.skript:
if arg 1 is set:
    <code>
else:
    <code>

If you update your code to be like that, it will make it smaller and more readable, and help you track down errors better.
 
This code is very weird. You have "if arg 1 is set" twice, and you're not using else statements properly. When programming, if you want something to happen if an "if" statement DOESN'T go through, you can use "else" instead of just putting the opposite. So instead of doing this:

code_language.skript:
if arg 1 is set:
    <code>
if arg 1 is not set:
    <code>

You should do

code_language.skript:
if arg 1 is set:
    <code>
else:
    <code>

If you update your code to be like that, it will make it smaller and more readable, and help you track down errors better.



Would you be willing to help me?
I happen not to understand this. You can call me stupid for that.

I'm pretty new to this. And i'm experimenting a lot but didn't get it to work yet.
 
Status
Not open for further replies.