Solved Check if a player is in anvil gui

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

Status
Not open for further replies.

KroterPvP

Active Member
Apr 10, 2017
178
7
18
I have done this to check if a player rightclicks an anvil:
Code (Text):
code_language.skript:
on right click on a anvil:
    if player has 175:
        send "&7You can't rename coins!"
        cancel event
        stop
I want to check if item 175 contains a part of the lore
And I want to check if a player is inside the anvil gui too.
 
Last edited:
I have done this to check if a player rightclicks an anvil:
Code (Text):
code_language.skript:
on right click on a anvil:
    if player has 175:
        send "&7You can't rename coins!"
        cancel event
        stop
I want to check if item 175 contains a part of the lore
And I want to check if a player is inside the anvil gui too.
http://skunity.com/search?search=anvil


Just use On Anvil prepare event, check if this item, then cancel
 
ChisleLP, this cancels the place of the item inside the anvil, or just cancel the right click when with the item on hand?
 
ChisleLP, this cancels the place of the item inside the anvil, or just cancel the right click when with the item on hand?
I want to cancel using anvil (rightclicking it) only if the player has item 175 with part of a lore. And I need to check if player is in gui because they can drop and fastly recatch the item when in the gui.
 
ChisleLP, this cancels the place of the item inside the anvil, or just cancel the right click when with the item on hand?
it cancel if you take the ... Output item...

I want to cancel using anvil (rightclicking it) only if the player has item 175 with part of a lore. And I need to check if player is in gui because they can drop and fastly recatch the item when in the gui.

well then try maybe like this

code_language.skript:
on rightclick on anvil:
    if player has 175:
        send "Nope"
        cancel event
        close player's inventory
 
it cancel if you take the ... Output item...



well then try maybe like this

code_language.skript:
on rightclick on anvil:
    if player has 175:
        send "Nope"
        cancel event
        close player's inventory
But the player can drop the item, click the anvil and whait for the dropped item to recatch it. I need to check if the player is in the anvil gui or somethink like this.
 
But the player can drop the item, click the anvil and whait for the dropped item to recatch it. I need to check if the player is in the anvil gui or somethink like this.


... I have tested around it. with debugs. is just take me 5minutes to find out the name of anvil

code_language.skript:
on inventory click:
    set {_t} to inventory name of player's current inventory
    broadcast "%{_t}%"
    broadcast "%event-inventory%"

So... the Name of inventory is "Repair" you need just check on inventory click or some things. what you wan't. I found only out. that name of GUi is "Repair"
 
ChisleLP, this cancels the place of the item inside the anvil, or just cancel the right click when with the item on hand?
This only cancels the right click when with the item on inventory
[doublepost=1493736021,1493735156][/doublepost]
... I have tested around it. with debugs. is just take me 5minutes to find out the name of anvil

code_language.skript:
on inventory click:
    set {_t} to inventory name of player's current inventory
    broadcast "%{_t}%"
    broadcast "%event-inventory%"

So... the Name of inventory is "Repair" you need just check on inventory click or some things. what you wan't. I found only out. that name of GUi is "Repair"
[doublepost=1493736070][/doublepost]
... I have tested around it. with debugs. is just take me 5minutes to find out the name of anvil

code_language.skript:
on inventory click:
    set {_t} to inventory name of player's current inventory
    broadcast "%{_t}%"
    broadcast "%event-inventory%"

So... the Name of inventory is "Repair" you need just check on inventory click or some things. what you wan't. I found only out. that name of GUi is "Repair"
I've done this, and it should work. What do you think about this part of code? Is going to make lagg if there are more than 20 players online?
code_language.skript:
on right click on anvil:
    if player has 175:
        if lore of event-item contains "phisical":
            player has permission "seco.renamecoins":
                stop
            else if player doesn't have permission "seco.renamecoins":
                set {_anvil.%player%} to inventory name of player's current inventory
every 1.5 seconds:
    if {_anvil.%player%} = "Repair":
        send "&7You can't use anvil with coins in your inventory!"
        set {_anvil.%player%} to "No-Repair"
        cancel event
        close player's inventory
 
This only cancels the right click when with the item on inventory
[doublepost=1493736021,1493735156][/doublepost]
[doublepost=1493736070][/doublepost]
I've done this, and it should work. What do you think about this part of code? Is going to make lagg if there are more than 20 players online?
code_language.skript:
on right click on anvil:
    if player has 175:
        if lore of event-item contains "phisical":
            player has permission "seco.renamecoins":
                stop
            else if player doesn't have permission "seco.renamecoins":
                set {_anvil.%player%} to inventory name of player's current inventory
every 1.5 seconds:
    if {_anvil.%player%} = "Repair":
        send "&7You can't use anvil with coins in your inventory!"
        set {_anvil.%player%} to "No-Repair"
        cancel event
        close player's inventory
Uhmmm youre using Local variabels. this will not works. but just do somelike this:
code_language.skript:
on right click on anvil:
    if player has 175:
        if lore of event-item contains "phisical":
            player has permission "seco.renamecoins":
                stop
            else if player doesn't have permission "seco.renamecoins":
                send "&7You can't use anvil with coins in your inventory"
                cancel event
                close player's inventory
 
Uhmmm youre using Local variabels. this will not works. but just do somelike this:
code_language.skript:
on right click on anvil:
    if player has 175:
        if lore of event-item contains "phisical":
            player has permission "seco.renamecoins":
                stop
            else if player doesn't have permission "seco.renamecoins":
                send "&7You can't use anvil with coins in your inventory"
                cancel event
                close player's inventory
As I said, this isn't doing good work, because the player can drop the item, rightclick the anvil and catch it again while inside the anvil gui.

What do you mean that it's not going to work because I use local variables?
 
As I said, this isn't doing good work, because the player can drop the item, rightclick the anvil and catch it again while inside the anvil gui.

What do you mean that it's not going to work because I use local variables?
Then just doing this way:


code_language.skript:
on right click on anvil:
    if player has 175:
        if lore of event-item contains "phisical":
            player has permission "seco.renamecoins":
                stop
            else if player doesn't have permission "seco.renamecoins":
                send "&7You can't use anvil with coins in your inventory"
                cancel event
                close player's inventory
    else:
        while inventory name of player's current inventory is "Repair":
            if player has 175:
                send "Sorry, you got the coins, that not allowed to use Anvil."
                close player's inventory
            wait 10 ticks


Please.... Look around documentions, try to get any Ideas... maybe other Methode... Like ever other skripter doings.
 
Then just doing this way:


code_language.skript:
on right click on anvil:
    if player has 175:
        if lore of event-item contains "phisical":
            player has permission "seco.renamecoins":
                stop
            else if player doesn't have permission "seco.renamecoins":
                send "&7You can't use anvil with coins in your inventory"
                cancel event
                close player's inventory
    else:
        while inventory name of player's current inventory is "Repair":
            if player has 175:
                send "Sorry, you got the coins, that not allowed to use Anvil."
                close player's inventory
            wait 10 ticks


Please.... Look around documentions, try to get any Ideas... maybe other Methode... Like ever other skripter doings.
[18:25:19 ERROR]: Can't compare 'inventory name of player's corrent inventory' with a text (file.sk, line 225: while inventory name of player's corrent inventory is "Repair":')
[doublepost=1493742396,1493742356][/doublepost]*Current not "corrent"
 
well. then why you posting it? ... >-< some skripter can be overwritet....
 
well. then why you posting it? ... >-< some skripter can be overwritet....
I know, sorry :emoji_frowning:
This isn't running, can you help me please?
code_language.skript:
if lore of event-item contains "phisical":
[doublepost=1493745844,1493742815][/doublepost]I've fixed this!
Using TuSk for expresion "on anvil rename"
Code:
code_language.skript:
on anvil rename:
    if player has 175:
        if lore of event-item contains "phisical":
            player has permission "seco.renamecoins":
                stop
            else:
                send "&7You can't rename coins!"
                cancel event
                close player's inventory
[doublepost=1493745892][/doublepost]Thanks for your help!
 
Status
Not open for further replies.