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

[SOLVED]add an event sound to Jailrebel


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
brlight
Senior Member
Join Date: Jun 2011
Old 07-20-2013 , 10:55   [SOLVED]add an event sound to Jailrebel
Reply With Quote #1

Hi, I´ve just download this plugin, and basically what it does is, every time a terrorist attack a CT it turns T red (glow red).What I would like is when T attacks CT it will sound a alarm for "x" sec (if possible configure for how long alarm will sound with a cvar)Sound file is at the bottom.
Here is the plugin:
PHP Code:
/*    Formatright © 2009, ConnorMcLeod 

    Jail Rebel is free software; 
    you can redistribute it and/or modify it under the terms of the 
    GNU General Public License as published by the Free Software Foundation. 

    This program is distributed in the hope that it will be useful, 
    but WITHOUT ANY WARRANTY; without even the implied warranty of 
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    GNU General Public License for more details. 

    You should have received a copy of the GNU General Public License 
    along with Jail Rebel; if not, write to the 
    Free Software Foundation, Inc., 59 Temple Place - Suite 330, 
    Boston, MA 02111-1307, USA. 
*/ 
 
// Includes
#include <amxmodx>
#include <cstrike>
#include <hamsandwich>
#include <fun>
// New Const
new const VERSION[] = "1.0";
new const 
PREFIX[] = "^4[ JailBreak ]^1";
//Defines
#define MAX_PLAYERS    32 
#define IsPlayer(%1)    ( 1 <= %1 <= g_iMaxPlayers ) 
// New Variables
new g_iTKills[MAX_PLAYERS+1
new 
g_bRebel[MAX_PLAYERS+1
new 
g_iMaxPlayers 
new gmsgSayText 
// Plugins Starts
public plugin_init() 

    
register_plugin("[JailBreak] Rebel Dector"VERSION"ConnorMcLeod"
    
RegisterHam(Ham_Spawn"player""Player_Spawn_Post"1
    
register_event("DeathMsg""Event_DeathMsg""a"
    
register_event("Damage""Event_Damage""b""2>0""3=0"
    
g_iMaxPlayers get_maxplayers() 
    
gmsgSayText get_user_msgid("SayText"

public 
client_putinserver(id

    
g_bRebel[id] = false 
    g_iTKills
[id] = 

public 
Player_Spawn_Postid 

    if( 
is_user_aliveid ) ) 
    { 
        
g_bRebel[id] = false 
        g_iTKills
[id] = 
    


public 
Event_DeathMsg() 

        new 
iVictim read_data(2
        if( 
cs_get_user_teamiVictim ) == CS_TEAM_T 
        { 
        
set_user_rendering(iVictimkRenderFxGlowShell000kRenderNormal1)
 
        new 
iKiller read_data(1
        if( 
IsPlayeriKiller ) && cs_get_user_teamiKiller ) == CS_TEAM_CT 
        { 
            if( 
g_bRebel[iVictim] ) 
            { 
                new 
szVName[32], szKName[32
                
get_user_name(iVictimszVNamecharsmax(szVName)) 
                
get_user_name(iKillerszKNamecharsmax(szKName)) 
                
client_print_c(0"%s Guard^4 %s ^1killed rebel^4 %s"PREFIXszKNameszVName
            } 
        } 
    } 

public 
Event_Damageid 

    if( (
read_data(4) || read_data(5) || read_data(6)) && cs_get_user_team(id) == CS_TEAM_CT 
    { 
        new 
iAttacker get_user_attacker(id
        if(    
IsPlayer(iAttacker
        &&    !
g_bRebel[iAttacker
        &&    
is_user_alive(iAttacker
        &&    
cs_get_user_team(iAttacker) == CS_TEAM_T    
        { 
            new 
szName[32
            
get_user_name(iAttackerszNamecharsmax(szName)) 
            
set_user_rendering(iAttackerkRenderFxGlowShell25000kRenderNormal1)
            
g_bRebel[iAttacker] = true 
            client_print_c
(0"%s Prisoner^4 %s ^1is now a ^4rebel! ^1(Glowing Red) Take Him Down"PREFIXszName)
        } 
    } 

client_print_c(idfmt[], any:...) 

    new 
szString[128
    
szString[0] = 0x04 
    vformat
(szString[1], sizeofszString ) - 2fmt3
    
message_begin(id MSG_ONE_UNRELIABLE MSG_BROADCASTgmsgSayText_id
    
write_byte(1
    
write_string(szString
    
message_end() 
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang2070\\ f0\\ fs16 \n\\ par }
*/ 
Thank you.
Attached Files
File Type: zip klaxon1.zip (40.5 KB, 50 views)

Last edited by brlight; 07-20-2013 at 20:16.
brlight is offline
GXLZPGX
Veteran Member
Join Date: Sep 2009
Old 07-20-2013 , 15:27   Re: add an event sound to Jailrebel
Reply With Quote #2

PHP Code:
/*    Formatright © 2009, ConnorMcLeod 

    Jail Rebel is free software; 
    you can redistribute it and/or modify it under the terms of the 
    GNU General Public License as published by the Free Software Foundation. 

    This program is distributed in the hope that it will be useful, 
    but WITHOUT ANY WARRANTY; without even the implied warranty of 
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    GNU General Public License for more details. 

    You should have received a copy of the GNU General Public License 
    along with Jail Rebel; if not, write to the 
    Free Software Foundation, Inc., 59 Temple Place - Suite 330, 
    Boston, MA 02111-1307, USA. 
*/ 
 
// Includes
#include <amxmodx>
#include <cstrike>
#include <hamsandwich>
#include <fun>
// New Const
new const VERSION[] = "1.0";
new const 
PREFIX[] = "^4[ JailBreak ]^1";

// sound
new const sz_Alarm[] = "sounds/klaxon1.wav";

//Defines
#define MAX_PLAYERS    32 
#define IsPlayer(%1)    ( 1 <= %1 <= g_iMaxPlayers ) 
// New Variables
new g_iTKills[MAX_PLAYERS+1
new 
g_bRebel[MAX_PLAYERS+1
new 
g_iMaxPlayers 
new gmsgSayText 
// Plugins Starts
public plugin_init() 

    
register_plugin("[JailBreak] Rebel Dector"VERSION"ConnorMcLeod"
    
RegisterHam(Ham_Spawn"player""Player_Spawn_Post"1
    
register_event("DeathMsg""Event_DeathMsg""a"
    
register_event("Damage""Event_Damage""b""2>0""3=0"
    
g_iMaxPlayers get_maxplayers() 
    
gmsgSayText get_user_msgid("SayText"

public 
client_putinserver(id

    
g_bRebel[id] = false 
    g_iTKills
[id] = 

public 
Player_Spawn_Postid 

    if( 
is_user_aliveid ) ) 
    { 
        
g_bRebel[id] = false 
        g_iTKills
[id] = 
    


public 
Event_DeathMsg() 

        new 
iVictim read_data(2
        if( 
cs_get_user_teamiVictim ) == CS_TEAM_T 
        { 
        
set_user_rendering(iVictimkRenderFxGlowShell000kRenderNormal1)
 
        new 
iKiller read_data(1
        if( 
IsPlayeriKiller ) && cs_get_user_teamiKiller ) == CS_TEAM_CT 
        { 
            if( 
g_bRebel[iVictim] ) 
            { 
                new 
szVName[32], szKName[32
                
get_user_name(iVictimszVNamecharsmax(szVName)) 
                
get_user_name(iKillerszKNamecharsmax(szKName)) 
                
client_print_c(0"%s Guard^4 %s ^1killed rebel^4 %s"PREFIXszKNameszVName
            } 
        } 
    } 

public 
Event_Damageid 

    if( (
read_data(4) || read_data(5) || read_data(6)) && cs_get_user_team(id) == CS_TEAM_CT 
    { 
        new 
iAttacker get_user_attacker(id
        if(    
IsPlayer(iAttacker
        &&    !
g_bRebel[iAttacker
        &&    
is_user_alive(iAttacker
        &&    
cs_get_user_team(iAttacker) == CS_TEAM_T    
        { 
            new 
szName[32
            
get_user_name(iAttackerszNamecharsmax(szName)) 
            
set_user_rendering(iAttackerkRenderFxGlowShell25000kRenderNormal1)
            
g_bRebel[iAttacker] = true 
            client_print_c
(0"%s Prisoner^4 %s ^1is now a ^4rebel! ^1(Glowing Red) Take Him Down"PREFIXszName)
            
emit_sound(0CHAN_AUTOsz_Alarm1.0ATTN_NORM0PITCH_NORM)
        } 
    } 

client_print_c(idfmt[], any:...) 

    new 
szString[128
    
szString[0] = 0x04 
    vformat
(szString[1], sizeofszString ) - 2fmt3
    
message_begin(id MSG_ONE_UNRELIABLE MSG_BROADCASTgmsgSayText_id
    
write_byte(1
    
write_string(szString
    
message_end() 
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang2070\\ f0\\ fs16 \n\\ par }
*/ 
new const sz_Alarm is the path for the sound, adjust accordingly.
__________________
Currently accepting payment US DOLLARS ONLY for custom plugins, contact me through PM.

Last edited by GXLZPGX; 07-20-2013 at 15:27.
GXLZPGX is offline
brlight
Senior Member
Join Date: Jun 2011
Old 07-20-2013 , 16:44   Re: add an event sound to Jailrebel
Reply With Quote #3

Thank you so much for your time and effort! but unfortunatelly plugin is not working as it should, i´m getting this error:
SV_StartSound: sound/misc/klaxon1.wav not precached (0)

I´ve put the sound available for download in the respective path but when I connect to the server it doesn´t download nothing.Could you pls check?Perhaps some precache command is missing, don´t know.

I think I did it!I just saw one plugin that uses precaching and copy the code I believe is necessary and include fakemeta could someone pls check if the code and procedure is correct?
Here it is the changed code:
PHP Code:
/*    Formatright © 2009, ConnorMcLeod 

    Jail Rebel is free software; 
    you can redistribute it and/or modify it under the terms of the 
    GNU General Public License as published by the Free Software Foundation. 

    This program is distributed in the hope that it will be useful, 
    but WITHOUT ANY WARRANTY; without even the implied warranty of 
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    GNU General Public License for more details. 

    You should have received a copy of the GNU General Public License 
    along with Jail Rebel; if not, write to the 
    Free Software Foundation, Inc., 59 Temple Place - Suite 330, 
    Boston, MA 02111-1307, USA. 
*/ 
 
// Includes
#include <amxmodx>
#include <cstrike>
#include <hamsandwich>
#include <fun>
#include <fakemeta>
// New Const
new const VERSION[] = "1.0";
new const 
PREFIX[] = "^4[ JailBreak ]^1";

// sound
new const sz_Alarm[] = "sounds/klaxon1.wav";

//Defines
#define MAX_PLAYERS    32 
#define IsPlayer(%1)    ( 1 <= %1 <= g_iMaxPlayers ) 
// New Variables
new g_iTKills[MAX_PLAYERS+1
new 
g_bRebel[MAX_PLAYERS+1
new 
g_iMaxPlayers 
new gmsgSayText 
// Plugins Starts
public plugin_precache()
{
    
engfunc(EngFunc_PrecacheSoundsz_Alarm)
}
public 
plugin_init() 

    
register_plugin("[JailBreak] Rebel Dector"VERSION"ConnorMcLeod"
    
RegisterHam(Ham_Spawn"player""Player_Spawn_Post"1
    
register_event("DeathMsg""Event_DeathMsg""a"
    
register_event("Damage""Event_Damage""b""2>0""3=0"
    
g_iMaxPlayers get_maxplayers() 
    
gmsgSayText get_user_msgid("SayText"

public 
client_putinserver(id

    
g_bRebel[id] = false 
    g_iTKills
[id] = 

public 
Player_Spawn_Postid 

    if( 
is_user_aliveid ) ) 
    { 
        
g_bRebel[id] = false 
        g_iTKills
[id] = 
    


public 
Event_DeathMsg() 

        new 
iVictim read_data(2
        if( 
cs_get_user_teamiVictim ) == CS_TEAM_T 
        { 
        
set_user_rendering(iVictimkRenderFxGlowShell000kRenderNormal1)
 
        new 
iKiller read_data(1
        if( 
IsPlayeriKiller ) && cs_get_user_teamiKiller ) == CS_TEAM_CT 
        { 
            if( 
g_bRebel[iVictim] ) 
            { 
                new 
szVName[32], szKName[32
                
get_user_name(iVictimszVNamecharsmax(szVName)) 
                
get_user_name(iKillerszKNamecharsmax(szKName)) 
                
client_print_c(0"%s Guard^4 %s ^1killed rebel^4 %s"PREFIXszKNameszVName
            } 
        } 
    } 

public 
Event_Damageid 

    if( (
read_data(4) || read_data(5) || read_data(6)) && cs_get_user_team(id) == CS_TEAM_CT 
    { 
        new 
iAttacker get_user_attacker(id
        if(    
IsPlayer(iAttacker
        &&    !
g_bRebel[iAttacker
        &&    
is_user_alive(iAttacker
        &&    
cs_get_user_team(iAttacker) == CS_TEAM_T    
        { 
            new 
szName[32
            
get_user_name(iAttackerszNamecharsmax(szName)) 
            
set_user_rendering(iAttackerkRenderFxGlowShell25000kRenderNormal1)
            
g_bRebel[iAttacker] = true 
            client_print_c
(0"%s Prisoner^4 %s ^1is now a ^4rebel! ^1(Glowing Red) Take Him Down"PREFIXszName)
            
emit_sound(0CHAN_AUTOsz_Alarm1.0ATTN_NORM0PITCH_NORM)
        } 
    } 

client_print_c(idfmt[], any:...) 

    new 
szString[128
    
szString[0] = 0x04 
    vformat
(szString[1], sizeofszString ) - 2fmt3
    
message_begin(id MSG_ONE_UNRELIABLE MSG_BROADCASTgmsgSayText_id
    
write_byte(1
    
write_string(szString
    
message_end() 
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang2070\\ f0\\ fs16 \n\\ par }
*/ 

Last edited by brlight; 07-20-2013 at 17:02.
brlight is offline
GXLZPGX
Veteran Member
Join Date: Sep 2009
Old 07-20-2013 , 17:11   Re: add an event sound to Jailrebel
Reply With Quote #4

PHP Code:
/*    Formatright © 2009, ConnorMcLeod 

    Jail Rebel is free software; 
    you can redistribute it and/or modify it under the terms of the 
    GNU General Public License as published by the Free Software Foundation. 

    This program is distributed in the hope that it will be useful, 
    but WITHOUT ANY WARRANTY; without even the implied warranty of 
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    GNU General Public License for more details. 

    You should have received a copy of the GNU General Public License 
    along with Jail Rebel; if not, write to the 
    Free Software Foundation, Inc., 59 Temple Place - Suite 330, 
    Boston, MA 02111-1307, USA. 
*/ 
 
// Includes
#include <amxmodx>
#include <cstrike>
#include <hamsandwich>
#include <fun>
// New Const
new const VERSION[] = "1.0";
new const 
PREFIX[] = "^4[ JailBreak ]^1";

// sound
new const sz_Alarm[] = "sounds/klaxon1.wav";

//Defines
#define MAX_PLAYERS    32 
#define IsPlayer(%1)    ( 1 <= %1 <= g_iMaxPlayers ) 
// New Variables
new g_iTKills[MAX_PLAYERS+1
new 
g_bRebel[MAX_PLAYERS+1
new 
g_iMaxPlayers 
new gmsgSayText 
// Plugins Starts
public plugin_init() 

    
register_plugin("[JailBreak] Rebel Dector"VERSION"ConnorMcLeod"
    
RegisterHam(Ham_Spawn"player""Player_Spawn_Post"1
    
register_event("DeathMsg""Event_DeathMsg""a"
    
register_event("Damage""Event_Damage""b""2>0""3=0"
    
g_iMaxPlayers get_maxplayers() 
    
gmsgSayText get_user_msgid("SayText"


public 
plugin_precache()
{
    
precache_soundsz_Alarm )
}

public 
client_putinserver(id

    
g_bRebel[id] = false 
    g_iTKills
[id] = 

public 
Player_Spawn_Postid 

    if( 
is_user_aliveid ) ) 
    { 
        
g_bRebel[id] = false 
        g_iTKills
[id] = 
    


public 
Event_DeathMsg() 

        new 
iVictim read_data(2
        if( 
cs_get_user_teamiVictim ) == CS_TEAM_T 
        { 
        
set_user_rendering(iVictimkRenderFxGlowShell000kRenderNormal1)
 
        new 
iKiller read_data(1
        if( 
IsPlayeriKiller ) && cs_get_user_teamiKiller ) == CS_TEAM_CT 
        { 
            if( 
g_bRebel[iVictim] ) 
            { 
                new 
szVName[32], szKName[32
                
get_user_name(iVictimszVNamecharsmax(szVName)) 
                
get_user_name(iKillerszKNamecharsmax(szKName)) 
                
client_print_c(0"%s Guard^4 %s ^1killed rebel^4 %s"PREFIXszKNameszVName
            } 
        } 
    } 

public 
Event_Damageid 

    if( (
read_data(4) || read_data(5) || read_data(6)) && cs_get_user_team(id) == CS_TEAM_CT 
    { 
        new 
iAttacker get_user_attacker(id
        if(    
IsPlayer(iAttacker
        &&    !
g_bRebel[iAttacker
        &&    
is_user_alive(iAttacker
        &&    
cs_get_user_team(iAttacker) == CS_TEAM_T    
        { 
            new 
szName[32
            
get_user_name(iAttackerszNamecharsmax(szName)) 
            
set_user_rendering(iAttackerkRenderFxGlowShell25000kRenderNormal1)
            
g_bRebel[iAttacker] = true 
            client_print_c
(0"%s Prisoner^4 %s ^1is now a ^4rebel! ^1(Glowing Red) Take Him Down"PREFIXszName)
            
emit_sound(0CHAN_AUTOsz_Alarm1.0ATTN_NORM0PITCH_NORM)
        } 
    } 

client_print_c(idfmt[], any:...) 

    new 
szString[128
    
szString[0] = 0x04 
    vformat
(szString[1], sizeofszString ) - 2fmt3
    
message_begin(id MSG_ONE_UNRELIABLE MSG_BROADCASTgmsgSayText_id
    
write_byte(1
    
write_string(szString
    
message_end() 
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang2070\\ f0\\ fs16 \n\\ par }
*/ 
__________________
Currently accepting payment US DOLLARS ONLY for custom plugins, contact me through PM.
GXLZPGX is offline
brlight
Senior Member
Join Date: Jun 2011
Old 07-20-2013 , 17:59   Re: add an event sound to Jailrebel
Reply With Quote #5

Thank you again GXLZPGX

Just wondering, both versions work, your is much more pratical IMO, you didn´t have to include fakemeta, when I was editing, I was getting errors without fakemeta (lucky the only diference between the 2 plugins when I was comparing was the include fakemeta, if it wasn´t I had to test with all the includes ), since both versions do the same thing(at least apparently) which one is better and whats the main diference between them?
Sound is just playing for 1sec how can I prolong it? I´ve tried with another wav file, longer wav file (about 7sec) but it´s always the same no matter the wav file, it plays the sound only for about 1 sec.
Please help.
Thanks.

Ok.Problem with sound playing just for 1 sec solved!I´ve deleted the file previous downloaded (1 sec wave file), restart server, after downloading the (7sec wav file).Now it plays the sound correctly 7sec wav file plays for 7sec.Strange is that I did this but it wasn´t working, after deleting the client file twice or for three times it´s working.
Thanks again GXLZPGX for your time!

Last edited by brlight; 07-20-2013 at 19:58. Reason: post feedback
brlight 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 19:24.


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