Number in name

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

Status
Not open for further replies.

skanto123

Active Member
Jan 8, 2018
70
0
0
34
So I know how to make a paper named lets say "1000" and I know how to make it when you click it it opens a gui with a dirt slot so how do I make it so when you click that dirt it removes 10 from the name and it checks if the name is equal to or higher than 10 and then sets to name to the number and removes 10 from it and in this case it will go to "990" and then gives the player a dirt block
 
code_language.skript:
set {_name} to name of player’s tool parsed as a number
remove 10 from {_name}
set name of player’s tool to {_name}
 
code_language.skript:
set {_name} to name of player’s tool parsed as a number
remove 10 from {_name}
set name of player’s tool to {_name}
What plugins do I need for this to work?
I made this and im getting errors http://prntscr.com/irxzy5
code_language.skript:
command /giftcard:
    trigger:
        give 1 paper named "&7100$ &aGiftcard" to player
                
                
on right click:
    if player's held item is a paper named "&7100$ &aGiftcard":
        open chest with 1 rows named "Test" to player
        format slot 4 of player with dirt named "10$" to close then run [make player execute command "dirtgiftcard"]

command /dirtgiftcard:
    trigger:
        set {_name} to name of player’s held item parsed as a number
        remove 10 from {_name}
        set name of player’s tool to {_name}
        give player 1 dirt
 
U can try:
code_language.skript:
command /giftcard:
    trigger:
        give 1 paper named "&7100$ &aGiftcard" to player

on right click:
    if player's held item is a paper named "&7100$ &aGiftcard":
        open chest with 1 rows named "Test" to player
        format slot 4 of player with dirt named "10$" to close then run [make player execute command "dirtgiftcard"]

command /dirtgiftcard:
    trigger:
        set {_name} to name of player's tool
        replace every "&7" with "" in {_name}
        replace every "$ &aGiftcard" with "" in {_name}
        set {_name} to {_name} - 10
        set {_name} to "&7%{_name}%$ &aGiftcard"
        set player's held item to player's held item named "%{_name}%"
        give player 1 dirt #named "%{_name}%"
 
U can try:
code_language.skript:
command /giftcard:
    trigger:
        give 1 paper named "&7100$ &aGiftcard" to player

on right click:
    if player's held item is a paper named "&7100$ &aGiftcard":
        open chest with 1 rows named "Test" to player
        format slot 4 of player with dirt named "10$" to close then run [make player execute command "dirtgiftcard"]

command /dirtgiftcard:
    trigger:
        set {_name} to name of player's tool
        replace every "&7" with "" in {_name}
        replace every "$ &aGiftcard" with "" in {_name}
        set {_name} to {_name} - 10
        set {_name} to "&7%{_name}%$ &aGiftcard"
        set player's held item to player's held item named "%{_name}%"
        give player 1 dirt #named "%{_name}%"
U can try:
code_language.skript:
command /giftcard:
    trigger:
        give 1 paper named "&7100$ &aGiftcard" to player

on right click:
    if player's held item is a paper named "&7100$ &aGiftcard":
        open chest with 1 rows named "Test" to player
        format slot 4 of player with dirt named "10$" to close then run [make player execute command "dirtgiftcard"]

command /dirtgiftcard:
    trigger:
        set {_name} to name of player's tool
        replace every "&7" with "" in {_name}
        replace every "$ &aGiftcard" with "" in {_name}
        set {_name} to {_name} - 10
        set {_name} to "&7%{_name}%$ &aGiftcard"
        set player's held item to player's held item named "%{_name}%"
        give player 1 dirt #named "%{_name}%"
it just sets the name of the item to -10$ giftcard also how do I make it so it opens the gui to buy the dirt if name of player's held item contains "&aGiftcard" so the $ amount can be random and not 100
 
1.Try:
code_language.skript:
set {_name} to {_name} parsed as number-10
or
code_language.skript:
set {_name} to {_name}-10
or
code_language.skript:
set {_name} to {_namenumber} parsed as number
set {_name} to {_namenumber}-10
or
code_language.skript:
subtract 10 from {_name} parsed as number

2.Try:
code_language.skript:
on rightclick:
    if name of player's tool is "&aGiftcard":
        open chest with 1 rows named "Test" to player
        format slot 4 of player with dirt named "Buy &aGiftcard" to close then run [make player execute command "buygiftcard"]

command /buygiftcard:
    trigger:
        give player 1 paper named "&7%random number between 100 and 900%$ &aGiftcard" to player
 
Status
Not open for further replies.