AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   no pickup sound (https://forums.alliedmods.net/showthread.php?t=74628)

Alucard^ 07-22-2008 07:46

no pickup sound
 
hi guys, i am trying to do a "no pickup sound" when u pickup a weapon... i used all code of SchlumPF* plugin .. (weapon utilitys) but the plugin dont work :S

PHP Code:

/* Script generated by Pawn Studio */

#include <amxmodx>
#include <fakemeta>

#define PLUGIN    "New Plugin"
#define AUTHOR    "Unknown"
#define VERSION    "1.0"

new g_iBlockSound[33];

new 
g_iCvar[1];

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
g_iCvar[0] = register_cvar"weapons_blocksound""1" );
    
    
register_forwardFM_EmitSound"fwdEmitSound" );
}

public 
fwdEmitSoundplrchannel, const sound[] )
{        
    if( 
equalisound"items/gunpickup2.wav" ) )
    {
        if( 
get_pcvar_numg_iCvar[0] ) && g_iBlockSound[plr] )
        {
            
g_iBlockSound[plr]--;
            return 
FMRES_SUPERCEDE;
        }
        
        if( 
get_pcvar_numg_iCvar[0] ) == )
            return 
FMRES_SUPERCEDE;
    }
    
    return 
FMRES_IGNORED;
}

public 
client_connectplr )
{
    
g_iBlockSound[plr] = 0;


what is wrong in the code?

SchlumPF* 07-22-2008 09:32

Re: no pickup sound
 
i just use the variable g_iBlockSound to block the pickupsound just when somebody is using the /weapons cmd in my plugin which increases the value by one for each weapon the palyer gets. in fwdEmitSound() it checks whether the sound should be blocked or not.
any way this shoudl work for you:
PHP Code:

#include <amxmodx>
#include <fakemeta>

#pragma semicolon 1

#define PLUGIN "Block Weaponpickup Sound"
#define AUTHOR "SchlumPF"
#define VERSION "1.0"

new g_iCvar;

public 
plugin_init( )
{
    
register_pluginPLUGINVERSIONAUTHOR );
    
g_iCvar register_cvar"weaponpickup_sound""1" );
    
register_forwardFM_EmitSound"fwdEmitSound_Pre");
}

public 
fwdEmitSound_Preplrchannel, const sound[] )
{        
    if( 
equalsound"items/gunpickup2.wav" ) )
    {
        if( 
get_pcvar_numg_iCvar ) )
        {
            return 
FMRES_SUPERCEDE;
        }
    }
    
    return 
FMRES_IGNORED;



Arkshine 07-22-2008 09:41

Re: no pickup sound
 
- equal would be enough
- Array for cvar is totaly useless here.

^^

SchlumPF* 07-22-2008 13:12

Re: no pickup sound
 
i know but i was to lazy to edit it ^^ i used a array in weapon_utility cuz i have about 3 cvars in it
+ is there any difference in cpu usage between equal and equali? usually i use equali even if equal woudl be enough

Alucard^ 07-23-2008 00:57

Re: no pickup sound
 
oh, thx SchlumPF* & arkshine...

here a question..

Quote:

register_forward( FM_EmitSound, "fwdEmitSound_Pre", 0 );
where can i learn more about register_forward? tutorials or something?... becouse i dont have any idea of what is this..

i tried to search FM_EmitSound in functions (web amxmodx) and nothing... only the engine version EF_EmitSound ... all of these function i can see in the fakemeta utilitys by alka?

{PHILMAGROIN} 07-23-2008 01:40

Re: no pickup sound
 
Quote:

Originally Posted by Alucard^ (Post 656986)
oh, thx SchlumPF* & arkshine...

here a question..

where can i learn more about register_forward? tutorials or something?... becouse i dont have any idea of what is this..

http://www.amxmodx.org/funcwiki.php?go=func&id=615

Alucard^ 07-23-2008 04:27

Re: no pickup sound
 
thx philmagroin, and where can i get a list of forwardTypes?

Arkshine 07-23-2008 04:31

Re: no pickup sound
 
includes/fakemeta_const.inc

Alucard^ 07-25-2008 00:10

Re: no pickup sound
 
thx to much arkshine, and..

haha sry for a lot of question... but, i think this is the last question..

Quote:

"fwdEmitSound_Pre"
the cellback, where can i see a list of this? or, what is this?

Arkshine 07-25-2008 01:01

Re: no pickup sound
 
'cellback' ? What's this ?


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

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