Solved How to detect item's name (number value)

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

    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!

HeliumBoi

Active Member
Sep 15, 2023
63
6
8
I'm having issues with detecting the value of the bonus card i made to add to player's balance.
I'm sure you already know what I'm trying to make so try your best please.

Screenshot_5.png


Here's the code if you need to copy

Code:
command /bonus <text> <player> <integer>:
    trigger:
        if arg-1 is "give":
            set {_bonus-value} to arg-3
            give arg-2 paper named "<##34eb5e>&lB &fBonus card &7(&e%{_bonus-value}%)"

on click:
    #detect player's item with bonus value
    #add the bonus value to player's accound
    #send player a notice
 
The problem has been solved by this discord user @Thijmen009

Code:
command /bonus <text> <player> <integer>:
    trigger:
        if arg-1 is "give":
            set {_bonus-value} to arg-3
            give arg-2 paper named "<##34eb5e>&lB &fBonus card &7(&e%{_bonus-value}%&7)"

on click:
    if player's tool is paper:
        set {_name} to player's held item's name
        set {_sections::*} to {_name} split at "("
        set {_sections::*} to {_sections::2} split at ")"
        set {_sections::*} to {_sections::1} split at "&e"
        send "%{_sections::2}%" to player
 
  • Like
Reactions: Luke_Sky_Walker