Jump to content

Warp skript


Recommended Posts

options:
    prefix: &6&lWarps &7&l»&r

    gui_size: 3 # The size of "/warps" gui menu. Max size is 6!

# Permissions
    warp_permission: warps.use.%arg-1% # Only use this if "{warp::permission}" is true
    warp_create: warps.create # Permission for creating warps
    warp_delete: warps.delete # Permission for deleting warps
    warp_gui: warps.gui # Allow /warps command.
    warp_use: warp.use # Permission for /warp command

on skript load:
    set {warp::permission.use} to false # Set this to true if you want players to have a permission to use a specific warp

command /createwarp <string>:
    permission: {@warp_create}
    trigger:
        if arg-1 is set:
            if {warps::%arg-1%} is not set:
                set {warps::%arg-1%} to location of player
                send "{@prefix}&a Successfully created %arg-1% warp."
            else if {warps::%arg-1%} is set:
                send "{@prefix}&c This warp already exist!"
        if arg-1 is not set:
            send "{@prefix} &cUsage: /createwarp <warp>"

command /warp <string>:
    permission: {@warp_use}
    trigger: 
        if {warp::permission.use} is true:
            if {warps::%arg-1%} is set:
                if player has permission "{@warp_permission}":
                    teleport player to {warps::%arg-1%}
            else if {warps::%arg-1%} is not set:
                send "{@prefix} &cThis warp does not exist!"

        if {warp::permission.use} is false:
            if {warps::%arg-1%} is set:
                teleport player to {warps::%arg-1%}
            else if {warps::%arg-1%} is not set:
                send "{@prefix} &cThis warp does not exist!"

command /delwarp <string>:
    permission: {@warp_delete}
    trigger: 
        if arg-1 is set:
            if {warps::%arg-1%} is set:
                delete {warps::%arg-1%}
                send "{@prefix} &aSuccessfully deleted warp %arg-1%"
            else if {warps::%arg-1%} is not set:
                send "{@prefix} &cThis warp does not exist!"
        if arg-1 is not set:
            send "{@prefix} &cUsage: /delwarp <warp>"

command /warps:
    permission: {@warp_gui}
    trigger: 
        set {_allwarps::*} to size of {warps::*}
        if {_allwarps::*} > 0:
            open virtual chest inventory with size {@gui_size} named "&6&lWarp Menu" to player
            set {_slot} to 0
            loop {warps::*}:
                format gui slot {_slot} of player with chest named "&e&l%loop-value%" to run:
                    execute player command "warp %loop-value%" # Execute player command incase you have {warp::permission.use} set to true

This is a simple warp Skript I made, I haven't tried it so I don't know if it will work or not. I am not the best at Skript but I hope this helps any new servers. If there is any changes that I can add to make the Skript better, please let me know! Thank you.

Edited by NotKaizo31

 

Owner of play.hiveminez.net

 

⊱------------------------------⊰

Joined Minehut on 1/28/2021 (Same day I got Minecraft)

[VIP] - 3/14/2021

[LEGEND] - 5/27/2021

⊱------------------------------⊰

Discord - NotKaizo#0001

In-game name - iKaizo_

If you need any help, feel free to contact me.

Link to comment
Share on other sites

19 hours ago, NotKaizo31 said:
options:
    prefix: &6&lWarps &7&l»&r

    gui_size: 3 # The size of "/warps" gui menu. Max size is 6!

# Permissions
    warp_permission: warps.use.%arg-1% # Only use this if "{warp::permission}" is true
    warp_create: warps.create # Permission for creating warps
    warp_delete: warps.delete # Permission for deleting warps
    warp_gui: warps.gui # Allow /warps command.
    warp_use: warp.use # Permission for /warp command

on skript load:
    set {warp::permission.use} to false # Set this to true if you want players to have a permission to use a specific warp

command /createwarp <string>:
    permission: {@warp_create}
    trigger:
        if arg-1 is set:
            if {warps::%arg-1%} is not set:
                set {warps::%arg-1%} to location of player
                send "{@prefix}&a Successfully created %arg-1% warp."
            else if {warps::%arg-1%} is set:
                send "{@prefix}&c This warp already exist!"
        if arg-1 is not set:
            send "{@prefix} &cUsage: /createwarp <warp>"

command /warp <string>:
    permission: {@warp_use}
    trigger: 
        if {warp::permission.use} is true:
            if {warps::%arg-1%} is set:
                if player has permission "{@warp_permission}":
                    teleport player to {warps::%arg-1%}
            else if {warps::%arg-1%} is not set:
                send "{@prefix} &cThis warp does not exist!"

        if {warp::permission.use} is false:
            if {warps::%arg-1%} is set:
                teleport player to {warps::%arg-1%}
            else if {warps::%arg-1%} is not set:
                send "{@prefix} &cThis warp does not exist!"

command /delwarp <string>:
    permission: {@warp_delete}
    trigger: 
        if arg-1 is set:
            if {warps::%arg-1%} is set:
                delete {warps::%arg-1%}
                send "{@prefix} &aSuccessfully deleted warp %arg-1%"
            else if {warps::%arg-1%} is not set:
                send "{@prefix} &cThis warp does not exist!"
        if arg-1 is not set:
            send "{@prefix} &cUsage: /delwarp <warp>"

command /warps:
    permission: {@warp_gui}
    trigger: 
        set {_allwarps::*} to size of {warps::*}
        if {_allwarps::*} > 0:
            open virtual chest inventory with size {@gui_size} named "&6&lWarp Menu" to player
            set {_slot} to 0
            loop {warps::*}:
                format gui slot {_slot} of player with chest named "&e&l%loop-value%" to run:
                    execute player command "warp %loop-value%" # Execute player command incase you have {warp::permission.use} set to true

This is a simple warp Skript I made, I haven't tried it so I don't know if it will work or not. I am not the best at Skript but I hope this helps any new servers. If there is any changes that I can add to make the Skript better, please let me know! Thank you.

Works nicely but warping doesn't warp the player to the warp they created. And when player warps to a warp that doesn't exist, it doesn't give the error message. Other than that, all other commands works as intended. I think...

2021-06-09_20_22_08.jpg.422c39613f8b72de894e5ec1f3377dca.jpg

Yo who actually reads these

[Vip] - 12/29/2020
[Pro] - 1/25/2022
 

 

 

Link to comment
Share on other sites

Hi, I have not checked out most of the skript but already I can see a very bad practice, not only did you constantly use else, you also used "else if" with the condition that is negative to the condition you are reversing, for example on the line: 

`

 else if {warps::%arg-1%} is set:

`

You do not need to put the condition "if {warps::%arg-1%} is set:" because you are already confirming it is true by declaring else, this takes up server data, a little bit but most importantly it is a TERRIBLE practice

Also, another thing, I would recommend to change your code from "else" to using stop, for example:

 

before:

`

command /createwarp <string>:
    permission: {@warp_create}
    trigger:
        if arg-1 is set:
            if {warps::%arg-1%} is not set:
                set {warps::%arg-1%} to location of player
                send "{@prefix}&a Successfully created %arg-1% warp."
            else if {warps::%arg-1%} is set:
                send "{@prefix}&c This warp already exist!"
        if arg-1 is not set:
            send "{@prefix} &cUsage: /createwarp <warp>"

`

After

`

command /createwarp <string>:
    permission: {@warp_create}
    trigger:
        if arg-1 is set:
            if {warps::%arg-1%} is set:
                send "{@prefix}&c This warp already exist!"
                stop
            set {warps::%arg-1%} to location of player
            send "{@prefix}&a Successfully created %arg-1% warp."
            stop
        send "{@prefix} &cUsage: /createwarp <warp>"

`
As you can see, both of the code variants do the exact same thing, except one is much more cleaner, a bit practice in general, and takes less server power.

Keep in mind I am not making fun of you, I just want you to improve, I am just making a note of this in case you think so.

If you wish to stop using else and switch to "stop" you may contact me on my discord Bassouli#0069 and I would be happy to help you

About the rest of the skript, I do not have time to see that yet so I will view it later, have a good day!

Link to comment
Share on other sites

On 6/30/2021 at 7:06 PM, Bassouli said:

Hi, I have not checked out most of the skript but already I can see a very bad practice, not only did you constantly use else, you also used "else if" with the condition that is negative to the condition you are reversing, for example on the line: 

`

 else if {warps::%arg-1%} is set:

`

You do not need to put the condition "if {warps::%arg-1%} is set:" because you are already confirming it is true by declaring else, this takes up server data, a little bit but most importantly it is a TERRIBLE practice

Also, another thing, I would recommend to change your code from "else" to using stop, for example:

 

before:

`

command /createwarp <string>:
    permission: {@warp_create}
    trigger:
        if arg-1 is set:
            if {warps::%arg-1%} is not set:
                set {warps::%arg-1%} to location of player
                send "{@prefix}&a Successfully created %arg-1% warp."
            else if {warps::%arg-1%} is set:
                send "{@prefix}&c This warp already exist!"
        if arg-1 is not set:
            send "{@prefix} &cUsage: /createwarp <warp>"

`

After

`

command /createwarp <string>:
    permission: {@warp_create}
    trigger:
        if arg-1 is set:
            if {warps::%arg-1%} is set:
                send "{@prefix}&c This warp already exist!"
                stop
            set {warps::%arg-1%} to location of player
            send "{@prefix}&a Successfully created %arg-1% warp."
            stop
        send "{@prefix} &cUsage: /createwarp <warp>"

`
As you can see, both of the code variants do the exact same thing, except one is much more cleaner, a bit practice in general, and takes less server power.

Keep in mind I am not making fun of you, I just want you to improve, I am just making a note of this in case you think so.

If you wish to stop using else and switch to "stop" you may contact me on my discord Bassouli#0069 and I would be happy to help you

About the rest of the skript, I do not have time to see that yet so I will view it later, have a good day!

Using stop is completely unnecessary due to the code already stopping because it reached the end of the code block there is literally nothing happening after with the else. Else is better because you can add a lot more code because your stop variant is only usable in this circumstance. The performance difference between "else:" and "else if ...:" is literally so little it doesn't matter I agree that you can kinda swipe the if due to it already being tested but it really doesn't matter.

tumblr_lqahoaPLkC1ql1l0v.gif

Feel free to add me on discord if you:

dc3456c-e0ec58e8-c807-43e3-b986-5224b91a need help with plugins

dc3456c-e0ec58e8-c807-43e3-b986-5224b91a need help with skripts

dc3456c-e0ec58e8-c807-43e3-b986-5224b91a need to vent about something

tumblr_lqahoaPLkC1ql1l0v.gif

>[ ‧₊˚꒰ʚ Starshine ɞ ‧✦ *#2683 ]<

Link to comment
Share on other sites

18 minutes ago, StarBunnie said:

Using stop is completely unnecessary due to the code already stopping because it reached the end of the code block there is literally nothing happening after with the else. Else is better because you can add a lot more code because your stop variant is only usable in this circumstance. The performance difference between "else:" and "else if ...:" is literally so little it doesn't matter I agree that you can kinda swipe the if due to it already being tested but it really doesn't matter.

it matters a lot when you try expanding to other languages

Link to comment
Share on other sites

17 minutes ago, Bassouli said:

it matters a lot when you try expanding to other languages

You are actively rating a skript right now someone made for MC if they wanted to expand to other coding languages they would've asked that specifically and overall other languages differ quite a lot from skript so in theory you would need to make a looot of changes.

Edited by StarBunnie

tumblr_lqahoaPLkC1ql1l0v.gif

Feel free to add me on discord if you:

dc3456c-e0ec58e8-c807-43e3-b986-5224b91a need help with plugins

dc3456c-e0ec58e8-c807-43e3-b986-5224b91a need help with skripts

dc3456c-e0ec58e8-c807-43e3-b986-5224b91a need to vent about something

tumblr_lqahoaPLkC1ql1l0v.gif

>[ ‧₊˚꒰ʚ Starshine ɞ ‧✦ *#2683 ]<

Link to comment
Share on other sites

1 hour ago, StarBunnie said:

You are actively rating a skript right now someone made for MC if they wanted to expand to other coding languages they would've asked that specifically and overall other languages differ quite a lot from skript so in theory you would need to make a looot of changes.

I do not understand most of your past 2 messages

Link to comment
Share on other sites

48 minutes ago, Bassouli said:

I do not understand most of your past 2 messages

Fine by me all I really said is that you shouldn't say "oh that's a terrible practice you should stop immediately" while also saying you're not judging them like come on it's a free skript they did for a game.

tumblr_lqahoaPLkC1ql1l0v.gif

Feel free to add me on discord if you:

dc3456c-e0ec58e8-c807-43e3-b986-5224b91a need help with plugins

dc3456c-e0ec58e8-c807-43e3-b986-5224b91a need help with skripts

dc3456c-e0ec58e8-c807-43e3-b986-5224b91a need to vent about something

tumblr_lqahoaPLkC1ql1l0v.gif

>[ ‧₊˚꒰ʚ Starshine ɞ ‧✦ *#2683 ]<

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...