Raised This Month: $51 Target: $400
 12% 

When someone get kill by knife . Play a troll sound


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Runjaun
Junior Member
Join Date: Apr 2013
Old 10-08-2014 , 06:20   When someone get kill by knife . Play a troll sound
Reply With Quote #1

When someone get kill by knife . Play a troll sound
Runjaun is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 10-08-2014 , 06:41   Re: When someone get kill by knife . Play a troll sound
Reply With Quote #2

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.

;)
Attached Files
File Type: sma Get Plugin or Get Source (custom_sound.sma - 607 views - 652 Bytes)

Last edited by zmd94; 10-10-2014 at 02:57.
zmd94 is offline
Krtola
Veteran Member
Join Date: Oct 2013
Location: Serbia
Old 10-08-2014 , 17:53   Re: When someone get kill by knife . Play a troll sound
Reply With Quote #3

will be tested (I also thinking about this)
Krtola is offline
Send a message via Skype™ to Krtola
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 10-08-2014 , 19:56   Re: When someone get kill by knife . Play a troll sound
Reply With Quote #4

Feel free to inform me the output. ;)
zmd94 is offline
Runjaun
Junior Member
Join Date: Apr 2013
Old 10-09-2014 , 22:39   Re: When someone get kill by knife . Play a troll sound
Reply With Quote #5

When i cut someone .. it is not playing sound .. but people was downloading the sound and didn't play
Runjaun is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 10-09-2014 , 23:11   Re: When someone get kill by knife . Play a troll sound
Reply With Quote #6

Runjaun, do you get any errors?

And what type of sound that you use (.wav/ .mp3)?
zmd94 is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 10-10-2014 , 00:46   Re: When someone get kill by knife . Play a troll sound
Reply With Quote #7

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).
__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 10-10-2014 , 02:11   Re: When someone get kill by knife . Play a troll sound
Reply With Quote #8

You are right, Flick3rR. I appreciate your help. ;)

By the way, I have updated the code.
zmd94 is offline
yokomo
Surprise Ascot!
Join Date: May 2010
Location: Malaysia
Old 10-10-2014 , 02:33   Re: When someone get kill by knife . Play a troll sound
Reply With Quote #9

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)

__________________
Team-MMG CS1.6 Servers:
✅ MultiMod -- 103.179.44.152:27016
✅ Zombie Plague -- 103.179.44.152:27015
✅ Zombie Escape -- 103.179.44.152:27017
✅ Klassik Kombat -- 103.179.44.152:27018
✅ Boss-Battle -- 103.179.44.152:27019
yokomo is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 10-10-2014 , 03:02   Re: When someone get kill by knife . Play a troll sound
Reply With Quote #10

By the way, which one is more efficient? Whether to use Ham_Killed or DeathMsg?

;)
zmd94 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:35.


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