Jump to content

How do I have a skript automatically get made after a player creates their world?


whenyouknowitbelik

Recommended Posts

Hey,

I recently put together this skript in which a specific player can use /gmc only in their self-made world, but how do I get this to be automatic? For example, whenever a player creates a world using my UI, they can automatically use /gmc without me having to create a skript for them that will allow them to do so.

on command "/gmc":
    if player's world is "(Player IGN)":
        execute console command "/gmc (Player IGN)"
    else:
        send "unknown command message"

on command "/gms":
    if player's world is "(Player IGN)":
        execute console command "/gms (Player IGN)"
    else:
        send "unknown command message"

Any help would be greatly appreciated.

Link to comment
Share on other sites

What do you mean by that? You want to make it that a player can automatically be able to use gmc and gms commands when they create the world instead of making a skript that allows players to do that?

Permissions plugin such as PEX and LuckPerms have features where you can give a player a specifc permission in a specific world. So when their world is created, you can run this command. PEX: "/pex user %player% set essentials.gamemode.creative true %player%". I'm not 100% sure this is the right command since I don't use pex but you can try. And for LuckPerms, think the command is "/lp user %player% permission set essentials.gamemode.creative true %player%". And then the same for the survival perm node. The %player% at the end of each command specifies which world you want the player to have the permission, and if the world is going to have the same name as their ign, %player% should be used.

If that's not what you mean, then what did you mean?

Discord - tarna256

In-game name - _Tarna_

Website - https://tarna.dev
Paste Site: https://paste.tarna.dev

---------------------------------------------------------

[VIP] - 7/27/2020

Support - 7/8/20 | 11/3/20

Helper  - 11/3/20 - 2/21/21

Moderator - 2/21/21 - 5/17/21

❤️ - 5/17/21 - now

Moderator - 12/20/22 - now

---------------------------------------------------------

image.png.70849a9b84e0347ce107b8e3eaee312c.pngimage.png.2111009afbd8bef10966ba9ede35a199.png

Link to comment
Share on other sites

13 minutes ago, _Tarna_ said:

What do you mean by that? You want to make it that a player can automatically be able to use gmc and gms commands when they create the world instead of making a skript that allows players to do that?

Permissions plugin such as PEX and LuckPerms have features where you can give a player a specifc permission in a specific world. So when their world is created, you can run this command. PEX: "/pex user %player% set essentials.gamemode.creative true %player%". I'm not 100% sure this is the right command since I don't use pex but you can try. And for LuckPerms, think the command is "/lp user %player% permission set essentials.gamemode.creative true %player%". And then the same for the survival perm node. The %player% at the end of each command specifies which world you want the player to have the permission, and if the world is going to have the same name as their ign, %player% should be used.

If that's not what you mean, then what did you mean?

Thanks for the response! 

I'm more talking as if the skript (that was shown above) could be used, its just that every time someone creates a world the same skript gets duplicated, except the player/world name changes to the individual creating the world, so the person that made the world can go ahead and use /gmc (but no other player can).

Hopefully this makes sense. If it doesn't, be sure to let me know.

Edited by gxtlucky
Link to comment
Share on other sites

4 hours ago, gxtlucky said:

Thanks for the response! 

I'm more talking as if the skript (that was shown above) could be used, its just that every time someone creates a world the same skript gets duplicated, except the player/world name changes to the individual creating the world, so the person that made the world can go ahead and use /gmc (but no other player can).

Hopefully this makes sense. If it doesn't, be sure to let me know.

Oh so you were creating the same skript everytime someone creates world? In your skript, just change (Player IGN) to %player% and it should work in all worlds. It checks if the player is in a world with the same name as their ign. And instead of executing a console command, you can do set player's gamemode to creative and set player's gamemode to survival.

Another thing is that if a player changes their name, they would lose their world since the name of the world is their IGN.

Edited by _Tarna_

Discord - tarna256

In-game name - _Tarna_

Website - https://tarna.dev
Paste Site: https://paste.tarna.dev

---------------------------------------------------------

[VIP] - 7/27/2020

Support - 7/8/20 | 11/3/20

Helper  - 11/3/20 - 2/21/21

Moderator - 2/21/21 - 5/17/21

❤️ - 5/17/21 - now

Moderator - 12/20/22 - now

---------------------------------------------------------

image.png.70849a9b84e0347ce107b8e3eaee312c.pngimage.png.2111009afbd8bef10966ba9ede35a199.png

Link to comment
Share on other sites

10 hours ago, _Tarna_ said:

Oh so you were creating the same skript everytime someone creates world? In your skript, just change (Player IGN) to %player% and it should work in all worlds. It checks if the player is in a world with the same name as their ign. And instead of executing a console command, you can do set player's gamemode to creative and set player's gamemode to survival.

Another thing is that if a player changes their name, they would lose their world since the name of the world is their IGN.

Yup! But one more thing, wouldn’t having the player IGN being set to %player% affect everyone in the world? I need it so that it only affects the person that made the world. And thanks for the help.

Link to comment
Share on other sites

2 minutes ago, gxtlucky said:

Yup! But one more thing, wouldn’t having the player IGN being set to %player% affect everyone in the world? I need it so that it only affects the person that made the world. And thanks for the help.

This tests if the name of the world the player is in has the same name as their ign. If so, it sets their gamemode to creative. If not, it sends the else message. You can do the same thing for gms. Try something like this and see if it works. 

on command "/gmc":
	if player's world is "%player%":
		set player's gamemode to creative
	else:
		send "You can only do this command while in your world"

 

Discord - tarna256

In-game name - _Tarna_

Website - https://tarna.dev
Paste Site: https://paste.tarna.dev

---------------------------------------------------------

[VIP] - 7/27/2020

Support - 7/8/20 | 11/3/20

Helper  - 11/3/20 - 2/21/21

Moderator - 2/21/21 - 5/17/21

❤️ - 5/17/21 - now

Moderator - 12/20/22 - now

---------------------------------------------------------

image.png.70849a9b84e0347ce107b8e3eaee312c.pngimage.png.2111009afbd8bef10966ba9ede35a199.png

Link to comment
Share on other sites

20 hours ago, _Tarna_ said:

This tests if the name of the world the player is in has the same name as their ign. If so, it sets their gamemode to creative. If not, it sends the else message. You can do the same thing for gms. Try something like this and see if it works. 


on command "/gmc":
	if player's world is "%player%":
		set player's gamemode to creative
	else:
		send "You can only do this command while in your world"

 

Yay it works! Thank you so much.

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