AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   When someone get kill by knife . Play a troll sound (https://forums.alliedmods.net/showthread.php?t=249582)

Runjaun 10-08-2014 06:20

When someone get kill by knife . Play a troll sound
 
When someone get kill by knife . Play a troll sound

zmd94 10-08-2014 06:41

Re: When someone get kill by knife . Play a troll sound
 
1 Attachment(s)
New update based on Flick3rR suggestion!

Feel free to test it again. ;)
PHP Code:

#include <amxmodx>

#define CustomSound "misc/YourSoundName.wav"

public plugin_init()
{
    
register_plugin("Custom Sound""1.0""zmd94")
    
    
register_event("DeathMsg""event_DeathMsg""a""1>0")
}

public 
plugin_precache() 
{
    
precache_sound(CustomSound)
}

public 
event_DeathMsg()
{
    static 
iKilleriKiller read_data(1)
    static 
iVictimiVictim read_data(2)
    
    if(!
is_user_alive(iKiller) && iVictim == iKiller)
        return 
PLUGIN_CONTINUE
    
    
new iWeapon[32]
    
read_data4iWeaponcharsmax(iWeapon))
    
    if(
equali(iWeapon"knife"))
    {
        
client_cmd(iVictim"spk %s"CustomSound)
    }
    
    return 
PLUGIN_CONTINUE


Just change the "YourSoundName.wav" with your sound. Then, put the sound in the misc folder.

;)

Krtola 10-08-2014 17:53

Re: When someone get kill by knife . Play a troll sound
 
will be tested :) (I also thinking about this)

zmd94 10-08-2014 19:56

Re: When someone get kill by knife . Play a troll sound
 
Feel free to inform me the output. ;)

Runjaun 10-09-2014 22:39

Re: When someone get kill by knife . Play a troll sound
 
When i cut someone .. it is not playing sound .. but people was downloading the sound and didn't play

zmd94 10-09-2014 23:11

Re: When someone get kill by knife . Play a troll sound
 
Runjaun, do you get any errors?

And what type of sound that you use (.wav/ .mp3)?

Flick3rR 10-10-2014 00:46

Re: When someone get kill by knife . Play a troll sound
 
Better use DeathMsg and read_data(4, sz, charsmax(sz)), because in that way, the grenade kill will also play the sound if the killer has switched to knife. Also, you better put that *.wav to misc folder (where it should be).

zmd94 10-10-2014 02:11

Re: When someone get kill by knife . Play a troll sound
 
You are right, Flick3rR. I appreciate your help. ;)

By the way, I have updated the code.

yokomo 10-10-2014 02:33

Re: When someone get kill by knife . Play a troll sound
 
Hamsandwich method:
PHP Code:

#include <amxmodx>
#include <hamsandwich>

//#define USE_NEW_AMX_183
#define SoundTroll "misc/trollsound.wav"

public plugin_precache()
{
    
precache_sound(SoundTroll)
}

public 
plugin_init()
{
    
register_plugin("Knife Kill Vox""0.0.1""wbyokomo")
    
    
#if defined USE_NEW_AMX_183
    
RegisterHam(Ham_Killed"player""OnPlayerKilled"0true//CSBot support
    #else
    
RegisterHam(Ham_Killed"player""OnPlayerKilled")
    
#endif
}

public 
OnPlayerKilled(victimattacker)
{
    if(!
is_user_connected(attacker)) return;
    if(
get_user_weapon(attacker) != CSW_KNIFE) return;
    
    
client_cmd(victim"spk %s"SoundTroll)



zmd94 10-10-2014 03:02

Re: When someone get kill by knife . Play a troll sound
 
By the way, which one is more efficient? Whether to use Ham_Killed or DeathMsg?

;)


All times are GMT -4. The time now is 04:07.

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