1. 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!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

armor update

Discussion in 'Skript' started by ViperX, Jul 28, 2022.

  1. ViperX

    ViperX Member

    Joined:
    Jul 26, 2022
    Messages:
    26
    Likes Received:
    0
    Hey, I doing a rpg server so I did a stats for the armor that updates every tick but if I drop the armor from my armor slots it takes like 10 seconds to upadate...
    anything that I missing?
    Code (Text):
    1. every 1 tick:
    2.     loop all players:
    3.         #defence
    4.         if loop-player's helmet is not air:
    5.             set {lore::*} to lore of loop-player's helmet split at "||"
    6.             replace all "&7Defence: &a+" in {lore::1} with ""
    7.             set {def::%loop-player%::helmet} to {lore::1} parsed as an integer
    8.         else:
    9.             set {def::%loop-player%::helmet} to 0
    10.         if loop-player's chestplate is not air:
    11.             set {lore::*} to lore of loop-player's chestplate split at "||"
    12.             replace all "&7Defence: &a+" in {lore::1} with ""
    13.             set {def::%loop-player%::chestplate} to {lore::1} parsed as an integer
    14.         else:
    15.             set {def::%loop-player%::chestplate} to 0
    16.         if loop-player's leggings is not air:
    17.             set {lore::*} to lore of loop-player's leggings split at "||"
    18.             replace all "&7Defence: &a+" in {lore::1} with ""
    19.             set {def::%loop-player%::leggings} to {lore::1} parsed as an integer
    20.         else:
    21.             set {def::%loop-player%::leggings} to 0
    22.         if loop-player's boots is not air:
    23.             set {lore::*} to lore of loop-player's boots split at "||"
    24.             replace all "&7Defence: &a+" in {lore::1} with ""
    25.             set {def::%loop-player%::boots} to {lore::1} parsed as an integer
    26.         else:
    27.             set {def::%loop-player%::boots} to 0
    28.        
    29.         #ferocity / speed / hp
    30.         if loop-player's helmet is not air:
    31.             set {lore::*} to lore of loop-player's helmet split at "||"
    32.             if {lore::3} contains "&7Ferocity: &c+":
    33.                 replace all "&7Ferocity: &c+" in {lore::3} with ""
    34.                 set {fer::%loop-player%::helmet} to {lore::3} parsed as an integer
    35.             else if {lore::3} contains "&7Speed: &a+":
    36.                 replace all "&7Speed: &a+" in {lore::3} with ""
    37.                 set {speed::%loop-player%::helmet} to {lore::3} parsed as an integer
    38.             else if {lore::3} contains "&7Health: &a+":
    39.                 replace all "&7Health: &a+" in {lore::3} with ""
    40.                 set {hp::%loop-player%::helmet} to {lore::3} parsed as an integer
    41.             else:
    42.                 set {hp::%loop-player%::helmet} to 0
    43.                 set {speed::%loop-player%::helmet} to 0
    44.                 set {fer::%loop-player%::helmet} to 0
    45.         else:
    46.             set {hp::%loop-player%::helmet} to 0
    47.             set {speed::%loop-player%::helmet} to 0
    48.             set {fer::%loop-player%::helmet} to 0
    49.        
    50.         if loop-player's chestplate is not air:
    51.             set {lore::*} to lore of loop-player's chestplate split at "||"
    52.             if {lore::3} contains "&7Ferocity: &c+":
    53.                 replace all "&7Ferocity: &c+" in {lore::3} with ""
    54.                 set {fer::%loop-player%::chestplate} to {lore::3} parsed as an integer
    55.             else if {lore::3} contains "&7Speed: &a+":
    56.                 replace all "&7Speed: &a+" in {lore::3} with ""
    57.                 set {speed::%loop-player%::chestplate} to {lore::3} parsed as an integer
    58.             else if {lore::3} contains "&7Health: &a+":
    59.                 replace all "&7Health: &a+" in {lore::3} with ""
    60.                 set {hp::%loop-player%::chestplate} to {lore::3} parsed as an integer
    61.             else:
    62.                 set {hp::%loop-player%::chestplate} to 0
    63.                 set {speed::%loop-player%::chestplate} to 0
    64.                 set {fer::%loop-player%::chestplate} to 0
    65.         else:
    66.             set {hp::%loop-player%::chestplate} to 0
    67.             set {speed::%loop-player%::chestplate} to 0
    68.             set {fer::%loop-player%::chestplate} to 0
    69.        
    70.         if loop-player's leggings is not air:
    71.             set {lore::*} to lore of loop-player's leggings split at "||"
    72.             if {lore::3} contains "&7Ferocity: &c+":
    73.                 replace all "&7Ferocity: &c+" in {lore::3} with ""
    74.                 set {fer::%loop-player%::leggings} to {lore::3} parsed as an integer
    75.             else if {lore::3} contains "&7Speed: &a+":
    76.                 replace all "&7Speed: &a+" in {lore::3} with ""
    77.                 set {speed::%loop-player%::leggings} to {lore::3} parsed as an integer
    78.             else if {lore::3} contains "&7Health: &a+":
    79.                 replace all "&7Health: &a+" in {lore::3} with ""
    80.                 set {hp::%loop-player%::leggings} to {lore::3} parsed as an integer
    81.             else:
    82.                 set {hp::%loop-player%::leggings} to 0
    83.                 set {speed::%loop-player%::leggings} to 0
    84.                 set {fer::%loop-player%::leggings} to 0
    85.         else:
    86.             set {hp::%loop-player%::leggings} to 0
    87.             set {speed::%loop-player%::leggings} to 0
    88.             set {fer::%loop-player%::leggings} to 0
    89.        
    90.         if loop-player's boots is not air:
    91.             set {lore::*} to lore of loop-player's boots split at "||"
    92.             if {lore::3} contains "&7Ferocity: &c+":
    93.                 replace all "&7Ferocity: &c+" in {lore::3} with ""
    94.                 set {fer::%loop-player%::boots} to {lore::3} parsed as an integer
    95.             else if {lore::3} contains "&7Speed: &a+":
    96.                 replace all "&7Speed: &a+" in {lore::3} with ""
    97.                 set {speed::%loop-player%::boots} to {lore::3} parsed as an integer
    98.             else if {lore::3} contains "&7Health: &a+":
    99.                 replace all "&7Health: &a+" in {lore::3} with ""
    100.                 set {hp::%loop-player%::boots} to {lore::3} parsed as an integer
    101.             else:
    102.                 set {hp::%loop-player%::boots} to 0
    103.                 set {speed::%loop-player%::boots} to 0
    104.                 set {fer::%loop-player%::boots} to 0
    105.         else:
    106.             set {hp::%loop-player%::boots} to 0
    107.             set {speed::%loop-player%::boots} to 0
    108.             set {fer::%loop-player%::boots} to 0
    109.        
    110.         #strength
    111.         if name of loop-player's helmet is "&6Warden Helmet":
    112.             set loop-player's walking speed to {speed::%loop-player%} / 1000
    113.             set loop-player's flying speed to {speed::%loop-player%} / 1000
    114.             set {_h} to loop-player's helmet
    115.             set {_st} to ({speed::%loop-player%} / 10) * 150
    116.             set {lore::*} to {_h}'s lore split at "||"
    117.             set {lore::2} to "&7Strength: &c+%{_st}%"
    118.             set line 2 of lore of {_h} to "&7Strength: &c+%{_st}%"
    119.             set {lore::*} to {_h}'s lore split at "||"
    120.             set {_l} to {lore::2}
    121.             replace all "&7Strength: &c+" in {_l} with ""
    122.             set {st::%loop-player%::helmet} to {_l} parsed as an integer
    123.         else:
    124.             set loop-player's walking speed to {speed::%loop-player%} / 500
    125.             set loop-player's flying speed to {speed::%loop-player%} / 500
    126.             if loop-player's helmet is not air:
    127.                 set {lore::*} to lore of loop-player's helmet split at "||"
    128.                 replace all "&7Strength: &c+" in {lore::2} with ""
    129.                 set {st::%loop-player%::helmet} to {lore::2} parsed as an integer
    130.             else:
    131.                 set {st::%loop-player%::helmet} to 0
    132.         if loop-player's chestplate is not air:
    133.             set {lore::*} to lore of loop-player's chestplate split at "||"
    134.             replace all "&7Strength: &c+" in {lore::2} with ""
    135.             set {st::%loop-player%::chestplate} to {lore::2} parsed as an integer
    136.         else:
    137.             set {st::%loop-player%::chestplate} to 0
    138.         if loop-player's leggings is not air:
    139.             set {lore::*} to lore of loop-player's leggings split at "||"
    140.             replace all "&7Strength: &c+" in {lore::2} with ""
    141.             set {st::%loop-player%::leggings} to {lore::2} parsed as an integer
    142.         else:
    143.             set {st::%loop-player%::leggings} to 0
    144.         if loop-player's boots is not air:
    145.             set {lore::*} to lore of loop-player's boots split at "||"
    146.             replace all "&7Strength: &c+" in {lore::2} with ""
    147.             set {st::%loop-player%::boots} to {lore::2} parsed as an integer
    148.         else:
    149.             set {st::%loop-player%::boots} to 0
    150.            
    151.         set {fer::%loop-player%} to {fer::%loop-player%::helmet} + {fer::%loop-player%::chestplate} + {fer::%loop-player%::leggings} + {fer::%loop-player%::boots}
    152.         set {hp::%loop-player%} to {hp::%loop-player%::helmet} + {hp::%loop-player%::chestplate} + {hp::%loop-player%::leggings} + {hp::%loop-player%::boots} + 100
    153.         set {speed::%loop-player%} to {speed::%loop-player%::helmet} + {speed::%loop-player%::chestplate} + {speed::%loop-player%::leggings} + {speed::%loop-player%::boots} + 100
    154.         set {st::%loop-player%} to {st::%loop-player%::helmet} + {st::%loop-player%::chestplate} + {st::%loop-player%::leggings} + {st::%loop-player%::boots} + 10
    155.         set {def::%loop-player%} to {def::%loop-player%::helmet} + {def::%loop-player%::chestplate} + {def::%loop-player%::leggings} + {def::%loop-player%::boots} + 10
    156.        
    157.         set loop-player's max health to {hp::%loop-player%} / 10
     

Share This Page

Loading...