Solved Removing death history

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

iStopcontact

Member
Feb 18, 2017
115
2
18
I am working on my own gamemode for my network and i have a bugg:

When a player kills a other player he get coins and the player that died loses coins.

I also have in my skript that when a player walks into the water he dies:
code_language.skript:
on walk on water:
    kill player

Now i have the bugg that when a player walks into the water, the sever says "You are killed by {player}" instead of just nothing.

Example:
A player gets killed by a player named: Test123
He respawns walks into the water and it again says the player got killed by Test123

Is it maybe possible that when a player dies and he respawns, i can skript that he has a clear history about who hit him the last time.

This is my skript for when player dies:
code_language.skript:
on death:
    attacker is a player
    victim is player
    add 1 to {gungame:kills:%attacker%}
    add 1 to {gungame:killstreak:%attacker%}
    execute console command "/gglvl %attacker%"
    add 5 to {gungame:coins:%attacker%}
    remove 2 from {gungame:coins:%victim%}
    send "{@GG} &7You have been killed by &e%attacker% &8[&c-2 coins&8]" to victim
    send "{@GG} &7you have killed &e%victim% &8[&a+5 coins&8]" to attacker
    if {gungame:coins:%victim%} is less than 0:
        set {gungame:coins:%victim%} to 0
 
Can't properly test since I have no other players to test with right now.

code_language.skript:
on step on water:
    set {killedbyother.%player's uuid%} to true
    kill player

on respawn:
    delete {killedbyother.%player's uuid%}
 
on death of player:
    attacker is player
    if {killedbyother.%player's uuid%} is set:
        if {killedbyother.%player's uuid%} = true:
            stop
    else:
        #you were killed by a player


I think you should post in https://github.com/bensku/Skript/issues about this bug though.
 
Yhea ty that worked @Remixful but is it possible to get it count when a player get hits by other player into the water bcs now it also doesnt count when player gets hit by other player
 
Yhea ty that worked @Remixful but is it possible to get it count when a player get hits by other player into the water bcs now it also doesnt count when player gets hit by other player
Try switching it up.
code_language.skript:
on death of player:
    if {killedbyother.%player's uuid%} is set:
        if {killedbyother.%player's uuid%} = true:
            stop
    else if attacker is player:
        #you were killed by a player
So no matter what, death by water or whatever else, will take priority.
Also make sure to use
code_language.skript:
delete {killedbyother.%player's uuid%}
Whenever you don't need it, such as in the player quit event and stuff.
 
Status
Not open for further replies.