Jump to content

[3 KB DOWNLOAD] Gamemode Switcher


Edb

Recommended Posts

Gamemode Switcher

This skript ain't your average command executer.

 

Source Code

To get a hold of the skript's code, download it (gamemode-switcher.sk), or copy the code below. Feel free to fork if you'd like!

Spoiler

#--------------#--------------------------------#
# /-\ |\/| /-\ # No options!                    #
# | - |  | \-\ # Edit the commands below if     #
# \-/ |  | \-/ # you're brave enough.           #
#--------------#--------------------------------#
command /gmc [<offlineplayer>]:
    trigger:
        if player has permission "gamemode.creative":
            if arg-1 is not set:
                set player's gamemode to creative
                send "&2Set your gamemode to &aCreative&2."
            else if arg-1 is set:
                if arg-1 is online:
                    set arg-1's gamemode to creative
                    send "&2Set &a%arg-1%&2's gamemode to &aCreative&2."
                    send "&2Your gamemode has been set to &aCreative&2." to arg-1
                else:
                    send "&cThis player is not online!"
        else:
            send "&cYou don't have the required permission!"

command /gms [<offlineplayer>]:
    trigger:
        if player has permission "gamemode.survival":
            if arg-1 is not set:
                set player's gamemode to survival
                send "&2Set your gamemode to &aSurvival&2."
            else if arg-1 is set:
                if arg-1 is online:
                    set arg-1's gamemode to survival
                    send "&2Set &a%arg-1%&2's gamemode to &aSurvival&2."
                    send "&2Your gamemode has been set to &aSurvival&2." to arg-1
                else:
                    send "&cThis player is not online!"
        else:
            send "&cYou don't have the required permission!"

command /gma [<offlineplayer>]:
    trigger:
        if player has permission "gamemode.adventure":
            if arg-1 is not set:
                set player's gamemode to adventure
                send "&2Set your gamemode to &aAdventure&2."
            else if arg-1 is set:
                if arg-1 is online:
                    set arg-1's gamemode to adventure
                    send "&2Set &a%arg-1%&2's gamemode to &aAdventure&2."
                    send "&2Your gamemode has been set to &aAdventure&2." to arg-1
                else:
                    send "&cThis player is not online!"
        else:
            send "&cYou don't have the required permission!"

command /gmsp [<offlineplayer>]:
    trigger:
        if player has permission "gamemode.spectator":
            if arg-1 is not set:
                set player's gamemode to spectator
                send "&2Set your gamemode to &aSpectator&2."
            else if arg-1 is set:
                if arg-1 is online:
                    set arg-1's gamemode to spectator
                    send "&2Set &a%arg-1%&2's gamemode to &aSpectator&2."
                    send "&2Your gamemode has been set to &aSpectator&2." to arg-1
                else:
                    send "&cThis player is not online!"
        else:
            send "&cYou don't have the required permission!"

#-----------------#-----------------------------#
#     --- |-\ |-\ #                             #
#     |-  | | |-< # End of file.                #
# --- --- |-/ |-/ #                             #
#-----------------#-----------------------------#

 

Forking does not mean you're allowed to steal the file and claim it as your own. Make sure to at least keep the "End of file" footnote.

 

Download

Instant Download:

--> gamemode-switcher.sk <--

Mediafire Download:

--> Click here! <--

Spigot Page:

Coming Soon!

gamemode-switcher.sk

Edited by Edb
im dum dum

Loading signature...
duh.gif.8b527aec819aa6aec1163679bc32d922.gif

Link to comment
Share on other sites

The only bad part about this is the messages do not send to "arg 1" but send to the player who executes the command.

#--------------#-------------------------#
# /-\ |\/| /-\ # No options!             #
# | - |  | \-\ # Edit the commands below #
# \-/ |  | \-/ # if you're brave enough. #
#--------------#-------------------------#
command /gmc [<offlineplayer>]:
    trigger:
        if player has permission "gamemode.creative":
            if arg-1 is not set:
                set player's gamemode to creative
                send "&2Set your gamemode to &aCreative&2."
            else if arg-1 is set:
                if arg-1 is online:
                    set arg-1's gamemode to creative
                    send "&2Set &a%arg-1%&2's gamemode to &aCreative&2."
                    send "&2Your gamemode has been set to &aCreative&2."
                else:
                    send "&cThis player is not online!"
        else:
            send "&cYou don't have the required permission!"

command /gms [<offlineplayer>]:
    trigger:
        if player has permission "gamemode.survival":
            if arg-1 is not set:
                set player's gamemode to survival
                send "&2Set your gamemode to &aSurvival&2."
            else if arg-1 is set:
                if arg-1 is online:
                    set arg-1's gamemode to survival
                    send "&2Set &a%arg-1%&2's gamemode to &aSurvival&2."
                    send "&2Your gamemode has been set to &aSurvival&2."
                else:
                    send "&cThis player is not online!"
        else:
            send "&cYou don't have the required permission!"

command /gma [<offlineplayer>]:
    trigger:
        if player has permission "gamemode.adventure":
            if arg-1 is not set:
                set player's gamemode to adventure
                send "&2Set your gamemode to &aAdventure&2."
            else if arg-1 is set:
                if arg-1 is online:
                    set arg-1's gamemode to adventure
                    send "&2Set &a%arg-1%&2's gamemode to &aAdventure&2."
                    send "&2Your gamemode has been set to &aAdventure&2."
                else:
                    send "&cThis player is not online!"
        else:
            send "&cYou don't have the required permission!"

command /gmsp [<offlineplayer>]:
    trigger:
        if player has permission "gamemode.spectator":
            if arg-1 is not set:
                set player's gamemode to spectator
                send "&2Set your gamemode to &aSpectator&2."
            else if arg-1 is set:
                if arg-1 is online:
                    set arg-1's gamemode to spectator
                    send "&2Set &a%arg-1%&2's gamemode to &aSpectator&2."
                    send "&2Your gamemode has been set to &aSpectator&2."
                else:
                    send "&cThis player is not online!"
        else:
            send "&cYou don't have the required permission!"

#-----------------#-----------------------------#
#     --- |-\ |-\ #                             #
#     |-  | | |-< # End of file.                #
# --- --- |-/ |-/ #                             #
#-----------------#-----------------------------#

Should look like this:

#--------------#-------------------------#
# /-\ |\/| /-\ # No options!             #
# | - |  | \-\ # Edit the commands below #
# \-/ |  | \-/ # if you're brave enough. #
#--------------#-------------------------#
command /gmc [<offlineplayer>]:
    trigger:
        if player has permission "gamemode.creative":
            if arg-1 is not set:
                set player's gamemode to creative
                send "&2Set your gamemode to &aCreative&2."
            else if arg-1 is set:
                if arg-1 is online:
                    set arg-1's gamemode to creative
                    send "&2Set &a%arg-1%&2's gamemode to &aCreative&2." to arg 1
                    send "&2Your gamemode has been set to &aCreative&2." to player
                else:
                    send "&cThis player is not online!"
        else:
            send "&cYou don't have the required permission!"

command /gms [<offlineplayer>]:
    trigger:
        if player has permission "gamemode.survival":
            if arg-1 is not set:
                set player's gamemode to survival
                send "&2Set your gamemode to &aSurvival&2."
            else if arg-1 is set:
                if arg-1 is online:
                    set arg-1's gamemode to survival
                    send "&2Set &a%arg-1%&2's gamemode to &aSurvival&2." to arg 1
                    send "&2Your gamemode has been set to &aSurvival&2." to player
                else:
                    send "&cThis player is not online!"
        else:
            send "&cYou don't have the required permission!"

command /gma [<offlineplayer>]:
    trigger:
        if player has permission "gamemode.adventure":
            if arg-1 is not set:
                set player's gamemode to adventure
                send "&2Set your gamemode to &aAdventure&2."
            else if arg-1 is set:
                if arg-1 is online:
                    set arg-1's gamemode to adventure
                    send "&2Set &a%arg-1%&2's gamemode to &aAdventure&2." to arg 1
                    send "&2Your gamemode has been set to &aAdventure&2." to player
                else:
                    send "&cThis player is not online!"
        else:
            send "&cYou don't have the required permission!"

command /gmsp [<offlineplayer>]:
    trigger:
        if player has permission "gamemode.spectator":
            if arg-1 is not set:
                set player's gamemode to spectator
                send "&2Set your gamemode to &aSpectator&2."
            else if arg-1 is set:
                if arg-1 is online:
                    set arg-1's gamemode to spectator
                    send "&2Set &a%arg-1%&2's gamemode to &aSpectator&2." to arg 1
                    send "&2Your gamemode has been set to &aSpectator&2." to player
                else:
                    send "&cThis player is not online!"
        else:
            send "&cYou don't have the required permission!"

#-----------------#-----------------------------#
#     --- |-\ |-\ #                             #
#     |-  | | |-< # End of file.                #
# --- --- |-/ |-/ #                             #
#-----------------#-----------------------------#

Now the messages are sending to "arg 1" and not just constantly spamming the player who executes the command.

Edited by TacticalModz

Start your Minecraft server today for as low as £0.50/weekly for up to 4 GB of RAM! (£3.50 Monthly) and be equipped for all situations with our high-performance gear keeping your servers running 24/7

Why choose Us?
• Guaranteed 99.9% Uptime
• NVMe RAID Fast Storage
• 24/7 Hosting
• Instant Setup
• 50% Discount. Use Code: 50OFF (Ends on November 11th)

We want to ensure our customers are happy with the service they received and support. We aim to provide low-costs those who cant afford a minecraft server. No extra costs, no setup fees! One-time payment and you are good to go with our instant setup feature we introduced to ensure your server is ready to go!

Planning to make a community or a project you want to work on? We got you covered! Our servers are optimized for performance and security, so you can have peace of mind and focus on your project. Our servers are also reliable and packed with features, so you can start playing right away.

We guarantee 99% uptime and 24/7 customer support, so you can always ask for help if you need it.

Links:
https://forums.valknet.org
https://billing.valknet.org
Invite: https://discord.gg/FqSRt4ZCAC

Link to comment
Share on other sites

9 hours ago, TacticalModz said:
Spoiler

 

The only bad part about this is the messages do not send to "arg 1" but send to the player who executes the command.



#--------------#-------------------------#
# /-\ |\/| /-\ # No options!             #
# | - |  | \-\ # Edit the commands below #
# \-/ |  | \-/ # if you're brave enough. #
#--------------#-------------------------#
command /gmc [<offlineplayer>]:
    trigger:
        if player has permission "gamemode.creative":
            if arg-1 is not set:
                set player's gamemode to creative
                send "&2Set your gamemode to &aCreative&2."
            else if arg-1 is set:
                if arg-1 is online:
                    set arg-1's gamemode to creative
                    send "&2Set &a%arg-1%&2's gamemode to &aCreative&2."
                    send "&2Your gamemode has been set to &aCreative&2."
                else:
                    send "&cThis player is not online!"
        else:
            send "&cYou don't have the required permission!"

command /gms [<offlineplayer>]:
    trigger:
        if player has permission "gamemode.survival":
            if arg-1 is not set:
                set player's gamemode to survival
                send "&2Set your gamemode to &aSurvival&2."
            else if arg-1 is set:
                if arg-1 is online:
                    set arg-1's gamemode to survival
                    send "&2Set &a%arg-1%&2's gamemode to &aSurvival&2."
                    send "&2Your gamemode has been set to &aSurvival&2."
                else:
                    send "&cThis player is not online!"
        else:
            send "&cYou don't have the required permission!"

command /gma [<offlineplayer>]:
    trigger:
        if player has permission "gamemode.adventure":
            if arg-1 is not set:
                set player's gamemode to adventure
                send "&2Set your gamemode to &aAdventure&2."
            else if arg-1 is set:
                if arg-1 is online:
                    set arg-1's gamemode to adventure
                    send "&2Set &a%arg-1%&2's gamemode to &aAdventure&2."
                    send "&2Your gamemode has been set to &aAdventure&2."
                else:
                    send "&cThis player is not online!"
        else:
            send "&cYou don't have the required permission!"

command /gmsp [<offlineplayer>]:
    trigger:
        if player has permission "gamemode.spectator":
            if arg-1 is not set:
                set player's gamemode to spectator
                send "&2Set your gamemode to &aSpectator&2."
            else if arg-1 is set:
                if arg-1 is online:
                    set arg-1's gamemode to spectator
                    send "&2Set &a%arg-1%&2's gamemode to &aSpectator&2."
                    send "&2Your gamemode has been set to &aSpectator&2."
                else:
                    send "&cThis player is not online!"
        else:
            send "&cYou don't have the required permission!"

#-----------------#-----------------------------#
#     --- |-\ |-\ #                             #
#     |-  | | |-< # End of file.                #
# --- --- |-/ |-/ #                             #
#-----------------#-----------------------------#

Should look like this:



#--------------#-------------------------#
# /-\ |\/| /-\ # No options!             #
# | - |  | \-\ # Edit the commands below #
# \-/ |  | \-/ # if you're brave enough. #
#--------------#-------------------------#
command /gmc [<offlineplayer>]:
    trigger:
        if player has permission "gamemode.creative":
            if arg-1 is not set:
                set player's gamemode to creative
                send "&2Set your gamemode to &aCreative&2."
            else if arg-1 is set:
                if arg-1 is online:
                    set arg-1's gamemode to creative
                    send "&2Set &a%arg-1%&2's gamemode to &aCreative&2." to arg 1
                    send "&2Your gamemode has been set to &aCreative&2." to player
                else:
                    send "&cThis player is not online!"
        else:
            send "&cYou don't have the required permission!"

command /gms [<offlineplayer>]:
    trigger:
        if player has permission "gamemode.survival":
            if arg-1 is not set:
                set player's gamemode to survival
                send "&2Set your gamemode to &aSurvival&2."
            else if arg-1 is set:
                if arg-1 is online:
                    set arg-1's gamemode to survival
                    send "&2Set &a%arg-1%&2's gamemode to &aSurvival&2." to arg 1
                    send "&2Your gamemode has been set to &aSurvival&2." to player
                else:
                    send "&cThis player is not online!"
        else:
            send "&cYou don't have the required permission!"

command /gma [<offlineplayer>]:
    trigger:
        if player has permission "gamemode.adventure":
            if arg-1 is not set:
                set player's gamemode to adventure
                send "&2Set your gamemode to &aAdventure&2."
            else if arg-1 is set:
                if arg-1 is online:
                    set arg-1's gamemode to adventure
                    send "&2Set &a%arg-1%&2's gamemode to &aAdventure&2." to arg 1
                    send "&2Your gamemode has been set to &aAdventure&2." to player
                else:
                    send "&cThis player is not online!"
        else:
            send "&cYou don't have the required permission!"

command /gmsp [<offlineplayer>]:
    trigger:
        if player has permission "gamemode.spectator":
            if arg-1 is not set:
                set player's gamemode to spectator
                send "&2Set your gamemode to &aSpectator&2."
            else if arg-1 is set:
                if arg-1 is online:
                    set arg-1's gamemode to spectator
                    send "&2Set &a%arg-1%&2's gamemode to &aSpectator&2." to arg 1
                    send "&2Your gamemode has been set to &aSpectator&2." to player
                else:
                    send "&cThis player is not online!"
        else:
            send "&cYou don't have the required permission!"

#-----------------#-----------------------------#
#     --- |-\ |-\ #                             #
#     |-  | | |-< # End of file.                #
# --- --- |-/ |-/ #                             #
#-----------------#-----------------------------#

Now the messages are sending to "arg 1" and not just constantly spamming the player who executes the command.

 

 

You are absolutely correct, but the first message was ment to be sent to command-sender, confirming that the gamemode of arg-1 has been set to the gamemode they specified in the command. The second send was for arg-1, as it was to say to the player specified, "Hey, your gamemode was switched!" I will open VSC, edit this, then fix the online version. Thanks for pointing this out, @TacticalModz!

  • Like 1

Loading signature...
duh.gif.8b527aec819aa6aec1163679bc32d922.gif

Link to comment
Share on other sites

  • 2 weeks later...
  • 3 weeks later...
On 8/19/2019 at 7:00 PM, Id0tk1d said:

Nice! I will Fork

mhm yes mhm yes mhm yes mhm yes mhm yes mhm yes mhm yes mhm yes mhm yes mhm yes mhm yes mhm yes mhm yes mhm yes mhm yes 

Loading signature...
duh.gif.8b527aec819aa6aec1163679bc32d922.gif

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