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

[REQ] No Knife


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
diogoper
Member
Join Date: Jan 2012
Old 05-27-2012 , 11:30   [REQ] No Knife
Reply With Quote #1

Can anyone change this code so that the hitting enemy sound do NOT play when attack with the knife?
I mean, if you attack with guns or nades play the hitting enemy sound, but if attack with knife, don't play the sound. (I hope I have been clear.)

Here is the code:
PHP Code:
/*  
*    AMX Mod X script.  
*     
*   Plugin : Quake like  
*  
*       by DanRaZor  
*  
* Just remember Quake III Arena ...  
*  
* New Cvar : amx_q3_mode = "abcde" (default)  
*  
*    a : emit sound when enemy damaged  
*    b : emit sound when teammate damaged  
*    c : sound at start of round  
*    d : emit sound when entering game  
*    e : emit sound when disconnecting  
*  
* Originals Wavs From the Game. Just Boosted in volume.  
*/   

#include <amxmodx>  

new amx_q3_modeg_mode 

public plugin_precache() {  
    
precache_sound"q3/ric2.wav" )  
    
precache_sound"q3/hks2.wav" )  
    
precache_sound"q3/prepare.wav" )  
    
precache_sound"q3/enter.wav" )  
    
precache_sound"q3/leave.wav" )  
}   

public 
plugin_init() {  
    
register_plugin ("Quake like""1.3""DanRaZor")  

    
amx_q3_mode register_cvar("amx_q3_mode" ,"abcde"

    
register_event("Damage" ,"eDamage" "b""2!0""3=0""4!0"
    
register_event("HLTV""eNewRound""a""1=0""2=0"


public 
plugin_cfg() { 
    
g_mode readSettings() 


readSettings() {  
    static 
flags[12]  
    
get_pcvar_string(amx_q3_modeflags11)  
    return 
read_flagsflags )  
}  

public 
client_putinserver(id) {  
    if ( 
g_mode ) {  
        
set_task 2.0 "enterMsg" id)  
    }  
}  

public 
enterMsg (id) { 
    
client_cmdid "spk q3/enter" )  


public 
client_disconnect(id) {  
    if ( 
g_mode 16)  
        
client_cmd(0,"spk q3/leave")   
}  

public 
eNewRound ( ) { 
    
g_mode readSettings() 
    if ( 
g_mode )     
        
client_cmd(0,"spk q3/prepare")  
}  

public 
eDamagevictim ) {  
    new 
crap,  attacker get_user_attacker(victimcrapcrap)  
    if(!
is_user_connected(attacker) || !is_user_connected(victim)) return  
    new 
teamA get_user_team attacker )  
    new 
teamV get_user_team victim )  
    if ( 
teamV == teamA ) {  
        if ( 
g_mode )  
            
client_cmd(attacker,"spk q3/hks2")  
    }  
    else if ( 
g_mode )  
        
client_cmd(attacker,"spk q3/ric2")  

Thank you in advance.
diogoper is offline
Santaaa
BANNED
Join Date: May 2012
Old 05-28-2012 , 05:06   Re: [REQ] No Knife
Reply With Quote #2

Why you dont just strip all the users?
Santaaa is offline
GordonFreeman (RU)
Veteran Member
Join Date: Jan 2010
Location: Uzbekistan
Old 05-28-2012 , 05:25   Re: [REQ] No Knife
Reply With Quote #3

Quote:
Originally Posted by Santaaa View Post
Why you dont just strip all the users?
are you kidding?

diogger:
Code:
/*    *    AMX Mod X script.    *      *   Plugin : Quake like    *    *       by DanRaZor    *    * Just remember Quake III Arena ...    *    * New Cvar : amx_q3_mode = "abcde" (default)    *    *    a : emit sound when enemy damaged    *    b : emit sound when teammate damaged    *    c : sound at start of round    *    d : emit sound when entering game    *    e : emit sound when disconnecting    *    * Originals Wavs From the Game. Just Boosted in volume.    */    #include <amxmodx>    new amx_q3_mode, g_mode  public plugin_precache() {        precache_sound( "q3/ric2.wav" )        precache_sound( "q3/hks2.wav" )        precache_sound( "q3/prepare.wav" )        precache_sound( "q3/enter.wav" )        precache_sound( "q3/leave.wav" )    }    public plugin_init() {        register_plugin ("Quake like", "1.3", "DanRaZor")            amx_q3_mode = register_cvar("amx_q3_mode" ,"abcde")          register_event("Damage" ,"eDamage" , "b", "2!0", "3=0", "4!0")      register_event("HLTV", "eNewRound", "a", "1=0", "2=0")  }  public plugin_cfg() {      g_mode = readSettings()  }  readSettings() {        static flags[12]        get_pcvar_string(amx_q3_mode, flags, 11)        return read_flags( flags )    }    public client_putinserver(id) {        if ( g_mode & 8 ) {            set_task ( 2.0 , "enterMsg" , id)        }    }    public enterMsg (id) {      client_cmd( id , "spk q3/enter" )    }  public client_disconnect(id) {        if ( g_mode & 16)            client_cmd(0,"spk q3/leave")    }    public eNewRound ( ) {      g_mode = readSettings()      if ( g_mode & 4 )              client_cmd(0,"spk q3/prepare")    }    public eDamage( victim ) {        new wid,bh     get_user_attacker(victim,wid,bh)         if(wid==CSW_KNIFE)         return PLUGIN_CONTINUE         new crap,  attacker = get_user_attacker(victim, crap, crap)        if(!is_user_connected(attacker) || !is_user_connected(victim)) return        new teamA = get_user_team ( attacker )        new teamV = get_user_team ( victim )        if ( teamV == teamA ) {            if ( g_mode & 2 )                client_cmd(attacker,"spk q3/hks2")        }        else if ( g_mode & 1 )            client_cmd(attacker,"spk q3/ric2")             return PLUGIN_CONTINUE }
__________________
The functional way is the right way

Last edited by GordonFreeman (RU); 05-28-2012 at 05:26.
GordonFreeman (RU) is offline
Santaaa
BANNED
Join Date: May 2012
Old 05-28-2012 , 06:06   Re: [REQ] No Knife
Reply With Quote #4

Oops, didnt read his reply. Just looked to the title :p
Santaaa is offline
diogoper
Member
Join Date: Jan 2012
Old 05-28-2012 , 08:14   Re: [Solved] No Knife
Reply With Quote #5

@GordonFreeman (RU)

Thank you very much!
Going to test it!

[EDIT]

It has some errors in compiling, but i changed this:

PHP Code:
public eDamagevictim ) {   
    new 
wid,bh
    get_user_attacker
(victim,wid,bh)
    
    if(
wid==CSW_KNIFE)
        return 
PLUGIN_CONTINUE
    
    
new crap,  attacker get_user_attacker(victimcrapcrap)   
    if(!
is_user_connected(attacker) || !is_user_connected(victim)) return   
    new 
teamA get_user_team attacker )   
    new 
teamV get_user_team victim )   
    if ( 
teamV == teamA ) {   
        if ( 
g_mode )   
            
client_cmd(attacker,"spk q3/hks2")   
    }   
    else if ( 
g_mode )   
        
client_cmd(attacker,"spk q3/ric2")
        
    return 
PLUGIN_CONTINUE

To this...

PHP Code:
public eDamagevictim ) {
    new 
widbh   
    get_user_attacker
(victim,wid,bh)
    
    if(
wid!=CSW_KNIFE){
    new 
crap,  attacker get_user_attacker(victimcrapcrap)   
    if(!
is_user_connected(attacker) || !is_user_connected(victim)) return   
    new 
teamA get_user_team attacker )   
    new 
teamV get_user_team victim )   
    if ( 
teamV == teamA ) {   
        if ( 
g_mode )   
            
client_cmd(attacker,"spk q3/hks2")   
    }   
    else if ( 
g_mode )   
        
client_cmd(attacker,"spk q3/ric2")   
    }

Now works fine!
Thank you!

Last edited by diogoper; 05-28-2012 at 08:48.
diogoper 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 11:17.


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