Jump to content
Edb

[3 KB DOWNLOAD] Gamemode Switcher

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

Share this post


Link to post
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

I've been doing skript for 4 years. I don't find my self a "better" skripter or do competitions against others.

I just wish people can just get along & just help each out and be kind to one and another.

 

I have been hosting ValkNet for 5 years

ever since 2015 when i joined minehut around February or January.

 

I'm the owner of ValkyrieNetwork (known as ValkNet) | https://discord.gg/rPTYbQY

A great service that i provide for the minehut community!

 

Contact:

Discord: https://discord.gg/rPTYbQY

Share this post


Link to post
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×
×
  • Create New...