• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sound on death
#1
Hey

i have added a Headshot and Nutshot message based on Hitlocations but it would be nice to have also a sound.

i tried with -->  PlaySoundOnPlayer(Client, "mp_killconfirm_tags_pickup");

But nothing happens. Huh

wtf i'm doing wrong? Any help would be very nice.




Code:
using System;
using System.Collections.Generic;
using Addon;

namespace HeadshotSound
{
    public class Main : CPlugin
    {
       
        public override int OnPlayerDamaged(ServerClient attacker, ServerClient victim, string weapon, int damage, string damageMod, HitLocations hitLocation)
        {
            if (damage >= victim.Other.Health && attacker != victim && victim.XUID != attacker.XUID)
            {
                if (hitLocation == HitLocations.Head)
                {
                    PlaySoundOnPlayer(attacker, "mp_killconfirm_tags_pickup");
                   
                }
            }

            return base.OnPlayerDamaged(attacker, victim, weapon, damage, damageMod, hitLocation);
        }
    }
}
  Reply
#2
Sry double posting. 🙈

I found the fail (thanks to Weißbier for helping).

I have created two dll. one for headshot, one for the sound. Thats not working. 

If some one is interested in the working code:

Source:

Code:
using Addon;

namespace Headshot
{
    public class Main : CPlugin
    {
        public override int OnPlayerDamaged(ServerClient attacker, ServerClient victim, string weapon, int damage, string damageMod, HitLocations hitLocation)
        {
            if (damage >= victim.Other.Health && attacker != victim && victim.XUID != attacker.XUID)
            {
                if (hitLocation == HitLocations.Head)
                {
                    iPrintLnBold("^5Your Message!!!!", attacker);
                    PlaySoundOnPlayer(attacker, "mp_killconfirm_tags_pickup");
                }
            }

            return base.OnPlayerDamaged(attacker, victim, weapon, damage, damageMod, hitLocation);

        }
    }
}
  Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)