kill player on chat message after right clicking

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

Tewtiy

Member
Jul 2, 2023
10
0
1
my code is
on rightclick with paper:
send "die" to player
remove paper from player
on chat:
loop all players:
if message contains online players name
kill %player%

i cannot figure out how to make it so when i type an online players name it kills them, if anyone could help me out thanks!
 
Try using loop-player instead of online player. It doesn't recognize 'online player' in a loop.

Code:
on chat:
    loop all players:
        if message contains %loop-player%
            kill %loop-player%

If the 3rd line doesn't work, try it in quotations.

Code:
"%loop-player%"
 
Last edited:
Try using loop-player instead of online player. It doesn't recognize 'online player' in a loop.

Code:
on chat:
    loop all players:
        if message contains %loop-player%
            kill %loop-player%

If the 3rd line doesn't work, try it in quotations.

Code:
"%loop-player%"
well yes, this works but is it possible to make it happen after i right click an item?
 
well yes, this works but is it possible to make it happen after i right click an item?
Can you please explain what you mean? I have to guess, but I will still try my best to understand.

Depending on what you're asking, the answer is yes. However, if you are talking about killing the player when the item is right-clicked, I can show you this example:

Code:
on right-click:
    if player is holding paper:
        kill player
 
Can you please explain what you mean? I have to guess, but I will still try my best to understand.

Depending on what you're asking, the answer is yes. However, if you are talking about killing the player when the item is right-clicked, I can show you this example:

Code:
on right-click:
    if player is holding paper:
        kill player

like, if you right click a piece of paper then the player who right clicked the paper can type a name in chat and it kills the players whos name was typed
 
There is a way to do this, and it's probably something like this:
Code:
on right click:
    if player is holding paper:
        set {deathnote::%player%} to true
        remove player's held item
on chat:
   if {deathnote::%player%} is true:
       loop all players:
           if message contains "%loop-player%":
               kill loop-player
               delete {deathnote::%player%}

That should probably work. All it does is just make a variable list designed for the player, and when the player chats it just checks to see if it is set, and then kills the player. I have no idea if this works though. If not, tell me, and I'll try to make a work-around. Make sure to send me the errors or take a screenshot.
 
Last edited:
There is a way to do this, and it's probably something like this:
Code:
on right click:
    if player is holding paper:
        add 1 to {deathnote::%player%}
on chat:
   if {deathnote::%player%} is equal to 1:
       loop all players:
           if message contains "%loop-player%":
               kill loop-player
               delete {deathnote::%player%}

That should probably work. All it does is just make a variable list designed for the player, and when the player chats it just checks to see if it is set, and then kills the player. I have no idea if this works though. If not, tell me, and I'll try to make a work-around. Make sure to send me the errors or take a screenshot.
there is no errors in console, but when i try to type a players name it does not kill or remove the piece of paper
 
You can also make it so it will only react to a specific name or lore.
 
there is no errors in console, but when i try to type a players name it does not kill or remove the piece of paper
I fixed the piece of paper, but let me see if I can figure it out. I think I know the error.