Solved Targeting issue

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

johnnoba

Member
Mar 8, 2020
4
1
0
i am having this issue that when i try to target a player in a command. The command is as follows
Code:
command /revive <player>:
    executable by: players
    trigger:
        if player's gamemode is spectator:
            if sender is holding 10 diamonds:
                remove 10 diamonds from sender
                set gamemode of player to survival
                teleport player to {deathspot.%player%}
                send "&6&l%player% &ahas been revived." to sender
                send "&6&l%sender% &ahas revived you for &b&l10 Diamonds." to player
                broadcast "&6&l%player% &ahas been revived by &6&l%sender% &afor &b&l10 Diamonds."
                stop
            if sender is holding 64 iron ingots:
                remove 64 iron ingots from sender
                set gamemode of player to survival
                teleport player to {deathspot.%player%}
                send "&6&l%player% &ahas been revived." to sender
                send "&6&l%sender% &ahas revived you for &7&l64 Iron." to player
                broadcast "&6&l%player% &ahas been revived by &6&l%sender% &afor &b&l64 Iron."
                stop
            else:
                send "&cYou must be holding either &b&l10 Diamonds &cor &7&l64 Iron &cto revive this player." to sender
                stop

The issue is when u use this it considers the player and the sender the same person and i tried using %args 1% instead of %player% but if i do that i cant teleport the player or change their gamemode.

Just a little extra background this is being used as a hardcore thing for a server for me and my friends, so when one of us dies we cant respawn until the others "revive" us using 10 diamonds or 64 iron
Skript version: 2.4.1
Minecraft Version: 1.15.2
 
i am having this issue that when i try to target a player in a command. The command is as follows
Code:
command /revive <player>:
    executable by: players
    trigger:
        if player's gamemode is spectator:
            if sender is holding 10 diamonds:
                remove 10 diamonds from sender
                set gamemode of player to survival
                teleport player to {deathspot.%player%}
                send "&6&l%player% &ahas been revived." to sender
                send "&6&l%sender% &ahas revived you for &b&l10 Diamonds." to player
                broadcast "&6&l%player% &ahas been revived by &6&l%sender% &afor &b&l10 Diamonds."
                stop
            if sender is holding 64 iron ingots:
                remove 64 iron ingots from sender
                set gamemode of player to survival
                teleport player to {deathspot.%player%}
                send "&6&l%player% &ahas been revived." to sender
                send "&6&l%sender% &ahas revived you for &7&l64 Iron." to player
                broadcast "&6&l%player% &ahas been revived by &6&l%sender% &afor &b&l64 Iron."
                stop
            else:
                send "&cYou must be holding either &b&l10 Diamonds &cor &7&l64 Iron &cto revive this player." to sender
                stop

The issue is when u use this it considers the player and the sender the same person and i tried using %args 1% instead of %player% but if i do that i cant teleport the player or change their gamemode.

Just a little extra background this is being used as a hardcore thing for a server for me and my friends, so when one of us dies we cant respawn until the others "revive" us using 10 diamonds or 64 iron
Skript version: 2.4.1
Minecraft Version: 1.15.2

Sender = sender of the command so this can be a player but also the console
player = sender of the command but can only be a player and not the console

arg 1 = the player entered in the argument

so player = sender

The thing u propably did wrong was using %arg 1% instead of arg 1

the %% are only used to use expressions with return values inside of a string or a variable etc

Code:
if gamemode of arg 1 is spectator:

if arg 1 is holding 10 diamonds:

remove 10 diamonds from arg 1

set gamemode of arg 1 to survival

teleport arg 1 to {var}
 
Status
Not open for further replies.