Solved My server crashes when a mob attacks me

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

xiShaDow_

New Member
Jul 21, 2019
6
0
0
19
So i made this script on my server so if a player gets attacked he drops emeralds randomly between 0 and 4 in a specific world called "PvP"..but when i tried it everytime a mob or a player attacks me the server just crashes..how can i fix this ??

Code:
on damage:
    if victim is a player:
        while victim's world is "PvP":
            set {_i} to a random integer between 0 and 4
            drop {_i} of emeralds
 
Last edited:
So i made this script on my server so if a player gets attacked he drops emeralds randomly between 0 and 4 in a specific world called "PvP"..but when i tried it everytime a mob or a player attacks me the server just crashes..how can i fix this ??

Code:
on damage:
    if victim is a player:
        while victim's world is "PvP":
            set {_i} to a random integer between 0 and 4
            drop {_i} of emeralds
Add a wait in your while loop, or the loop will run infinitely and crash your server.
 
Add a wait in your while loop, or the loop will run infinitely and crash your server.

Well, the server didn't crash but it drops nothing...

Code:
on damage:
    if victim is a player:
        while victim's world is "PvP":
            wait 2 ticks
            set {_i} to a random integer between 1 and 4
            drop {_i} of emeralds
 
why use while?

Code:
on damage:
    if victim is a player:
        if player is in the world "PvP":
            set {_i} to a random integer between 1 and 4
            drop {_i} of emeralds

or "if victim is in the world "X"
 
Well, the server didn't crash but it drops nothing...

Code:
on damage:
    if victim is a player:
        while victim's world is "PvP":
            wait 2 ticks
            set {_i} to a random integer between 1 and 4
            drop {_i} of emeralds
Add droping items will be where is.
drop {_i} of emeralds at (attacker or victim)’s location
[doublepost=1563807107,1563807007][/doublepost]
Add droping items will be where is.
drop {_i} of emeralds at (attacker or victim)’s location
It may need Tuske.
 
Status
Not open for further replies.