Houses plugin with Skript

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

    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!

Status
Not open for further replies.

Suso Thorne

New Member
Jun 10, 2018
8
0
0
34
Hi, I'm trying to make a Houses plugin with Skript.

Basically, if I right click a door that is inside a region with no owners, the script will make the player execute the command "/buyhouse".

If I right click the door and I am the owner/member of the region where the door is located, the door is going to open.

If I right click the door and I am not the owner/member of the region where the door is located, the script is going to type to the player "&cYou are not the owner of the region"

I have tried a lot of things but I don't know the material type of the doors (I want to make Spruce, Oak, Birch and Jungle as doors)

And I don't know how to do the rest, I have searched this links:

http://en.njol.ch/projects/skript/doc/events#click
http://en.njol.ch/projects/skript/doc/expressions#ExprRegionsAt
http://en.njol.ch/projects/skript/doc/conditions#CondIsMember

But I don't know how to create the script.

Could someone help me or give me examples?
 
hm.. And what kind of region plugin do you use? WorldGuard, WorldEdit...
Try this:

code_language.skript:
on rightclick on Spruce Door, Oak Door, Birch Door or Jungle Door:
    set {_regions::*} to regions at the clicked block
    if {_regions::*} is empty:
        #message "&4No region exist here!"
        stop
    else:
        #message "&eYou are trying to enter the region &6%{_regions::*}%&e whose owner is &6%owner of {_regions::*}%&e."
        if owner of {_regions::*} is not set:
            execute player command "/buyhouse"
            message "&aYou bought new house!"
        else if owner of {_regions::*} is player:
            message "&aWelcome in your house!"
        else if owner of {_regions::*} is not player:
            message "&4This is not your house!"
            cancel event
Maybe it wont work because I never before working with regions and things like that :emoji_grinning:.. but try
 
I'm using World Guard
[doublepost=1528647238,1528646857][/doublepost]Okay so I have a question, if I am the owner and I right click the door, I don't want any message.
If I am a member, no message too.

But if the region doesn't have an owner, I don't want the user to open the door.
If the region has an owner, I don't want the user to open the door to.

I just want the user to open the door if he is the owner of the region or if he is a member of the region.
[doublepost=1528647330][/doublepost]Also, I just want this to happen if the region where this is happening is named "house1"
So I could copy and paste the script and rename the regions with the new ones in the future.
 
code_language.skript:
on rightclick on Spruce Door, Oak Door, Birch Door or Jungle Door:
    if "%region at clicked block%" is "house1":
        if owner of region at clicked block is not set:
            execute player command "/buyhouse"
            cancel event
        else if owner of region at clicked block is not player:
            message "&4This is not your house!"
            cancel event
        else if members of region at clicked block is not player:
            message "&4This is not your house!"
            cancel event
[doublepost=1528649064,1528648612][/doublepost]and.. Did I understand? Do you want to make same skripts for each "houses"?
You shouldnt do it!... I you can do it simly with one script.. it would be uselessly

Tell me more about you project and i can help you.. Because if you will adding regions named like "house1,2,3,999" just simply replace:
code_language.skript:
if "%region at clicked block%" is "house1":
with:
code_language.skript:
if "%region at clicked block%" contains "house":
And you can keep adding regions named "house1", "house2"..... and it will be working without making tens of same skrips...
 
Okay I am doing this with the Help of the plugin Hydra and this Script, basically with Hydra, I created a GUI that is opened with the command "bh1"

So my script for the house 1 is:


code_language.skript:
on rightclick on Spruce Door, Oak Door, Birch Door or Jungle Door:
    if "%region at clicked block%" is "house1":
        if owner of region at clicked block is not set:
            execute player command "/bh1"
            cancel event
        else if owner of region at clicked block is not player:
            message "&4This is not your house!"
            cancel event
        else if members of region at clicked block is not player:
            message "&4This is not your house!"
            cancel event
 
oh.. ok..
1. you can do GUI using skript too and make it very custom.
2. OK, but its same code as i sent you.. so what is your problem? what not working?
 
Welp, I defined a new region called "house1"

But when I right click the door (right now the region doesn't have any owner) nothing happens, I am able to open the door as all the players.
 
hmm.. I cant help you from here.. can you send me IP of your server? because i need to test conditions,....
 
oh.. ok.. but i would test whether it brotcasting in every condition + maybe its caused by owner.. because "not set" = "<none>".. and maybe owner is "no owner" or idk.. so i would try that...
 
Status
Not open for further replies.