Hey everyone! I wrote three skripts and I am not sure if they are really optimised or not. I feel like events that are used on them can damage the performance of the server. Can you make them more performance friendly?
My first skript is this. It is a scope skript and when players sneak, they get a carved pumpkin with a sniper texture on their head.
My second skript is a bleeding skript. When a players get hit, if damage is more that 2.5 hearts, they start to bleed and continue to bleed until they command /heal. I also added an "on join" event because without it, players don't bleed after they log off and log back on.
Now to the last skript. I have an action bar that is sent to the player every 2 seconds. I think this can load a lot of stress to the server. And I have a suggestion for this. If we can make it so that it is only sent to the player when it is updated (for example when player gets hit), we can reduce the stress of the server. But I don't know how to send action bar for a longer period of time with one line. Is that possible?
Thank you in advance.
My first skript is this. It is a scope skript and when players sneak, they get a carved pumpkin with a sniper texture on their head.
Code:
on sneak toggle:
if player is holding golden hoe:
if player is not sneaking:
set {scope::%player%} to true
set {helmet::%player%} to player's helmet
wait 1 tick
equip player with carved pumpkin
apply slowness of tier 255 without particles to player for 100000 seconds
play sound "entity.bat.takeoff" at volume 1 at pitch 1 to player
on sneak toggle:
if player is holding golden hoe:
if player is sneaking:
set {scope::%player%} to false
remove slowness from player
set player's helmet to {helmet::%player%}
play sound "entity.bat.takeoff" at volume 1 at pitch 1 to player
on player's tool change:
if {scope::%player%} is true:
if player's tool is not golden hoe:
cancel event
My second skript is a bleeding skript. When a players get hit, if damage is more that 2.5 hearts, they start to bleed and continue to bleed until they command /heal. I also added an "on join" event because without it, players don't bleed after they log off and log back on.
Code:
on damage:
if damage cause is an attack:
if {bleeding::%victim's uuid%} is false:
set {_damage} to damage
if {_damage} is more than 2.5:
set {bleeding::%victim's uuid%} to true
while victim is online:
wait 2 seconds
if {bleeding::%victim's uuid%} is true:
apply blindness of tier 1 without particles to victim for 2 seconds
send victim title "You're Bleeding!" for 2 seconds
damage the victim by 2
wait 13 seconds
on join:
if {bleeding::%player's uuid%} is true:
loop 1000 times:
wait 2 seconds
if player's health is more than 2:
apply blindness of tier 1 without particles to player for 2 seconds
send victim title "You're Bleeding!" for 2 seconds
damage the player by 2
wait 15 seconds
if {hasta::%player's uuid%} is false:
exit loop
command /heal:
trigger:
set {bleeding::%victim's uuid%} to false
Now to the last skript. I have an action bar that is sent to the player every 2 seconds. I think this can load a lot of stress to the server. And I have a suggestion for this. If we can make it so that it is only sent to the player when it is updated (for example when player gets hit), we can reduce the stress of the server. But I don't know how to send action bar for a longer period of time with one line. Is that possible?
Code:
on join:
while player is online:
send action bar "Health: %player's health%/%player's max health% | Hunger: %player's hunger%/10" to player
wait 2 seconds
Thank you in advance.
Last edited: