Raised This Month: $ Target: $400
 0% 

add 3 commands on a key


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 12-24-2008 , 22:20   add 3 commands on a key
Reply With Quote #1

Hey,

i have to add a .wav file to a plugin , on the attack2 key,but this key are used for another things. by click on attack2 a hudmessage willbe show & another command. now i dont know how can i add to this key a .wav file

can anyone help me? i fund nothin in tuts

thanks
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 12-25-2008 , 06:27   Re: add 3 commands on a key
Reply With Quote #2

Do you mean something like this?
Code:
#include <fakemeta> public plugin_init() { //    [...]     register_forward( FM_CmdStart, "Forward_CmdStart", 1 ); } public Forward_CmdStart( id, uc_handle, seed ) {     static Button ; Button = get_uc( uc_handle, UC_Buttons ); //    or:     static Button ; get_uc( uc_handle, UC_Buttons, Button );         if( ( Button & IN_ATTACK2 ) )     {         // .wav file played.         emit_sound( id, blabla, "sound/something.wav", ... );                 // HUD message.         set_hudmessage();         show_hudmessage( id, "LoL" );                 // Other command.         client_cmd( "blabla" );     } }
__________________
O o
/Ż________________________
| IMMA FIRIN' MAH LAZOR!!!
\_ŻŻŻ
Dores is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 12-25-2008 , 09:57   Re: add 3 commands on a key
Reply With Quote #3

Hey,

Yeah.....Thanks.
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 12-25-2008 , 10:11   Re: add 3 commands on a key
Reply With Quote #4

PHP Code:
            if(buttons&IN_ATTACK2) {
                if(
bad[id-1][0] == && bad[id-1][1] >= BAD_VERBRAUCH)
                
emit_soundid1"sound/something.wav", ... );
                    
bad_on(id)
            }
            else if(
bad[id-1][0] == 1)
                
bad_off(id)
        } 
hmmm? whats wrong here? :-D
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 12-25-2008 , 10:47   Re: add 3 commands on a key
Reply With Quote #5

I didn't actually used the full functions in my code. Those were just examples to give you the idea.
You must use an existing .wav file with emit_sound.
http://www.amxmodx.org/doc/index.htm...emit_sound.htm

You must set arguments in the set_hudmessage() native:
http://www.amxmodx.org/funcwiki.php?...sage&go=search

You must set who to show the message to and what type of a message to show in client_print():
http://www.amxmodx.org/funcwiki.php?...sage&go=search

A more proper way will be something like:
PHP Code:
if(buttons&IN_ATTACK2) {
                if(
bad[id-1][0] == && bad[id-1][1] >= BAD_VERBRAUCH)
                
emit_soundidCHAN_AUTO"sound/something_that_exists.wav"VOL_NORMATTN_NORM0PITCH_NORM );
                    
bad_on(id)
            }
            else if(
bad[id-1][0] == 1)
                
bad_off(id)
        } 
__________________
O o
/Ż________________________
| IMMA FIRIN' MAH LAZOR!!!
\_ŻŻŻ
Dores is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 12-25-2008 , 12:19   Re: add 3 commands on a key
Reply With Quote #6

Hey,

thanks, the hud message & the command are added. i needed just the sound to add.

ill try it .

thanks
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 12-28-2008 , 02:11   Re: add 3 commands on a key
Reply With Quote #7

Hey,

ich tryed to add a sound to this but... :-(

PHP Code:
player_showteam(id) {
    new 
teams[32], turbos[32]
    if(
team[id-1] == 0) {
        
set_hudmessage(OTHER_R,OTHER_G,OTHER_B,0.02,0.25,0,0.1,5.0,0.0,0.0)
        
copy(teams,127,"You are a FLEER..")
        
        if(
turbo[id-1][1] >= TURBO_VERBRAUCH)
            
format(turbos,31,"^n%sTurbo: %d%^nRightMouse to use!",turbo[id-1][0] == ?  "+" "-",turbo[id-1][1] )
    }
    else if(
team[id-1] == 1) {
        
set_hudmessage(FAENGER_R,FAENGER_G,FAENGER_B,0.02,0.25,0,0.1,5.0,0.0,0.0)
        
copy(teams,127,"You have to CATCH,Go ,Go ,Go...")
    }
    
    
show_hudmessage(id,"%s %s",teams,turbos)
    
    if(
boost_show[id-1] == true) {
        
set_hudmessage(OTHER_R,OTHER_G,OTHER_B,-1.0,0.55,0,0.1,5.0,0.0,0.0,1)
        
show_hudmessage(id,"Shoot to boost ^n!")
    } 
the sound should be played by attack2.( TURBO_VERBRAUCH )

i tryed with :
PHP Code:
new g_turbo_sound 
PHP Code:
            g_turbo_sound precache_sound("sound/catchmod/turbo.wav"
but itsnot func. :-( anyone any idea?
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 12-28-2008 , 07:04   Re: add 3 commands on a key
Reply With Quote #8

leave the precache like this
PHP Code:
precache_sound("sound/catchmod/turbo.wav"); 
and add in code
PHP Code:
client_cmd(id"speak ^"sound/catchmod/turbo.wav^" "); 
__________________
xPaw is offline
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 12-28-2008 , 07:16   Re: add 3 commands on a key
Reply With Quote #9

Better yet, create a global constant variable:
PHP Code:
new const g_szSound[] = "sound/catchmod/turbo.wav";

public 
plugin_precache()
{
    
precache_soundg_szSound );
}

// [...]

// Now add this where you want the sound to be played:
emit_soundidCHAN_AUTOg_szSoundVOL_NORMATTN_NORM0PITCH_NORM ); 
__________________
O o
/Ż________________________
| IMMA FIRIN' MAH LAZOR!!!
\_ŻŻŻ
Dores is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 12-28-2008 , 19:46   Re: add 3 commands on a key
Reply With Quote #10

Quote:
Originally Posted by xPaw View Post
leave the precache like this
PHP Code:
precache_sound("sound/catchmod/turbo.wav"); 
and add in code
PHP Code:
client_cmd(id"speak ^"sound/catchmod/turbo.wav^" "); 
This is a bad idea as other clients won't hear it if you run the "speak" command on a single player.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
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 09:05.


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