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

Add sound to this knife kill script


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ssproxima
Senior Member
Join Date: Jan 2015
Old 05-21-2017 , 11:47   Add sound to this knife kill script
Reply With Quote #1

Please add a sound command to this code so that it will be played whenever some one is knifed.
The format should support a ".mp3" file. Thanks

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <fun>

#define PLUGIN "Knife Kill Bonuses"
#define VERSION "1.0"
#define AUTHOR "Flicker"

const TASK_ID 6969

const Float:FAST_SPEED 330.0 //Your speed bonus


new g_iSync
new bool:g_bHasSpeed[33]

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_event("DeathMsg""onDeathMsgEvent""a")
    
register_event("CurWeapon""onCurWeaponEvent""be""1=1")
    
    
g_iSync CreateHudSyncObj()
}


public 
onDeathMsgEvent()
{
    new 
id read_data(1)
    
    new 
szWeapon[32]
    
read_data(4szWeaponcharsmax(szWeapon))
    
    if(
equal(szWeapon"knife") && is_user_alive(id))
    {
        new 
szName[32], szName2[32]
        
get_user_name(idszNamecharsmax(szName))
        
get_user_name(read_data(2), szName2charsmax(szName2))
        
        
set_hudmessage(255000.020.210.16.00.10.1, -1)
        
ShowSyncHudMsg(0g_iSync"Player %s knifed %s"szNameszName2)
                
        
set_user_health(idget_user_healthid ) + )
        
g_bHasSpeed[id] = true
        remove_task
(id TASK_ID)
        
set_task(10.0"taskRemoveSpeed"id TASK_ID)
        
set_user_maxspeed(idFAST_SPEED)
        
set_user_fragsidget_user_fragsid ) + )
    }
}

public 
onCurWeaponEvent(id)
    if(
g_bHasSpeed[id])
        
set_user_maxspeed(idFAST_SPEED)

public 
taskRemoveSpeed(id)
{
    
id -= TASK_ID
    g_bHasSpeed
[id] = false
    set_user_maxspeed
(id241.0)


Last edited by ssproxima; 05-21-2017 at 12:04.
ssproxima is offline
tarsisd2
Veteran Member
Join Date: Feb 2016
Location: brazil
Old 05-21-2017 , 13:11   Re: Add sound to this knife kill script
Reply With Quote #2

you can just add

PHP Code:
new const g_szSound[] = "knifee.mp3"
then at the action

PHP Code:
client_cmd(0"spk ^"sound/%s^""g_szSound); 

but if you use event sounds it will play normally at knife kills, dont need to add on this plugin

edit: forgot to add precache

PHP Code:
public plugin_precache()
{
    
precache_genericg_szSound )


Last edited by tarsisd2; 05-21-2017 at 15:59. Reason: precache
tarsisd2 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 19:16.


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