Solved Making a deathnote

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

SoMuchWessel

Active Member
Apr 3, 2017
147
3
18
Hello guys,

I am making a deathnote in minecraft, but i ran into a problem.
code_language.skript:
command /deathnote <player>:
    trigger:
        if arg-1 is set:
            if player is holding a enchanted book named "&cDeathnote":
                kill arg-1
                remove 1 enchanted book named "&cDeathnote" from the player
                broadcast "&c&l%player% killed %arg-1%!"
            else:
                send "&aYou are not holding a deathnote!"

This is the code i use. Imagine there is a player online named Jeb, and i do: /deathnote b, then jeb gets killed. But thats not what i want.
I want that only if i type /deathnote Jeb that it will kill him.


Can you guys help me?
 
loop the players online and set a condition of arg 1 is equal to the loop-player. That way the arg has to be a full player name for it to kill them.
 
loop the players online and set a condition of arg 1 is equal to the loop-player. That way the arg has to be a full player name for it to kill them.

Like this?


code_language.skript:
command /deathnote <player>:
    trigger:
        if arg-1 is set:
            if player is holding a enchanted book named "&cDeathnote":
                loop all players:
                    if loop-player = arg-1:
                        kill loop-player
                remove 1 enchanted book named "&cDeathnote" from the player
                broadcast "&c&l%player% killed %arg-1%!"
            else:
                send "&aYou are not holding a deathnote!"
 
Like this?


code_language.skript:
command /deathnote <player>:
    trigger:
        if arg-1 is set:
            if player is holding a enchanted book named "&cDeathnote":
                loop all players:
                    if loop-player = arg-1:
                        kill loop-player
                remove 1 enchanted book named "&cDeathnote" from the player
                broadcast "&c&l%player% killed %arg-1%!"
            else:
                send "&aYou are not holding a deathnote!"
Yep, thats the idea! did it work for you?^-^
 
What doesn't work? Also, try doing,
code_language.skript:
if loop-player is arg-player:
 
What doesn't work? Also, try doing,
code_language.skript:
if loop-player is arg-player:

This kinda works, but still if i do /deathnote b it kills the player Jeb
'

Edit:
I came to this conclusion:

If i do: /deathnote b, and Jeb is online, it kills jeb because the name jeb contains the letter b,
So how do i fix that it only works when i type the full player name instead of just a letter
 
Last edited:
https://bensku.github.io/Skript/classes.html#player
"You have two possibilities to use players as command arguments: <player> and <offline player>. The first requires that the player is online and also accepts only part of the name, while the latter doesn't require that the player is online, but the player's name has to be entered exactly"

use offline player and check if theyre online
 
https://bensku.github.io/Skript/classes.html#player
"You have two possibilities to use players as command arguments: <player> and <offline player>. The first requires that the player is online and also accepts only part of the name, while the latter doesn't require that the player is online, but the player's name has to be entered exactly"

use offline player and check if theyre online

I tried but i still got the same problem.


code_language.skript:
command /deathnote <offline player>:
    trigger:
        if arg-1 is not set:
            send "&a/deathnote <Player>"
        else:
            if player is holding a enchanted book named "&cDeathnote":
                if arg-1 is online:
                    kill arg-1
                    remove 1 enchanted book named "&cDeathnote" from the player
                    broadcast "&c&l%player% killed %arg-1%!"
                else:
                    send "%arg-1% is not online!"
            else:
                send "&aYou are not holding a deathnote!"
 
thats annoying, i guess youll have to do it like this
code_language.skript:
command /deathnote <text>:
    loop all players:
        if "%loop-value%" is arg-1:
            send "online!"
 
thats annoying, i guess youll have to do it like this
code_language.skript:
command /deathnote <text>:
    loop all players:
        if "%loop-value%" is arg-1:
            send "online!"

I now got this:

code_language.skript:
command /deathnote <text>:
    trigger:
        if arg-1 is not set:
            send "&a/deathnote <Player>"
        else:
            if player is holding a enchanted book named "&cDeathnote":
                loop all players:
                    if "%loop-value%" is arg-1:
                        kill arg-1
                        remove 1 enchanted book named "&cDeathnote" from the player
                        broadcast "&c&l%player% killed %arg-1%!"
            else:
                send "&aYou are not holding a deathnote!"

But it now gives this error:
The 1st argument is not an entity (kill arg-1)

How do i solve this ?
 
Status
Not open for further replies.