#Can someone help me with this?

1 messages · Page 1 of 1 (latest)

quartz siren
#

'm trying to make a skript, where if you kill someone an emerald drops with their name, and if you right click they get put into gamemode survival from gamemode adventure. I already have a code, but the right clicking part doesn't work

Code:

    if attacker is a player:
        set death message to "%attacker% kivegezte %victim%-t"
        execute console command "gamemode adventure %victim%"
        set {_i} to emerald named "%victim%"
        add nbt compound of "{RepairCost:1000}" to nbt compound of {_i}
        give attacker 1 of {_i}
        set {_uuid} to victim's display name
on right click on stone:
    if player's tool is an emerald:
        if name of player's tool contains "{_i}":
            execute console command "gamemode survival {_uuid}"
            execute console command "clear %player% {_i}"```
fossil crater
#
  1. code blocks. Put your code in code blocks
  • ```code here```
  1. you can use on death of player:, then you dont need the if statement on line 3
  2. Dont use console commands. Skript can do a lot of things, including changing a player's gamemode and clearing their inventory
  3. {_uuid} and {_i} are local variables, so you can't bring them across events.
  • also, why are you setting a variable named uuid to the player's name??
quartz siren
#

I used uuid for the name, because originally it was set to uuid but I realized you can't change a uuid's gamemode

quartz siren
fossil crater
#

if you want to bring them across events, they can't be local variables
you shouldnt use global variables here, as if another player dies the variable will be overwritten, and you'll lose the first player

the best bet would be to add the player's UUID to the emerald in a string tag, then use that on right-click:
if you dont think you're ready to get into NBT stuff, you can also just put the player's UUID in the lore and then get it from there

drifting furnace
#

also, if you put variables into quotes: „{_var}“ you must do it this way: „%{_var}%“

#

referring to line 11

#

and beyond

quartz siren
#

I did this, and I don't know what to do next

    if attacker is a player:
        set death message to "%attacker% kivégezte %victim%-t"
        set the victim's gamemode to adventure
        set {_i} to emerald named "%victim%"
        add nbt compound of "{RepairCost:1000}" to nbt compound of {_i}
        set (string tag "UUID" of (NBT compound of {_i})) to victim's UUID
        give attacker 1 of {_i}
on right click on stone:
    if player's tool has tag "UUID":
        set ______ gamemode to survival
        remove player's tool from the player's inventory```
#

the ____ means I don't know what to write there

fossil crater
#

I would set (string tag "UUID" of (NBT compound of {_i})) to victim's UUID

#

then in the click event, check if player's tool has tag "UUID"

quartz siren
#

And what do I do with the gamemode and the inventory? does it work if I say "remove player's tool"?

quartz siren
fossil crater
#

ahh

#

NBT compound of player's tool

quartz siren
#

It works, but I do have 1 more question/issue

#

How do I make it so that the "set ___ gamemode to survival" sets the victim's gamemode and not the player's?

fossil crater
#

use victim, not player..

quartz siren
#

I get an error that I can only use victim in damage event or smth

fossil crater
#

oh in that event