#script to drop the head + transform into the player you killed

1 messages · Page 1 of 1 (latest)

buoyant bear
#

Hi! I would like some help with a problem I'm having, I'm trying to create a plugin that makes it so that when someone is killed/dies it drops their head and if someone right clicks with it uses it and transforms it with the player's skin and nickname and that we can deactivate it with the command "/unskin" with the plugins skinsrestorer and nicknamer the problem being that I don't have the impression that my nicknamer doesn't work (I'm in version 1.21.1) in short the script doesn't give me the nickname of the player and transforms the person I killed with my skin which is the opposite

my script :
on death of player:
if attacker is a player:
set {_head} to skull of victim
set name of {_head} to "%victim%"
set lore of {_head} to "pseudo:%victim%"
drop {_head} at location of victim

on right click with skull:
set {_clicker} to player
set {_item} to player's tool
if {_item} is not air:
set {_lore::} to lore of {_item}
loop {_lore::
}:
if loop-value starts with "pseudo:":
set {_pseudo} to loop-value
replace all "pseudo:" with "" in {_pseudo}
if {_pseudo} is {_clicker}'s name:
send "&cTu ne peux pas te transformer en toi-même !" to {_clicker}
stop

            set {_cmdSkin} to "skin set %{_clicker's name}% %{_pseudo}%"
            set {_cmdNick} to "nick set %{_clicker's name}% %{_pseudo}%"

            execute console command {_cmdSkin}
            execute console command {_cmdNick}

            remove 1 skull from {_clicker}'s inventory
            send "&aTu es maintenant déguisé en %{_pseudo}% !" to {_clicker}
            stop

command /unskin:
trigger:
execute console command "skin clear %player%"
execute console command "nick reset %player%"
send "&eTu es redevenu toi-même."

zealous fractalBOT
#

Teh's CatMug [PING✔] suggests that you read this embed

Formatting Code In Discord
Why?

Code blocks make it easier for helpers to identify potential errors -- help them help you!

The Format

```vb
on chat:
broadcast "This is how you format code!"
```

How It Looks
on chat:
    broadcast "This is how you format code!"
Extra Info

On US keyboards, the grave character (`) is located above the tab key on the top left of the keyboard

buoyant bear
#
on death of player:
    if attacker is a player:
        set {_head} to skull of victim
        set name of {_head} to "%victim%"
        set lore of {_head} to "pseudo:%victim%"
        drop {_head} at location of victim

on right click with skull:
    set {_clicker} to player
    set {_item} to player's tool
    if {_item} is not air:
        set {_lore::} to lore of {_item}
        loop {_lore::}:
            if loop-value starts with "pseudo:":
                set {_pseudo} to loop-value
                replace all "pseudo:" with "" in {_pseudo}
                if {_pseudo} is {_clicker}'s name:
                    send "&cTu ne peux pas te transformer en toi-même !" to {_clicker}
                    stop

                set {_cmdSkin} to "skin set %{_clicker's name}% %{_pseudo}%"
                set {_cmdNick} to "nick set %{_clicker's name}% %{_pseudo}%"

                execute console command {_cmdSkin}
                execute console command {_cmdNick}

                remove 1 skull from {_clicker}'s inventory
                send "&aTu es maintenant déguisé en %{_pseudo}% !" to {_clicker}
                stop

command /unskin:
    trigger:
        execute console command "skin clear %player%"
        execute console command "nick reset %player%"
        send "&eTu es redevenu toi-même."
```vb
#

like this ?

desert ermine
#
  1. %{_clicker's name}% is not how variables work... it should be {}'s name, as the name expression is not a part of the variable
  2. I do have to ask if this is AI code, as a lot of these local variables arent needed.
  • {_clicker} and {_item}: I dont see why you cant just use player and player's tool
  • {_lore::*}: Why not just loop lore of player's tool? You dont need the variable for anything
  • {_cmdSkin} and {_cmdNick} can just be typed in the same line they are executed
buoyant bear
desert ermine
#

#welcome-to-skunity rule 8, AI code is not allowed as this is a skript learning discord and the most benificial experience is you writing the solution

high solstice
#

And ai sucks at writing skript

buoyant bear
# desert ermine <#224289277100425216> rule 8, AI code is not allowed as this is a skript *learni...

Hi, yes I know it's not allowed but I tried to do the code myself on about ten attempts without result the only thing I could do was to drop the head of the player we killed, after getting tired of not succeeding I went to watch youtube tutorials to learn how to script but even there I didn't manage to do anything conclusive so I turned to the last option which is AI, I preferred to be honest rather than lie to you, sorry if in your eyes I'm stupid to use AI but I really need this script in particular...

desert ermine
#

YouTube tutorials are outdated and imo not that great

zealous fractalBOT
zealous fractalBOT
#

It is recommended that you don't use AI agents for multiple reasons @buoyant bear:


2) Blindly trusting code from any source is a bad idea, especially on production servers. Even if the code that was generated appears to work, you have no clue what vulnerabilities it introduces or fails to protect against.

3) Using AI to write your code takes away from your learning and doesn't challenge you to develop problem solving skills.```
While AI can be used as a tool, it is necessary to understand what it is doing and check any code it creates. Since this is a learning community, we want to support your personal growth. As a result, we don't allow generated content in our help channels ([Rule 8](<#welcome-to-skunity message>))
buoyant bear
#

(I'm currently using Google Translate to answer you)