Using Text Variable As A Executed Player

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

kedarkedar

New Member
Jun 10, 2023
7
0
1
I can't find a way to make skript do things on a player that is set inside a variable

Heres code:

on death of player:
broadcast "%{lastdamager.%victim's uuid%}%"
if {bounty.%victim's uuid%} is not 0:
if {lastdamager.%victim's uuid%} is set:
broadcast "%{lastdamager.%victim's uuid%}%"
set {victimsattacker} to {lastdamager.%victim's uuid%}
set {bounty.%victim's uuid%} to 0
add {bounty.%victim's uuid%} to {victimsattacker}'s balance
send "&aSuccesfully claimed bounty of %{player}%, consisting of %{cash}%$." to {victimsattacker}

Its general purpose is to give the bounty to the last player who attacked if the victim is in combat ( 12s after a hit ), the only problem is with the last two lines, I've tried doing {victimsattacker}, %{victimsattacker}%, "%{victimsattacker}%" but the first one doesnt work, while the latter two give errors.
 
I think you can do:

Code:
on death of player:
broadcast "%attacker%"
if {bounty.%victim's uuid%} is not 0:
if attacker is a player:
broadcast "%attacker%"
#set {victimsattacker} to {lastdamager.%victim's uuid%} (You don't need that)
set {bounty.%victim's uuid%} to 0
add {bounty.%victim's uuid%} to attacker's balance
send "&aSuccesfully claimed bounty of %victim%, consisting of %{bounty.%victim's uuid%}%$." to attacker
 
how tho, theyre variables, gives error either way
Code:
on damage of player:
    attacker is player
    victim is player
    set {lastdamager::%uuid of victim%} to attacker

on death of player:
    if attacker is player:
        set {lastdamager::%uuid of victim%} to attacker
    {lastdamager::%uuid of victim%} is set
    set {_attacker} to {lastdamager::%uuid of victim%}
    delete {lastdamager::%uuid of victim%}
    {bounty::%uuid of {_attacker}%} is greater than 0
    add {bounty::%uuid of {_attacker}%} to {_attacker}'s balance
    send "&aSuccesfully claimed bounty of %victim%, consisting of %{bounty::%uuid of {_attacker}%}%$." to {_attacker}
    set {bounty::%uuid of {_attacker}%} to 0
 
Last edited:
Both of these is not what i want, I already have a version that works but i want to make it also work if the player with a bounty dies indirectly from other player e.g. fall damage. In addition they both dont work :/
 
Both of these is not what i want, I already have a version that works but i want to make it also work if the player with a bounty dies indirectly from other player e.g. fall damage. In addition they both dont work :/
I'll got some mistake in variable name in my previous code, it's gonna work at now (why you doesn't recognize that mistake by your self, idk?). You can also categorize allowed damage types by this condition
 
The bounty should only activate if the victim is in combat (12 sec after hit) and not always cuz it would be too broken. Also the damage types wont work cuz for instance there could be normal fall damage and fall damage caused by knockback from other player
[doublepost=1686651821,1686651631][/doublepost]I tried doing it before with a variable that resets 12 sec after a hit, and if uve read the title or my previous reply I ONLY NEED HELP WITH USING PLAYER NAMES IN THESE VARIABLES AS A PLAYER.
 
I can't find a way to make skript do things on a player that is set inside a variable

Heres code:

on death of player:
broadcast "%{lastdamager.%victim's uuid%}%"
if {bounty.%victim's uuid%} is not 0:
if {lastdamager.%victim's uuid%} is set:
broadcast "%{lastdamager.%victim's uuid%}%"
set {victimsattacker} to {lastdamager.%victim's uuid%}
set {bounty.%victim's uuid%} to 0
add {bounty.%victim's uuid%} to {victimsattacker}'s balance
send "&aSuccesfully claimed bounty of %{player}%, consisting of %{cash}%$." to {victimsattacker}

Its general purpose is to give the bounty to the last player who attacked if the victim is in combat ( 12s after a hit ), the only problem is with the last two lines, I've tried doing {victimsattacker}, %{victimsattacker}%, "%{victimsattacker}%" but the first one doesnt work, while the latter two give errors.
I believe this is what you want.
Code:
on death of player:
    broadcast "%{lastdamager.%victim's uuid%}%"
    if {bounty.%victim's uuid%} is not 0:
        if {lastdamager.%victim's uuid%} is set:
            broadcast "%{lastdamager.%victim's uuid%}%"
            set {_attacker} to {lastdamager.%victim's uuid%}
            set {bounty.%victim's uuid%} to 0
            add {bounty.%victim's uuid%} to {_attacker} parsed as a player's balance
            send "&aSuccesfully claimed bounty of %{player}%, consisting of %{cash}%$." to {_attacker}
 
I believe you're trying to make a claiming bounty Skript, here's one nice and simple
Code:
on death:
    attacker is a player
    victim is a player
    if {bounty.%victim's uuid%} is not 0:
        broadcast "%attacker%"
        # attacker will gain 0 cash if you do set before adding
        set {cash} to {bounty.%victim's uuid%}
        add {cash} to attacker's balance
        set {bounty.%victim's uuid%} to 0
        send "&aSuccesfully claimed bounty of &2%victim%&a, consisting of &2$%{cash}%&a." to attacker
 
Last edited: