Rightclicking heads and removing heads

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

JustADev

Well-Known Member
Apr 8, 2017
379
9
18
How do I make this work?

CODE:

code_language.skript:
on rightclick on a head:
    remove 1 of player's tool from player
 
potentially like this maybe:
code_language.skript:
on right click with skull:
    remove 1 skull from player
 
it says cant understand
[doublepost=1501365990,1501365935][/doublepost]
code_language.skript:
on death:
    attacker is a player
    set {_head} to "MHF_%victim%" parsed as an offline player
    drop {_head}'s skull named "&c%victim%'s Head &7(Right Click)" at victim's location
    
on rightclick on a sign:
    line 1 of the clicked block is "&4[Heads]":
    set {_name} to name of player's tool
    if {_name} contains "&cHead":
        remove 1 skull from player
        play "BURP" to player at volume 1.0
        message "&cChaoticMC &8&l» &7You have sold &c%{_name}%'s Head &7for &b5 XP"
        make console execute command "/addheadxp %player% 5"
        stop
    else:
        message "&cChaoticMC &8&l» &7You must be holding a head to use the sign"
        stop
        
on right click with skull:
    remove 1 skull from player
    play "BURP" to player at volume 1.0
    message "&cChaoticMC &8&l» &7You have sold &c%{_name}%'s Head &7for &b5 XP"
    make console execute command "/addheadxp %player% 5"
    
        
on sign change:
    line 1 is "[Heads]"
    set line 1 to "&4[Heads]"
    set line 2 to "&aRight click to"
    set line 3 to "&asell your"
    set line 4 to "&aHeads"
[doublepost=1501366036][/doublepost]Also, the skulls show steve heads
[doublepost=1501366767][/doublepost]SO yeah idk
 
it says cant understand
[doublepost=1501365990,1501365935][/doublepost]
code_language.skript:
on death:
    attacker is a player
    set {_head} to "MHF_%victim%" parsed as an offline player
    drop {_head}'s skull named "&c%victim%'s Head &7(Right Click)" at victim's location
 
on rightclick on a sign:
    line 1 of the clicked block is "&4[Heads]":
    set {_name} to name of player's tool
    if {_name} contains "&cHead":
        remove 1 skull from player
        play "BURP" to player at volume 1.0
        message "&cChaoticMC &8&l» &7You have sold &c%{_name}%'s Head &7for &b5 XP"
        make console execute command "/addheadxp %player% 5"
        stop
    else:
        message "&cChaoticMC &8&l» &7You must be holding a head to use the sign"
        stop
    
on right click with skull:
    remove 1 skull from player
    play "BURP" to player at volume 1.0
    message "&cChaoticMC &8&l» &7You have sold &c%{_name}%'s Head &7for &b5 XP"
    make console execute command "/addheadxp %player% 5"
 
    
on sign change:
    line 1 is "[Heads]"
    set line 1 to "&4[Heads]"
    set line 2 to "&aRight click to"
    set line 3 to "&asell your"
    set line 4 to "&aHeads"
[doublepost=1501366036][/doublepost]Also, the skulls show steve heads
mhm not 100% sure atm either, but testing to see if I can make it work
[doublepost=1501368464][/doublepost]Here you go^-^ got it working perfectly *Well, all except for the name sell message, but it drops a skinned head and sells on right click for me:emoji_slight_smile:
code_language.skript:
on death:
    attacker is a player
    set {_head} to ("%victim%" parsed as offline player)'s skull
    drop {_head} named "&c%victim%'s Head &7(Right Click)" at victim's location
 
on rightclick on a sign:
    line 1 of the clicked block is "&4[Heads]"
    set {_name} to name of player's tool
    if {_name} contains "&cHead":
        remove player head from player
        message "&cChaoticMC &8&l» &7You have sold &c%{_name}%'s Head &7for &b5 XP"
        make console execute command "/addheadxp %player% 5"
        stop
    else:
        message "&cChaoticMC &8&l» &7You must be holding a head to use the sign"
        stop
    
on right click:
    remove player head from player
    message "&cChaoticMC &8&l» &7You have sold &c%{_name}%'s Head &7for &b5 XP"
    make console execute command "/addheadxp %player% 5"
 
    
on sign change:
    line 1 is "[Heads]"
    set line 1 to "&4[Heads]"
    set line 2 to "&aRight click to"
    set line 3 to "&asell your"
    set line 4 to "&aHeads"
**another note, the sounds are missing in my version since I don't have the addon to run them
 
Last edited by a moderator:
Wait , how do i fix the last part?
code_language.skript:
on right click of player head:
    remove player head from player
    message "&cChaoticMC &8&l» &7You have sold &c%{_name}%'s Head &7for &b5 XP"
 
Wait , how do i fix the last part?
code_language.skript:
on right click of player head:
    remove player head from player
    message "&cChaoticMC &8&l» &7You have sold &c%{_name}%'s Head &7for &b5 XP"
You mean the name right? it's a local variable, so when you use it out of the event that set's it, it has no value. so you'd have to use a non-local variable or reset the local one in your click event. for instance, the name still works for your on sign click event because you defined the local variable in that event
 
No, it doesnt, it keeps giving me xp when i right click in air/use sword
 
No, it doesnt, it keeps giving me xp when i right click in air/use sword
the display name of the head in the message has nothing to do with the xp. did I misunderstand your problem?
 
Ooh i fixed it, I had to do this:
code_language.skript:
on rightclick holding a player head:
    remove player head from player
    message "&cChaoticMC &8&l» &7You have sold &c%{_name}%'s Head &7for &b5 XP"

Now it works :emoji_grinning:
 
Ooh i fixed it, I had to do this:
code_language.skript:
on rightclick holding a player head:
    remove player head from player
    message "&cChaoticMC &8&l» &7You have sold &c%{_name}%'s Head &7for &b5 XP"

Now it works :emoji_grinning:
Oh you meant your event? :emoji_stuck_out_tongue: lol happy it works though, it's a very cool skript idea.
 
Status
Not open for further replies.