# [Requesting Help]Death Penalty

Discussion in 'Skript' started by Dwaynedee, May 16, 2018.

1. ### Dwaynedee

Hello friends, i started skripting a month ago and i am still unfamiliar with it, but anyh0, i need a death penalty skript that bypass gamerule keepInventory. The idea is to have players lose levels as the penalty instead of losing all items and exp etc. so when a player die, it add 1 to his deathcount, the higher the deathcount, the heavier the penalty is. This skript does not work for me so far, any pros here willing to give this junior some tips?

Code (Text):
variables:
{_deathcount} = 0

at 06:00:
set {_deathcount} to 0

on death of player:
add 1 to {_deathcount}
if {deathcount} is 1:
reduce the victim's level by 20
else if {_deathcount} is 2:
reduce the victim's level by 25
else if {_deathcount} is 3:
reduce the victim's level by 30
else if {_deathcount} is 4:
reduce the victim's level by 40
else if {_deathcount} is 5:
reduce the victim's level by 50
else if {_deathcount} is 6:
reduce the victim's level by 60
else if {_deathcount} is 7:
reduce the victim's level by 70
else if {_deathcount} is 9:
reduce the victim's level by 80
else if {_deathcount} is 9:
reduce the victim's level by 90
else if {_deathcount} is 10:
reduce the victim's level by 100
else if {_deathcount} > 10 :
set the player's level to 0

2. ### _Donut_

variables starting with _ are local and theyre deleted after the event/command theyre used in.
Code (SKRIPT):
on death of player:
add 1 to {deathcount::%victim%}
if {deathcount::%victim%} > 10:
set player's level to 0
else:
reduce victim's level by {deathcount::%victim%} * 10

at 06:00: #is this actually an event?
clear {deathcount::*}

3. ### Dwaynedee

hey donut, sorry i left out one little detail, i wanted the deathcount to reset itself at dawn everyday so i set it to 0 at 0600. I have afew questions;

1) is declaring the variable: {deathcount} = 0 neccessary?
2)what does the ::&victim& or ::* mean?

i kinda have a vague idea but its better if i clarify. Thanks for helping me out!

4. ### Govindas

%victim% is the name of victim, required so it saves death count to the victim's name so not everyone has the same death count
:: variables are list variables, so {deathcount::*} means all of the variables in the list, if you delete {deathcount::*} it deletes deathcount of all players

5. ### Dwaynedee

That answers all my questions. Thanks for the help senior!

• Like x 1