Solved Claimdoor

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

Maezukie

Member
May 21, 2018
15
0
1
how can I make it so that on a command you can claim a door so no one but the claimer can open it but if the claimer logs out the claimers door gets unclaimed?
 
you could write a command to set a variable to true.
Then if a player right clicks on a door, and the variable is true it would create a variable for the location of the door.

Then use a click event for the door, checking whether or not there is a variable set at that location, and if the owner of the door is said player, if not, cancel the event, send a message.

Then use the quit event to remove the variable
 
Im so lost
code_language.skript:
command /CD:
    aliases: claimdoor
    trigger:
        if target block is any door:
            if {%target-block%} is not set:
                set {%target-block%} to "%player%"
                send "&ayou claimed the door"
            else:
                send "&cdoor already claimed"
        else:
            send "&cNot a door"

on rightclick on any door:
    if {%target-block%} is set:
        if {%target-block%} is not "%player%":
            cancel event
            send "&cthis is not your door"
        else:
            uncancel event

on disconnect:
    loop all doors:
        if {%loop-value%} is %player%:
            delete {%loop-value%}
 
i would change your variable:
code_language.skript:
from {%target-block%} to {lockeddoors::%target-block%}
then in your disconnect event do this
code_language.skript:
on disconnect:
    loop {lockeddoors::*}:
        if loop-value is player:
            delete {lockeddoors::%loop-index%}
 
code_language.skript:
command /CD:
    aliases: claimdoor
    trigger:
        if target block is any door:
            if {lockeddoors::%target block%} is not set:
                set {lockeddoors::%target block%} to "%player%"
                send "&8[&aClaimdoor&8] &ayou claimed the door"
            else:
                send "&8[&aClaimdoor&8] &cdoor already claimed"
        else:
            send "&8[&aClaimdoor&8] &cNot a door"

on rightclick on any door:
    if {lockeddoors::%target block%} is set:
        if {lockeddoors::%target block%} is not "%player%":
            cancel event
            send "&8[&aClaimdoor&8] &cthis is not your door"
        else:
            uncancel event

on disconnect:
    loop {lockeddoors::*}:
        if loop-value is player:
            delete {lockeddoors::%loop-index%}

on load:
    broadcast "&8[&aClaimdoor&8] &fReloaded"
this works but people can claim multiple doors
 
then add in a variable and if statement like this
code_language.skript:
if {lockeddoors::%player%} is not set:
    set {lockeddoors::%player%} to true
else:
    send "You can only claim 1 door" to player
    stop


and when they logout add
code_language.skript:
delete {lockeddoors::%player%}
 
Status
Not open for further replies.