export default function weapondamageUtil() {

    mp.players.local.setSuffersCriticalHits(false);

    mp.players.forEachInStreamRange((player) => {
        player.setSuffersCriticalHits(false);
    });

    mp.events.add('SERVER:WeaponModifier', (player) => {
        //mp.gui.chat.push("Modifier steht jetzt auf" + modifier);
        //mp.players.local.setWeaponDamageModifier(modifier);
        let modifier = 1;
        let meelemodifier = 1;

        switch (player.weapon) {
            case 0x1B06D571: //Pistol
                modifier = 0.4;
                meelemodifier = 1;
                //mp.gui.chat.push("PistolModifier: " + modifier);
                break;
            case 0xBFE256D4: //Pistol_MK2
                modifier = 0.4;
                meelemodifier = 1;
                break;
            case 0x5EF9FEC4: //Combatpistol
                modifier = 0.5;
                meelemodifier = 1;
                break;
            case 0x99AEEB3B: //Pistol50
                modifier = 0.35;
                meelemodifier = 1;
                break;
            case 0x2BE6766B: //SMG
                modifier = 0.25;
                meelemodifier = 1;
                break;
            case 0x1D073A89: //Pumpshotgun
                modifier = 0.2;
                meelemodifier = 1;
                break;
            case 0x83BF0278: //Cabinerifle
                modifier = 0.2;
                meelemodifier = 1;
                break;
            case 0x624FE830: //Compactrifle
                modifier = 0.2;
                meelemodifier = 0.1;
                break;
            case 0x05FC3C11: //Sniperrifle
                modifier = 0.5;
                meelemodifier = 1;
                break;
            case 0xA2719263: //Meele Umarmed Fist
                meelemodifier = 0.1;
                modifier = 1;
                //mp.gui.chat.push("FistModifier: " + meelemodifier);
                break;
            case 0x958A4A8F: //Meele Baseball Bat
                meelemodifier = 0.15;
                modifier = 1;
                break;
            case 0x8BB05FD7: //Meele Flashlight
                meelemodifier = 0.1;
                modifier = 1;
                break;
            case 0xD8DF3C3C: //Meele Knuckle
                meelemodifier = 0.1;
                modifier = 1;
                //mp.gui.chat.push("KnuckleModifier: " + meelemodifier);
                break;
            case 0x678B81B1: //Meele Nightstick
                meelemodifier = 0.1;
                modifier = 1;
                break;
            default:
                modifier = 1;
                meelemodifier = 1;
                break;
        }
        mp.game.invoke("0xCE07B9F7817AADA3", player, modifier);
        mp.game.invoke("0x4A3DC7ECCC321032", player, meelemodifier);
        //mp.gui.chat.push("Modifier: " + modifier + "MeeleModifier: " +meelemodifier);
    });
    mp.events.add('SERVER:WeaponModifier2', (player, modifier, meelemodifier) => {
        //mp.gui.chat.push("Modifier steht jetzt auf" + modifier);
        //mp.players.local.setWeaponDamageModifier(modifier);
        mp.game.invoke("0xCE07B9F7817AADA3", player, modifier);
        mp.game.invoke("0x4A3DC7ECCC321032", player, meelemodifier);
        //mp.gui.chat.push("Modifier: " + modifier + "MeeleModifier: " + meelemodifier);
    });

    mp.events.add("entityStreamIn", (entity) => {
        if (entity.type === "player") {
            entity.setSuffersCriticalHits(false);
        }
    });


    /*mp.events.add('playerWeaponShot', (targetPosition, targetEntity) => {
for (var x in this.weaponAmmo) {
    if (this.weaponAmmo[x].id != this.currentWeapon) {
        continue;
    }
    this.weaponAmmo[x].ammo = this.weaponAmmo[x].ammo - 1;
}*/
}