#bounty sistem

1 messages ยท Page 1 of 1 (latest)

tidal sand
#

.

#
console.warn('main.js funza')

import { world, system } from "@minecraft/server"

world.afterEvents.entityDie.subscribe(data => {
    let victim = data.deadEntity;
    let killer = data.damageSource?.damagingEntity;

    if (killer?.typeId !== "minecraft:player") {
        return;
    }

    if (killer?.typeId == "minecraft:player" && victim?.typeId == "minecraft:player") {

        const effects = ["strength", "regeneration"];

        const effectRNG = effects[Math.floor(Math.random() * effects.length)];

    killer.runCommandAsync(`effect @s ${effectRNG} 11 5`);
    killer.runCommandAsync(`scoreboard players add @s money 1`);

killer.runCommandAsync(`scoreboard players add @s bounty 10`);

// Victim actions
    victim.runCommandAsync(`scoreboard players remove @s money 10`);
    victim.runCommandAsync(`scoreboard players set @s bounty 0`);

    }

});
#

But i dont know how to give the money at the same amount as the bounty of the victim(at the killer)

#

it's possible to do it?

hardy jetty
#

hm

tidal sand
#

Hm

hardy jetty
#

one moment please

tidal sand
#

Of course

#

Hm

tidal sand
#

Hhmm

#

Can you do it or have you given up?

hardy jetty
#

Yeah... I don't know how to use the scoreboard, But at least I changed some things.

console.warn('main.js funza')

import { world, system } from "@minecraft/server"

world.afterEvents.entityDie.subscribe(data => {
    let victim = data.deadEntity;
    let killer = data.damageSource?.damagingEntity;
    
    if (killer?.typeId !== "minecraft:player" || victim?.typeId !== "minecraft:player") return;
    
    const effects = ["strength", "regeneration"];
    const effect = effects[Math.floor(Math.random() * effects.length)];
    killer.addEffect(effect, 220, { amplifier: 5 });
    
    killer.runCommandAsync(`scoreboard players add @s money 1`);
    victim.runCommandAsync(`scoreboard players remove @s money 10`);
    victim.runCommandAsync(`scoreboard players set @s bounty 0`);
});

I hope someone can help you

tidal sand
#

Thanks anyway

#

not resolved

tired bridge
#

No

faint star
#

how to make every one ignore your post bao_act_upvote

hardy jetty
faint star
#

@tidal sand sorry about that
do you still need help?

tidal sand
#

nop

#

I've already solved it and I'm the one who has to apologize