Raised This Month: $ Target: $400
 0% 

Silent Bomb v1.0


Post New Thread Reply   
 
Thread Tools Display Modes
MmikiM
Senior Member
Join Date: Nov 2006
Location: Poland
Old 06-30-2009 , 15:30   Re: Silent Bomb v1.0
Reply With Quote #11

Code:
[pl]
BOMB_MESSAGE = Bomba zostala podlozona... Ale nie slychac jej!
Polish translate
__________________


Projects:
Zombie Elite - Technical: 100% Looking for models and sounds...
CS:Source Zombie -
Work in progress...
MmikiM is offline
Kukulis :*
Member
Join Date: Apr 2009
Location: www.godlike.lt
Old 07-01-2009 , 03:50   Re: Silent Bomb v1.0
Reply With Quote #12

Lithuanian
Code:
[lt]
BOMB_MESSAGE = Bomba buvo padeta. Bet padeta be jokio garso!
Kukulis :* is offline
Send a message via Skype™ to Kukulis :*
Nextra
Veteran Member
Join Date: Apr 2008
Location: Germany
Old 07-01-2009 , 10:26   Re: Silent Bomb v1.0
Reply With Quote #13

This should be better performance-wise (sorry for not explaining and just giving the code).

PHP Code:
#include <amxmodx>
#include <fakemeta>

new const g_bomb_sounds[] = 
{
    
"c4_beep1.wav",
    
"c4_beep2.wav",
    
"c4_beep3.wav",
    
"c4_beep4.wav",
    
"c4_beep5.wav",
    
"c4_click.wav"
}

new 
cvar_enabled
new g_forward = -1

public plugin_init()
{
    
register_plugin("Silent Bomb""1.0""fezh")

    
cvar_enabled register_cvar("amx_silent_bomb""1")

    
register_logevent("logevent_plantedthebomb"3"2=Planted_The_Bomb")
    
register_logevent("logevent_roundstart"2"1=Round_Start")
    
register_dictionary("silent_bomb.txt")
}

public 
fw_EmitSound(entchannel, const sound[])
{
    if(
equal(sound"weapons/"8))
    {
        for (new 
0sizeof g_bomb_soundsi++)
        {
            if (
equal(sound[8], g_bomb_sounds[i]))
            {
                return 
FMRES_SUPERCEDE;
            }
        }
    }
    return 
FMRES_IGNORED;
}

public 
logevent_roundstart()
{
    if(
g_forward>-1)
    {
        
unregister_forward(FM_EmitSoundg_forward);
        
g_forward = -1;
    }
}
public 
logevent_plantedthebomb()
{
    if (
get_pcvar_num(cvar_enabled))
    {
        if(
g_forward==-1)
        {
            
g_forward register_forward(FM_EmitSound"fw_EmitSound");
        }        
        
client_print(0print_chat"[AMXX] %L"LANG_PLAYER"BOMB_MESSAGE")
    }

__________________
In Flames we trust!

Last edited by Nextra; 07-01-2009 at 10:32.
Nextra is offline
dorin2oo7
Senior Member
Join Date: Jun 2008
Location: Sibiu, Romania
Old 07-01-2009 , 17:45   Re: Silent Bomb v1.0
Reply With Quote #14

Romanian Trasnlation

Code:
[ro]
BOMB_MESSAGE = Bomba a fost pusa, dar nu are sunet!
__________________
dorin2oo7 is offline
fezh
Veteran Member
Join Date: Dec 2008
Location: BANNED
Old 07-01-2009 , 17:56   Re: Silent Bomb v1.0
Reply With Quote #15

Quote:
Originally Posted by Nextra View Post
This should be better performance-wise (sorry for not explaining and just giving the code).
I don't understand the purpose of the optimization.. Obviously if you don't have the cvar enabled the plugin won't work, but the forward still registered.. So is that the reason?
__________________
"There is no knowledge, that is not power"
fezh is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 07-01-2009 , 18:01   Re: Silent Bomb v1.0
Reply With Quote #16

Quote:
Originally Posted by dorin2oo7 View Post
Romanian Trasnlation

Code:
[ro]
BOMB_MESSAGE = Bomba a fost pusa plantata... dar nu are sunet!
Sounds better. ^^'
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 07-01-2009 , 18:03   Re: Silent Bomb v1.0
Reply With Quote #17

Quote:
Originally Posted by fezh View Post
I don't understand the purpose of the optimization.. Obviously if you don't have the cvar enabled the plugin won't work, but the forward still registered.. So is that the reason?
The purpose is to use the forward EmitSound only when necessary, avoiding unnecessary calls.
__________________
Arkshine is offline
Nextra
Veteran Member
Join Date: Apr 2008
Location: Germany
Old 07-02-2009 , 08:16   Re: Silent Bomb v1.0
Reply With Quote #18

The optimization does two things:
- The forward is only registered when the bomb is actually planted. Therefore avoiding all the equal and get_pcvar_num calls (in an ordinary cs round the bomb is only planted apx one quarter of the round time).
- The sound folder is checked first avoiding the loop for every single sound (even if it is not out of the weapons folder) and allowing you to leave it out of each sound string.

I'm not sure how much the latter benefits performance but the former is definitely a bigger optimization (relative to the overall performance of this plugin).


Agan, sorry for not explaining it right away.
__________________
In Flames we trust!
Nextra is offline
a.aqua
Senior Member
Join Date: Jul 2009
Location: Russia
Old 07-03-2009 , 22:26   Re: Silent Bomb v1.0
Reply With Quote #19

Russ translation

[ru]
BOMB_MESSAGE = Bomba ystanovlena.. No zvuk otklu4en ;)
__________________
a.aqua is offline
Send a message via ICQ to a.aqua
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 07-04-2009 , 08:17   Re: Silent Bomb v1.0
Reply With Quote #20

What about this
PHP Code:
#include <amxmodx>
#include <fakemeta>

new g_Cvar_Enabled;
new 
g_iForward = -1;

public 
plugin_init( ) {
    
register_plugin("Silent Bomb""1.0""fezh");
    
    
g_Cvar_Enabled register_cvar("amx_silent_bomb""1");
    
    
register_logevent"logevent_plantedthebomb"3"2=Planted_The_Bomb" );
    
register_logevent"logevent_roundstart"2"1=Round_Start" );
    
register_dictionary"silent_bomb.txt" );
}

public 
FwdEmitSoundiEntityiChannel, const szSound[ ] ) {
    if( 
equalszSound"weapons/c4_"11 ) )
        if( 
szSound11 ] == 'b' || szSound11 ] == 'c' )
            return 
FMRES_SUPERCEDE;
    
    return 
FMRES_IGNORED;
}

public 
logevent_roundstart( ) {
    if( 
g_iForward > -) {
        
unregister_forwardFM_EmitSoundg_iForward );
        
        
g_iForward = -1;
    }
}

public 
logevent_plantedthebomb( ) {
    if( 
get_pcvar_numg_Cvar_Enabled ) ) {
        if( 
g_iForward == -)
            
g_iForward register_forwardFM_EmitSound"FwdEmitSound" );
        
        
client_print0print_chat"[AMXX] %L"LANG_PLAYER"BOMB_MESSAGE" );
    }

Code:
[ru]
BOMB_MESSAGE = Bomba ustanovlena.. No u nejo net zvuka!
Sounds better ^^
__________________
xPaw 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 00:42.


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