AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugin/Gameplay Ideas and Requests (https://forums.alliedmods.net/forumdisplay.php?f=60)
-   -   [L4D2]Headshot Sound (https://forums.alliedmods.net/showthread.php?t=248751)

MasterMind420 09-23-2014 08:27

[L4D2]Headshot Sound
 
Looking for a simple plugin to play a sound everytime a headshot is made

DJ Data 09-23-2014 09:02

Re: [L4D2]Headshot Sound
 
What sound? To everyone or to the person who headshots?

MasterMind420 09-23-2014 16:01

Re: [L4D2]Headshot Sound
 
Quote:

Originally Posted by DJ Data (Post 2202689)
What sound? To everyone or to the person who headshots?

just the person who gets the headshot, want players to know they got one, without spamming the chat

DJ Data 09-23-2014 18:30

Re: [L4D2]Headshot Sound
 
Alright, ill see what i can do

MasterMind420 09-23-2014 19:34

Re: [L4D2]Headshot Sound
 
Quote:

Originally Posted by DJ Data (Post 2202889)
Alright, ill see what i can do

thanks appreciate it, I attempted to rip apart event sounds plugin and headshots in a row to figure it out, couldnt imagine it would take much code to do, but alas my coding skills suck so....thanks again.

DeathChaos25 09-24-2014 16:48

Re: [L4D2]Headshot Sound
 
1 Attachment(s)
Quote:

Originally Posted by MasterMind420 (Post 2202909)
thanks appreciate it, I attempted to rip apart event sounds plugin and headshots in a row to figure it out, couldnt imagine it would take much code to do, but alas my coding skills suck so....thanks again.

Well, if you guys don't mind, I just wrote a plugin for MasterMind's request.

Untested, but this should work.

I don't really know if this sound is appropriate for representing a Headshot, but you can easily change within the code.

PHP Code:

#include <sourcemod>
#include <sdktools>

#define SOUND_HEADSHOT        "UI/LittleReward.wav"

public Plugin:myinfo = { 
    
name        "[L4D2] Headshot sounds"
    
author        "DeathChaos25"
    
description    "Players will hear a sound when they perform a Headshot"
    
version        "1.0"
    
url        "https://forums.alliedmods.net/showthread.php?t=248751" 
}

public 
OnPluginStart()
{
    
HookEvent("player_death"PlayerDeath_Event
    
HookEvent("infected_death"InfectedDeath_Event
    
HookEvent("hunter_headshot"HunterHeadshot_Event
}

public 
OnMapStart()
{
    
PrecacheSound(SOUND_HEADSHOT
}
public 
PlayerDeath_Event(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"attacker")) 
    new 
bool:IsHeadshot GetEventBool(event"headshot"
    if (
IsSurvivor(client) && IsHeadshot == true) {
        
PlaySound(clientSOUND_HEADSHOT)
    }
}

public 
InfectedDeath_Event(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"attacker")) 
    new 
bool:IsHeadshot GetEventBool(event"headshot"
    
    if (
IsSurvivor(client) && IsHeadshot == true) {
        
PlaySound(clientSOUND_HEADSHOT)
    }
}

public 
HunterHeadshot_Event(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid")) 
    
    if (
IsSurvivor(client)) {
        
PlaySound(clientSOUND_HEADSHOT)
    }
}

stock bool:IsSurvivor(client)
{
    if (
client && client <= MaxClients && IsClientInGame(client) && GetClientTeam(client) == 2)
    {
        return 
true;
    }
    return 
false;
}

/* Taken from Gear Transfer, credits to SilverShot for that*/
stock PlaySound(client, const String:s_Sound[32]) {
    
EmitSoundToClient(clients_SoundSOUND_FROM_PLAYERSNDCHAN_AUTOSNDLEVEL_NORMALSND_NOFLAGSSNDVOL_NORMALSNDPITCH_NORMAL, -1NULL_VECTORNULL_VECTORtrue0.0


And if it were to be done, spamming the chat shouldn't be too much of a problem as you can print stuff to the chat only for Specific clients, no need for global chat warnings.

MasterMind420 09-24-2014 18:40

Re: [L4D2]Headshot Sound
 
DeathChaos25 your plugin works great, thankyou very much, appreciate it...another request i made awhile ago was for a plugin to force players to thirdperson under certain circumstances, I can discuss this in more detail if your interested in helping out

DeathChaos25 09-24-2014 20:02

Re: [L4D2]Headshot Sound
 
Quote:

Originally Posted by MasterMind420 (Post 2203303)
DeathChaos25 your plugin works great, thankyou very much, appreciate it...another request i made awhile ago was for a plugin to force players to thirdperson under certain circumstances, I can discuss this in more detail if your interested in helping out

Well, I don't really know If I'd be able to help you out, as I'm only just starting out.

If you look at any of my plugins, they all contain very simple and easy to understand code, nothing too fancy or too complicated.

Plus, I'm also currently putting my efforts into a big plugin/personal project that I've been working on for quite a while, over a whole month now at least, something I want to get finished.

Feel free to post your ideas though, if they're simple enough, and it can be done relatively quickly (this plugin took me roughly around 3 to 5 minutes at most), I might be able to do something.

MasterMind420 09-30-2014 15:20

Re: [L4D2]Headshot Sound
 
Im looking for someone to create a plugin that forces a client to thirdperson and auto switch to melee weapon when zombies are within a certain distance from a survivor, obviously with configurable distance, and whether or not a client wants it active specifically. I personally prefer melee in thirdperson...I can create a keybind to switch to thirdperson and melee weapon but having it active within a certain distance would be easier...

kochiurun119 09-30-2014 22:05

Re: [L4D2]Headshot Sound
 
https://forums.alliedmods.net/showthread.php?p=1239957 this is plugin but player join server will see a black screen and not joining. Who can fix bug? Plz :cry:


All times are GMT -4. The time now is 12:24.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.