Solved Use a rightclick command to execute a command.

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

SheewSpielt

Member
Jun 5, 2017
39
1
0
Hello SkUnity Community,

I'd like to do that when I right-click on a compass, this one command, but somehow he does not. Could you help me somehow? My code is:


code_language.skript:
on rightclick on {@Item}:
    name of player's tool is "{@ItemName}":
        execute command "{@ItemCommand}"
code_language.skript:
    ItemName: &7» ●&6 Teleporter&7 «
    Item: compass
    ItemCommand: /warp

Please help me, oh and excuse for my english, I come from Germany.
 
I think you mean clicking when you have it in your hand yes?
if so then you'd need to make that
code_language.skript:
on rightclick with {@Item}:
if you mean clicking on it in your inventory, then you'd need to use this event instead
code_language.skript:
on inventory click:
(skquery)
 
That does not work out anyhow, now it looks exactly the same
code_language.skript:
on rightclick with {@Item}:
    name of player's tool is "{@ItemName}":
        execute command "{@ItemCommand}"
 
I do not get any error, I also get no message that this Command does not exist, since only that is loaded successfully.
The issue is your command then. Using your exact code there it lists my warps in console. if you want the player to execute it you have to use "make player execute command". testing that on my server also worked fine for me
 
Yeah, wait
[doublepost=1501280531,1501280469][/doublepost]
code_language.skript:
options:
    GUIName: &8┃&6 Warp&8 ┃&5 XentraCraft &8┃
    WarpNachricht: &8┃&6 Warp&8 »&7 Du hast dich erfolgreich zum&c Warppunkt&6 %arg 1%&a teleportiert&7.
    Permission: &8┃&4 Permission&8 »&7 Du hast keine Rechte auf diesen Befehl.
    SetWarp: &8┃&6 Warp&8 »&7 Du hast den Warp&a %arg 1%&7 gesetzt.
    Usage: &8┃&6 Warp&8 »&7 Du musst&c /setwarp&a <WarpName>&7 benutzen.
    SetSpawn: &8┃&e Setspawn&8 »&7 Du hast den&e Spawnpunkt&7 erfolgreich gesetzt.
    Spawn: &8┃&e Spawn&8 »&7 Du hast dich zum &eSpawn&7 teleportiert.
    
    SpawnName: &8●&9 Warp&8 ×&6 Spawn&8
    SpawnItem: magma cream
    SpawnLore: &8»&7 Teleportiere dich zum&5 Spawn&7.
    SpawnSlot: 22
    SpawnCommand: /Spawn
    
    FreeBuildName: &8●&9 Warp&8 ×&6 FreeBuild&8
    FreeBuildItem: grass block
    FreeBuildLore: &8»&7 Teleportiere dich zum&5 FreeBuild&7
    FreeBuildSlot: 4
    FreeBuildCommand: /EWarp FreeBuild
    
    TeamHalleName: &8●&9 Warp&8 ×&6 Teamhalle&8
    TeamHalleLore: &8»&7 Teleportiere dich zur&5 Teamhalle&7
    TeamHalleSlot: 18
    TeamHalleCommand: /EWarp Teamhalle
    
    MineName: &8●&9 Warp&8 ×&6 Mine&8
    MineItem: stone
    MineLore: &8»&7 Teleportiere dich zur&5 Mine&7
    MineSlot: 20
    MineCommand: /Ewarp Mine
    
    NetherName: &8●&9 Warp&8 ×&6 Nether&8
    NetherItem: netherrack
    NetherLore: &8»&7 Teleportiere dich zum&5 Nether&7
    NetherSlot: 24
    NetherCommand: /Ewarp Nether   
    
    FarmweltName: &8●&9 Warp&8 ×&6 Farmwelt&8
    FarmweltItem: diamond pickaxe
    FarmweltLore: &8»&7 Teleportiere dich zur&5 Farmwelt&7
    FarmweltSlot: 26
    FarmweltCommand: /EWarp Farmwelt   
    
    EndName: &8●&9 Warp&8 ×&6 End&8
    EndItem: end stone
    EndLore: &8»&7 Teleportiere dich zum&5 End&7
    EndSlot: 40
    EndCommand: /Ewarp End
    
    Platzhalter1: gray glass pane named "&0" to close
    Platzhalter2: light gray glass pane named "&7" to close
    Platzhalter3: white glass pane named "&f" to close
    
command /Warp:
    trigger:
        set {_p} to "%player%" parsed as player
        open chest with 5 rows named "{@GUIName}" to player
        format slot 0 of player with {@Platzhalter1}
        format slot 1 of player with {@Platzhalter1}
        format slot 2 of player with {@Platzhalter2}
        format slot 3 of player with {@Platzhalter2}
        play "CLICK" to player at volume 0.2
        wait 2 ticks
        format slot {@FreeBuildSlot} of player with {@FreeBuildItem} named "{@FreeBuildName}" with lore "{@FreeBuildLore}" to close then run [make player execute command "{@FreeBuildCommand}"]
        format slot 5 of player with {@Platzhalter2}
        format Slot 6 of player with {@Platzhalter2}   
        format slot 7 of player with {@Platzhalter1}
        format slot 8 of player with {@Platzhalter1}
        format slot 9 of player with {@Platzhalter1}
        format slot 10 of player with {@Platzhalter2}
        format slot 11 of player with {@Platzhalter2}   
        format slot 12 of player with {@Platzhalter2}
        format slot 13 of player with {@Platzhalter3}
        format slot 14 of player with {@Platzhalter2}
        format slot 15 of player with {@Platzhalter2}   
        format slot 16 of player with {@Platzhalter2}   
        format slot 17 of player with {@Platzhalter1}
        play "CLICK" to player at volume 0.2
        wait 2 ticks
        format slot {@TeamHalleSlot} of player with skull of {_p} named "{@TeamHalleName}" with lore "{@TeamHalleLore}" to close then run [make player execute command "{@TeamHalleCommand}"]
        format slot 19 of player with {@Platzhalter2}
        play "CLICK" to player at volume 0.2
        wait 2 ticks
        format slot {@MineSlot} of player with {@MineItem} named "{@MineName}" with lore "{@MineLore}" to close then run [make player execute command "{@MineCommand}"]
        format slot 21 of player with {@Platzhalter3}
        play "CLICK" to player at volume 0.2
        wait 2 ticks
        format slot {@SpawnSlot} of player with {@SpawnItem} named "{@SpawnName}" with lore "{@SpawnLore}" to close then run [make player execute command "{@SpawnCommand}"]
        format slot 23 of player with {@Platzhalter3}
        play "CLICK" to player at volume 0.2
        wait 2 ticks
        format slot {@NetherSlot} of player with {@NetherItem} named "{@NetherName}" with lore "{@NetherLore}" to close then run [make player execute command "{@NetherCommand}"]
        format slot 25 of player with {@Platzhalter2}
        play "CLICK" to player at volume 0.2
        wait 2 ticks
        format slot {@FarmweltSlot} of player with {@FarmweltItem} named "{@FarmweltName}" with lore "{@FarmweltLore}" to close then run [make player execute command "{@FarmweltCommand}"]
        format slot 27 of player with {@Platzhalter1}
        format slot 28 of player with {@Platzhalter2}
        format slot 29 of player with {@Platzhalter2}
        format slot 30 of player with {@Platzhalter2}
        format slot 31 of player with {@Platzhalter3}
        format slot 32 of player with {@Platzhalter2}
        format slot 33 of player with {@Platzhalter2}
        format slot 34 of player with {@Platzhalter2}   
        format slot 35 of player with {@Platzhalter1}
        format slot 36 of player with {@Platzhalter1}
        format slot 37 of player with {@Platzhalter1}
        format slot 38 of player with {@Platzhalter2}
        format slot 39 of player with {@Platzhalter2}
        play "CLICK" to player at volume 0.2
        wait 2 ticks
        format slot {@EndSlot} of player with {@EndItem} named "{@EndName}" with lore "{@EndLore}" to close then run [make player execute command "{@EndCommand}"]
        format slot 41 of player with {@Platzhalter2}
        format slot 42 of player with {@Platzhalter2}
        format slot 43 of player with {@Platzhalter1}
        format slot 44 of player with {@Platzhalter1}
As I said, I come from Germany, and therefore the code is synonymous or the news in German.
 
Yeah, wait
[doublepost=1501280531,1501280469][/doublepost]
code_language.skript:
options:
    GUIName: &8┃&6 Warp&8 ┃&5 XentraCraft &8┃
    WarpNachricht: &8┃&6 Warp&8 »&7 Du hast dich erfolgreich zum&c Warppunkt&6 %arg 1%&a teleportiert&7.
    Permission: &8┃&4 Permission&8 »&7 Du hast keine Rechte auf diesen Befehl.
    SetWarp: &8┃&6 Warp&8 »&7 Du hast den Warp&a %arg 1%&7 gesetzt.
    Usage: &8┃&6 Warp&8 »&7 Du musst&c /setwarp&a <WarpName>&7 benutzen.
    SetSpawn: &8┃&e Setspawn&8 »&7 Du hast den&e Spawnpunkt&7 erfolgreich gesetzt.
    Spawn: &8┃&e Spawn&8 »&7 Du hast dich zum &eSpawn&7 teleportiert.
   
    SpawnName: &8●&9 Warp&8 ×&6 Spawn&8
    SpawnItem: magma cream
    SpawnLore: &8»&7 Teleportiere dich zum&5 Spawn&7.
    SpawnSlot: 22
    SpawnCommand: /Spawn
   
    FreeBuildName: &8●&9 Warp&8 ×&6 FreeBuild&8
    FreeBuildItem: grass block
    FreeBuildLore: &8»&7 Teleportiere dich zum&5 FreeBuild&7
    FreeBuildSlot: 4
    FreeBuildCommand: /EWarp FreeBuild
   
    TeamHalleName: &8●&9 Warp&8 ×&6 Teamhalle&8
    TeamHalleLore: &8»&7 Teleportiere dich zur&5 Teamhalle&7
    TeamHalleSlot: 18
    TeamHalleCommand: /EWarp Teamhalle
   
    MineName: &8●&9 Warp&8 ×&6 Mine&8
    MineItem: stone
    MineLore: &8»&7 Teleportiere dich zur&5 Mine&7
    MineSlot: 20
    MineCommand: /Ewarp Mine
   
    NetherName: &8●&9 Warp&8 ×&6 Nether&8
    NetherItem: netherrack
    NetherLore: &8»&7 Teleportiere dich zum&5 Nether&7
    NetherSlot: 24
    NetherCommand: /Ewarp Nether  
   
    FarmweltName: &8●&9 Warp&8 ×&6 Farmwelt&8
    FarmweltItem: diamond pickaxe
    FarmweltLore: &8»&7 Teleportiere dich zur&5 Farmwelt&7
    FarmweltSlot: 26
    FarmweltCommand: /EWarp Farmwelt  
   
    EndName: &8●&9 Warp&8 ×&6 End&8
    EndItem: end stone
    EndLore: &8»&7 Teleportiere dich zum&5 End&7
    EndSlot: 40
    EndCommand: /Ewarp End
   
    Platzhalter1: gray glass pane named "&0" to close
    Platzhalter2: light gray glass pane named "&7" to close
    Platzhalter3: white glass pane named "&f" to close
   
command /Warp:
    trigger:
        set {_p} to "%player%" parsed as player
        open chest with 5 rows named "{@GUIName}" to player
        format slot 0 of player with {@Platzhalter1}
        format slot 1 of player with {@Platzhalter1}
        format slot 2 of player with {@Platzhalter2}
        format slot 3 of player with {@Platzhalter2}
        play "CLICK" to player at volume 0.2
        wait 2 ticks
        format slot {@FreeBuildSlot} of player with {@FreeBuildItem} named "{@FreeBuildName}" with lore "{@FreeBuildLore}" to close then run [make player execute command "{@FreeBuildCommand}"]
        format slot 5 of player with {@Platzhalter2}
        format Slot 6 of player with {@Platzhalter2}  
        format slot 7 of player with {@Platzhalter1}
        format slot 8 of player with {@Platzhalter1}
        format slot 9 of player with {@Platzhalter1}
        format slot 10 of player with {@Platzhalter2}
        format slot 11 of player with {@Platzhalter2}  
        format slot 12 of player with {@Platzhalter2}
        format slot 13 of player with {@Platzhalter3}
        format slot 14 of player with {@Platzhalter2}
        format slot 15 of player with {@Platzhalter2}  
        format slot 16 of player with {@Platzhalter2}  
        format slot 17 of player with {@Platzhalter1}
        play "CLICK" to player at volume 0.2
        wait 2 ticks
        format slot {@TeamHalleSlot} of player with skull of {_p} named "{@TeamHalleName}" with lore "{@TeamHalleLore}" to close then run [make player execute command "{@TeamHalleCommand}"]
        format slot 19 of player with {@Platzhalter2}
        play "CLICK" to player at volume 0.2
        wait 2 ticks
        format slot {@MineSlot} of player with {@MineItem} named "{@MineName}" with lore "{@MineLore}" to close then run [make player execute command "{@MineCommand}"]
        format slot 21 of player with {@Platzhalter3}
        play "CLICK" to player at volume 0.2
        wait 2 ticks
        format slot {@SpawnSlot} of player with {@SpawnItem} named "{@SpawnName}" with lore "{@SpawnLore}" to close then run [make player execute command "{@SpawnCommand}"]
        format slot 23 of player with {@Platzhalter3}
        play "CLICK" to player at volume 0.2
        wait 2 ticks
        format slot {@NetherSlot} of player with {@NetherItem} named "{@NetherName}" with lore "{@NetherLore}" to close then run [make player execute command "{@NetherCommand}"]
        format slot 25 of player with {@Platzhalter2}
        play "CLICK" to player at volume 0.2
        wait 2 ticks
        format slot {@FarmweltSlot} of player with {@FarmweltItem} named "{@FarmweltName}" with lore "{@FarmweltLore}" to close then run [make player execute command "{@FarmweltCommand}"]
        format slot 27 of player with {@Platzhalter1}
        format slot 28 of player with {@Platzhalter2}
        format slot 29 of player with {@Platzhalter2}
        format slot 30 of player with {@Platzhalter2}
        format slot 31 of player with {@Platzhalter3}
        format slot 32 of player with {@Platzhalter2}
        format slot 33 of player with {@Platzhalter2}
        format slot 34 of player with {@Platzhalter2}  
        format slot 35 of player with {@Platzhalter1}
        format slot 36 of player with {@Platzhalter1}
        format slot 37 of player with {@Platzhalter1}
        format slot 38 of player with {@Platzhalter2}
        format slot 39 of player with {@Platzhalter2}
        play "CLICK" to player at volume 0.2
        wait 2 ticks
        format slot {@EndSlot} of player with {@EndItem} named "{@EndName}" with lore "{@EndLore}" to close then run [make player execute command "{@EndCommand}"]
        format slot 41 of player with {@Platzhalter2}
        format slot 42 of player with {@Platzhalter2}
        format slot 43 of player with {@Platzhalter1}
        format slot 44 of player with {@Platzhalter1}
As I said, I come from Germany, and therefore the code is synonymous or the news in German.
Oky so your code works perfectly for me. Screenshot:
2ded7f29b6.png

Therefore I'd venture to say the problem is a glitch from "format slot" which happens a lot. I would reccomend getting the addon TuSKe and changing to that gui format instead, it is much less buggy
[doublepost=1501281228][/doublepost]Just to give a bit more info, what you would need to change is 1: your open chest line, and 2: the format lines. just so:
code_language.skript:
open virtual chest inventory named "namehere" to player
format gui slot 0 of player with itemhere named "namehere" to close then run player command "/commandhere"
 
Status
Not open for further replies.