Solved Cancel death

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

    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.

Hobbit41

Member
Jun 15, 2017
32
0
0
Minecraft version: 1.8

Hey guys, I have problem with cancel death event.

code_language.skript:
on damage of player:
    if damage > victim's health:
        set victim's gamemode to spectator

#also tried:
if (victim's health - damage) < 0.1:
 #do stuff

Everything's okay when player kills player: death is being prevented and all's good.
But when damage cause is i.e. fall or tnt explode, player dies anyway and gets a Death Screen and after respawn his gamemode is spectator
How do I fix it?
 
Minecraft version: 1.8

Hey guys, I have problem with cancel death event.

code_language.skript:
on damage of player:
    if damage > victim's health:
        set victim's gamemode to spectator

#also tried:
if (victim's health - damage) < 0.1:
 #do stuff

Everything's okay when player kills player: death is being prevented and all's good.
But when damage cause is i.e. fall or tnt explode, player dies anyway and gets a Death Screen and after respawn his gamemode is spectator
How do I fix it?
Actually cancelling the event should fix it
code_language.skript:
on damage of player:
    if damage > victim's health:
        cancel event
        set victim's gamemode to spectator
 
Actually cancelling the event should fix it
code_language.skript:
on damage of player:
    if damage > victim's health:
        cancel event
        set victim's gamemode to spectator
shame on me that I did not tried It. Thank you

But actually it works only with "if (victim's health - damage) < 0.1:", not with "damage > victim's health"
 
Status
Not open for further replies.