AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Twice in use and emite sound (https://forums.alliedmods.net/showthread.php?t=133835)

mati009988 07-29-2010 06:43

Twice in use and emite sound
 
Hello,
I would like that when you double-press in_use executes function.
I try
PHP Code:

new button get_uc(uc_handleUC_Buttons);
new 
oldbutton get_user_oldbutton(id);

if((
button IN_USE) && (oldbutton IN_USE)){
    
/**** CODE ****/


but it does not work.

------------------------------------------------------------------

PHP Code:

public EmitSound(idiChannelszSound[], Float:fVolFloat:fAttniFlagsiPitch 
{
    if(
equal(szSound"common/wpn_denyselect.wav"))
    {
        
/*** CODE ***/
    
}
    
    return 
FMRES_IGNORED;


What sound is emitted when:
disarms a bomb
planting a bomb
rescue a hostage

Gadzislaw007 07-29-2010 06:58

Re: Twice in use and emite sound
 
PHP Code:

// global
new clicked[33]
//init
register_clcmd("use""cmd_use"); // when click "use" go to cmd_use

//public
public cmd_use(id)
{
if(
clicked[id]) // if user press use before
{
clicked[id] = // reset double press
////HERE CODE when user presses "use" twice time in with max 1 second delay
}
else
{
clicked[id] = // he pressed! we noticed it!
set_task(1.0"reset_click"id// times up for second press
}
}

public 
reset_click(id)
           
clicked[id] = // 


mati009988 07-29-2010 11:42

Re: Twice in use and emite sound
 
Thank you. Yet only the second.


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

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