Clear inv on spawn/join

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

Rapid

Member
Dec 15, 2023
4
0
1
I have a PVP server. In my server I wanna do like if any player go to spawn his inv got clear. I am using advanced spawn plugin. Is there anything if any player do /spawn there will be some commands executed. Note : I wanna only create that if a player is in another world and do /spawn he will come in spawn world and his inv got clear but if he will go back in his old world so he will get his stuff back! I made like this!

on join:
if player's world is "spawn":
execute console command "ci %player% **"

Idk for teleport I only know on join. It's my 4th script I am making in my life help me making this or make one for me please! advance thanks
 
I have a PVP server. In my server I wanna do like if any player go to spawn his inv got clear. I am using advanced spawn plugin. Is there anything if any player do /spawn there will be some commands executed. Note : I wanna only create that if a player is in another world and do /spawn he will come in spawn world and his inv got clear but if he will go back in his old world so he will get his stuff back! I made like this!

on join:
if player's world is "spawn":
execute console command "ci %player% **"

Idk for teleport I only know on join. It's my 4th script I am making in my life help me making this or make one for me please! advance thanks
You can check using something like
Code:
on command "/spawn":
    execute console command ""
Regarding the world and inventory system, you're going to have to save the players inventory, then remove it, and using the event
Code:
on world change:
detect whether the player's world changed to the world he has a saved inventory in, then give the player his items
 
You could do this. I just took a spawn script and added clear inventory every time you teleported to spawn. You can also teleport others to spawn if you have the right permissions which can be helpful for dealing with bugs or hackers. I hope this is what you wanted and good luck on your skripting journey! I hope to see you around!

Code:
command /setspawn:
    aliases: spawnset, sethub, hubset, setlobby, lobbyset
    permission: spawn.setspawn
    permission message: &cSorry, but you don't have permission to execute this command!
    description: Set spawn at your location.
    trigger:
        message "&6You have &cset spawn&6 at your location!"
        set {spawn} to location of player

command /spawn [<player>]:
    aliases: hub, lobby
    description: Teleport you to spawn.
    trigger:
        if {spawn} isn't set:
            message "&4Error:&c spawn is not set!"
            cancel event
        else:
            argument 1 is not set:
                teleport player to {spawn}
                message "&6Teleporting..."
                clear player's inventory
            else:
                if sender has permission "spawn.spawn.others":
                    if argument is online:
                        teleport argument to {spawn}
                    if sender is a player:
                        message "&6You have been teleported to spawn by &c%player%&6." to argument 1
                    if sender is not a player:
                        message "&6You have been teleported to spawn by &cConsole&6." to argument 1
                        clear player's inventory
                        teleport player to {spawn}
                else:
                    message "&cSorry, but you don't have permission to execute this command!"

command /delspawn:
    permission: spawn.spawn.delete
    permission message: &cSorry, but you don't have permission to execute this command!
    description: Unset spawn location.
    trigger:
        delete {spawn}
        message "&6You have successfully unset &cspawn6!"


on first join:
    teleport player to {spawn}
 
You can mix this skript with the other person's and you may have a fully working skript!