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

C4 Sound


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SHIFT0
Senior Member
Join Date: Apr 2021
Location: Palestine
Old 12-12-2021 , 09:53   C4 Sound
Reply With Quote #1

Can some one add
30 Seconds Sound Then 20 Seconds ?
I have the sounds
sound/C4/sounds.wav

PHP Code:
/* AMX Mod X
*   Stats Logging Plugin
*
* by the AMX Mod X Development Team
*  originally developed by JustinHoMi
*
* This file is part of AMX Mod X.
*
*
*  This program 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; either version 2 of the License, or (at
*  your option) any later version.
*
*  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 this program; if not, write to the Free Software Foundation, 
*  Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*  In addition, as a special exception, the author gives permission to
*  link the code of this program with the Half-Life Game Engine ("HL
*  Engine") and Modified Game Libraries ("MODs") developed by Valve, 
*  L.L.C ("Valve"). You must obey the GNU General Public License in all
*  respects for all of the code used other than the HL Engine and MODs
*  from Valve. If you modify this file, you may extend this exception
*  to your version of the file, but you are not obligated to do so. If
*  you do not wish to do so, delete this exception statement from your
*  version.
*/

#include <amxmodx>
#include <cstrike>

#define PLUGIN     "C4 Timer and Sound"
#define VERSION "1.4"
#define AUTHOR     "kwpd"

new g_c4timer
new cvar_showteam
new cvar_flash
new cvar_sprite
new cvar_msg
new g_Cvarg_C4
new g_msg_showtimer
new g_msg_roundtime
new g_msg_scenario

#define MAX_SPRITES    2
new const g_timersprite[MAX_SPRITES][] = { "bombticking""bombticking1" }
new const 
g_message[] = "Detonation time intiallized....."

public plugin_precache() 
{
    
precache_sound("misc/ten.wav")
    
precache_sound("misc/nine.wav")
    
precache_sound("misc/eight.wav")
    
precache_sound("misc/seven.wav")
    
precache_sound("misc/six.wav")
    
precache_sound("misc/five.wav")
    
precache_sound("misc/foor.wav")
    
precache_sound("misc/three.wav")
    
precache_sound("misc/two.wav")
    
precache_sound("misc/one.wav")

    return 
PLUGIN_HANDLED


public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_cvar(PLUGINVERSIONFCVAR_SPONLY|FCVAR_SERVER)
    
    
cvar_showteam    register_cvar("amx_showc4timer""3")
    
cvar_flash    register_cvar("amx_showc4flash""0")
    
cvar_sprite    register_cvar("amx_showc4sprite""1")
    
cvar_msg    register_cvar("amx_showc4msg""0")
    
    
g_msg_showtimer    get_user_msgid("ShowTimer")
    
g_msg_roundtime    get_user_msgid("RoundTime")
    
g_msg_scenario    get_user_msgid("Scenario")
    
    
register_event("HLTV""event_hltv""a""1=0""2=0")
    
register_logevent("logevent_plantedthebomb"3"2=Planted_The_Bomb")
    
    
g_C4    get_cvar_pointer("mp_c4timer")
    
g_Cvar    register_cvar("amx_soundc4""1")
    
register_logevent("RoundEnd",2,"1=Round_End")
    
register_logevent("RoundStart"2"1=Round_Start")
}

public 
event_hltv()
    
g_c4timer get_pcvar_num(g_C4)

public 
logevent_plantedthebomb()
{
    new 
showtteam get_pcvar_num(cvar_showteam)
    
    static 
players[32], numi
    
switch(showtteam)
    {
        case 
1get_players(playersnum"ace""TERRORIST")
        case 
2get_players(playersnum"ace""CT")
        case 
3get_players(playersnum"ac")
        default: return
    }
    for(
0num; ++iset_task(1.0"update_timer"players[i])
}

public 
update_timer(id)
{
    
message_begin(MSG_ONE_UNRELIABLEg_msg_showtimer_id)
    
message_end()
    
    
message_begin(MSG_ONE_UNRELIABLEg_msg_roundtime_id)
    
write_short(g_c4timer)
    
message_end()
    
    
message_begin(MSG_ONE_UNRELIABLEg_msg_scenario_id)
    
write_byte(1)
    
write_string(g_timersprite[clamp(get_pcvar_num(cvar_sprite), 0, (MAX_SPRITES 1))])
    
write_byte(150)
    
write_short(get_pcvar_num(cvar_flash) ? 20 0)
    
message_end()
    
    if(
get_pcvar_num(cvar_msg))
    {
        
set_hudmessage(25518000.440.8726.06.0)
        
show_hudmessage(idg_message)
    }
}

#define task_sound 69696969

public bomb_planted(planter
{
    new 
Name[32]
    
    if(!
get_pcvar_num(g_Cvar))  
        return 
PLUGIN_CONTINUE  
    
    get_user_name
(planterName31)  
    
    new 
time get_pcvar_num(g_C4)
    
    
float(time)
    
    
set_task( (time 10.0) , "Zero"task_sound)
    
set_task( (time 9.0) , "one"task_sound)
    
set_task( (time 8.0) , "two"task_sound)
    
set_task( (time 7.0) , "three"task_sound)
    
set_task( (time 6.0) , "foor"task_sound)
    
set_task( (time 5.0) , "five"task_sound)
    
set_task( (time 4.0) , "six"task_sound)
    
set_task( (time 3.0) , "seven"task_sound)
    
set_task( (time 2.0) , "eigth"task_sound)
    
set_task( (time 1.0) , "nine"task_sound)
    
    return 
PLUGIN_CONTINUE  
}

public 
Zero()  
{
    
client_cmd(0"spk misc/ten.wav" )  
    return 
PLUGIN_CONTINUE  
}

public 
one()  
{
    
client_cmd(0"spk misc/nine.wav" )  
    return 
PLUGIN_CONTINUE  
}

public 
two()  
{
    
client_cmd(0"spk misc/eight.wav")  
    return 
PLUGIN_CONTINUE  
}

public 
three()  
{
    
client_cmd(0"spk misc/seven.wav")  
    return 
PLUGIN_CONTINUE  
}
 
public 
foor()  

    
client_cmd(0"spk misc/six.wav"  )  
    return 
PLUGIN_CONTINUE  
}

public 
five()  
{
    
client_cmd(0"spk misc/five.wav" )  
    return 
PLUGIN_CONTINUE  
}

public 
six()  
{
    
client_cmd(0"spk misc/foor.wav" )  
    return 
PLUGIN_CONTINUE  
}

public 
seven()  
{
    
client_cmd(0"spk misc/three.wav")  
    return 
PLUGIN_CONTINUE  
}

public 
eigth()  
{
    
client_cmd(0"spk misc/two.wav"  )  
    return 
PLUGIN_CONTINUE  
}

public 
nine()  
{
    
client_cmd(0"spk misc/one.wav")  
    return 
PLUGIN_CONTINUE  
}

public 
RoundEnd()
{
    
remove_task(task_sound)
}

public 
RoundStart()  
{
    
remove_task(task_sound)
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ ansicpg1252\\ deff0\\ deflang6154{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ f0\\ fs16 \n\\ par }
*/ 
SHIFT0 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 12-12-2021 , 09:59   Re: C4 Sound
Reply With Quote #2

I gave you a perfectly working solution and you decided to go for a terribly coded plugin.

Instead of posting 10 request per day, why not try and do something yourself? In this case it's pretty obvious what needs to be changed if you simply LOOK at the code.

Add the sounds here:

Code:
precache_sound("misc/ten.wav") precache_sound("misc/nine.wav") precache_sound("misc/eight.wav") precache_sound("misc/seven.wav") precache_sound("misc/six.wav") precache_sound("misc/five.wav") precache_sound("misc/foor.wav") precache_sound("misc/three.wav") precache_sound("misc/two.wav") precache_sound("misc/one.wav")

Add the seconds here:

Code:
set_task( (time - 10.0) , "Zero", task_sound) set_task( (time - 9.0) , "one", task_sound) set_task( (time - 8.0) , "two", task_sound) set_task( (time - 7.0) , "three", task_sound) set_task( (time - 6.0) , "foor", task_sound) set_task( (time - 5.0) , "five", task_sound) set_task( (time - 4.0) , "six", task_sound) set_task( (time - 3.0) , "seven", task_sound) set_task( (time - 2.0) , "eigth", task_sound) set_task( (time - 1.0) , "nine", task_sound)

Play the sounds here:

Code:
public Zero()  {     client_cmd(0, "spk misc/ten.wav" )      return PLUGIN_CONTINUE  } public one()  {     client_cmd(0, "spk misc/nine.wav" )      return PLUGIN_CONTINUE  } public two()  {     client_cmd(0, "spk misc/eight.wav")      return PLUGIN_CONTINUE  } public three()  {     client_cmd(0, "spk misc/seven.wav")      return PLUGIN_CONTINUE  }   public foor()  {     client_cmd(0, "spk misc/six.wav"  )      return PLUGIN_CONTINUE  } public five()  {     client_cmd(0, "spk misc/five.wav" )      return PLUGIN_CONTINUE  } public six()  {     client_cmd(0, "spk misc/foor.wav" )      return PLUGIN_CONTINUE  } public seven()  {     client_cmd(0, "spk misc/three.wav")      return PLUGIN_CONTINUE  } public eigth()  {     client_cmd(0, "spk misc/two.wav"  )      return PLUGIN_CONTINUE  } public nine()  {     client_cmd(0, "spk misc/one.wav")      return PLUGIN_CONTINUE  }

Of course, if you used a properly coded plugin, this would have required changing only one line of code, but looks like you know better.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
SHIFT0
Senior Member
Join Date: Apr 2021
Location: Palestine
Old 12-12-2021 , 10:04   Re: C4 Sound
Reply With Quote #3

Quote:
Originally Posted by OciXCrom View Post
I gave you a perfectly working solution and you decided to go for a terribly coded plugin.

Instead of posting 10 request per day, why not try and do something yourself? In this case it's pretty obvious what needs to be changed if you simply LOOK at the code.

Add the sounds here:

Code:
precache_sound("misc/ten.wav") precache_sound("misc/nine.wav") precache_sound("misc/eight.wav") precache_sound("misc/seven.wav") precache_sound("misc/six.wav") precache_sound("misc/five.wav") precache_sound("misc/foor.wav") precache_sound("misc/three.wav") precache_sound("misc/two.wav") precache_sound("misc/one.wav")

Add the seconds here:

Code:
set_task( (time - 10.0) , "Zero", task_sound) set_task( (time - 9.0) , "one", task_sound) set_task( (time - 8.0) , "two", task_sound) set_task( (time - 7.0) , "three", task_sound) set_task( (time - 6.0) , "foor", task_sound) set_task( (time - 5.0) , "five", task_sound) set_task( (time - 4.0) , "six", task_sound) set_task( (time - 3.0) , "seven", task_sound) set_task( (time - 2.0) , "eigth", task_sound) set_task( (time - 1.0) , "nine", task_sound)

Play the sounds here:

Code:
public Zero()  {     client_cmd(0, "spk misc/ten.wav" )      return PLUGIN_CONTINUE  } public one()  {     client_cmd(0, "spk misc/nine.wav" )      return PLUGIN_CONTINUE  } public two()  {     client_cmd(0, "spk misc/eight.wav")      return PLUGIN_CONTINUE  } public three()  {     client_cmd(0, "spk misc/seven.wav")      return PLUGIN_CONTINUE  }   public foor()  {     client_cmd(0, "spk misc/six.wav"  )      return PLUGIN_CONTINUE  } public five()  {     client_cmd(0, "spk misc/five.wav" )      return PLUGIN_CONTINUE  } public six()  {     client_cmd(0, "spk misc/foor.wav" )      return PLUGIN_CONTINUE  } public seven()  {     client_cmd(0, "spk misc/three.wav")      return PLUGIN_CONTINUE  } public eigth()  {     client_cmd(0, "spk misc/two.wav"  )      return PLUGIN_CONTINUE  } public nine()  {     client_cmd(0, "spk misc/one.wav")      return PLUGIN_CONTINUE  }

Of course, if you used a properly coded plugin, this would have required changing only one line of code, but looks like you know better.

I'll try !
SHIFT0 is offline
SHIFT0
Senior Member
Join Date: Apr 2021
Location: Palestine
Old 12-12-2021 , 10:17   Re: C4 Sound
Reply With Quote #4

Quote:
Originally Posted by SHIFT0 View Post
I'll try !
I DID THIS Is worked ?

PHP Code:
/* AMX Mod X
*   Stats Logging Plugin
*
* by the AMX Mod X Development Team
*  originally developed by JustinHoMi
*
* This file is part of AMX Mod X.
*
*
*  This program 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; either version 2 of the License, or (at
*  your option) any later version.
*
*  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 this program; if not, write to the Free Software Foundation, 
*  Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*  In addition, as a special exception, the author gives permission to
*  link the code of this program with the Half-Life Game Engine ("HL
*  Engine") and Modified Game Libraries ("MODs") developed by Valve, 
*  L.L.C ("Valve"). You must obey the GNU General Public License in all
*  respects for all of the code used other than the HL Engine and MODs
*  from Valve. If you modify this file, you may extend this exception
*  to your version of the file, but you are not obligated to do so. If
*  you do not wish to do so, delete this exception statement from your
*  version.
*/

#include <amxmodx>
#include <cstrike>

#define PLUGIN     "C4 Timer and Sound"
#define VERSION "1.4"
#define AUTHOR     "kwpd"

new g_c4timer
new cvar_showteam
new cvar_flash
new cvar_sprite
new cvar_msg
new g_Cvarg_C4
new g_msg_showtimer
new g_msg_roundtime
new g_msg_scenario

#define MAX_SPRITES    2
new const g_timersprite[MAX_SPRITES][] = { "bombticking""bombticking1" }
new const 
g_message[] = "Detonation time intiallized....."

public plugin_precache() 
{
    
precache_sound("misc/thirty.wav")
         
precache_sound("misc/twenty.wav")
    
precache_sound("misc/ten.wav")
    
precache_sound("misc/nine.wav")
    
precache_sound("misc/eight.wav")
    
precache_sound("misc/seven.wav")
    
precache_sound("misc/six.wav")
    
precache_sound("misc/five.wav")
    
precache_sound("misc/foor.wav")
    
precache_sound("misc/three.wav")
    
precache_sound("misc/two.wav")
    
precache_sound("misc/one.wav")

    return 
PLUGIN_HANDLED


public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_cvar(PLUGINVERSIONFCVAR_SPONLY|FCVAR_SERVER)
    
    
cvar_showteam    register_cvar("amx_showc4timer""3")
    
cvar_flash    register_cvar("amx_showc4flash""0")
    
cvar_sprite    register_cvar("amx_showc4sprite""1")
    
cvar_msg    register_cvar("amx_showc4msg""0")
    
    
g_msg_showtimer    get_user_msgid("ShowTimer")
    
g_msg_roundtime    get_user_msgid("RoundTime")
    
g_msg_scenario    get_user_msgid("Scenario")
    
    
register_event("HLTV""event_hltv""a""1=0""2=0")
    
register_logevent("logevent_plantedthebomb"3"2=Planted_The_Bomb")
    
    
g_C4    get_cvar_pointer("mp_c4timer")
    
g_Cvar    register_cvar("amx_soundc4""1")
    
register_logevent("RoundEnd",2,"1=Round_End")
    
register_logevent("RoundStart"2"1=Round_Start")
}

public 
event_hltv()
    
g_c4timer get_pcvar_num(g_C4)

public 
logevent_plantedthebomb()
{
    new 
showtteam get_pcvar_num(cvar_showteam)
    
    static 
players[32], numi
    
switch(showtteam)
    {
        case 
1get_players(playersnum"ace""TERRORIST")
        case 
2get_players(playersnum"ace""CT")
        case 
3get_players(playersnum"ac")
        default: return
    }
    for(
0num; ++iset_task(1.0"update_timer"players[i])
}

public 
update_timer(id)
{
    
message_begin(MSG_ONE_UNRELIABLEg_msg_showtimer_id)
    
message_end()
    
    
message_begin(MSG_ONE_UNRELIABLEg_msg_roundtime_id)
    
write_short(g_c4timer)
    
message_end()
    
    
message_begin(MSG_ONE_UNRELIABLEg_msg_scenario_id)
    
write_byte(1)
    
write_string(g_timersprite[clamp(get_pcvar_num(cvar_sprite), 0, (MAX_SPRITES 1))])
    
write_byte(150)
    
write_short(get_pcvar_num(cvar_flash) ? 20 0)
    
message_end()
    
    if(
get_pcvar_num(cvar_msg))
    {
        
set_hudmessage(25518000.440.8726.06.0)
        
show_hudmessage(idg_message)
    }
}

#define task_sound 69696969

public bomb_planted(planter
{
    new 
Name[32]
    
    if(!
get_pcvar_num(g_Cvar))  
        return 
PLUGIN_CONTINUE  
    
    get_user_name
(planterName31)  
    
    new 
time get_pcvar_num(g_C4)
    
    
float(time)
    
    
set_task( (time 30.0) , "thirty"task_sound)
    
set_task( (time 20.0) , "twenty"task_sound)
    
set_task( (time 10.0) , "Zero"task_sound)
    
set_task( (time 9.0) , "one"task_sound)
    
set_task( (time 8.0) , "two"task_sound)
    
set_task( (time 7.0) , "three"task_sound)
    
set_task( (time 6.0) , "foor"task_sound)
    
set_task( (time 5.0) , "five"task_sound)
    
set_task( (time 4.0) , "six"task_sound)
    
set_task( (time 3.0) , "seven"task_sound)
    
set_task( (time 2.0) , "eigth"task_sound)
    
set_task( (time 1.0) , "nine"task_sound)
    
    return 
PLUGIN_CONTINUE  
}

public 
thirty()  
{
    
client_cmd(0"spk misc/thirty.wav" )  
    return 
PLUGIN_CONTINUE  
}

public 
twenty()  
{
    
client_cmd(0"spk misc/twenty.wav" )  
    return 
PLUGIN_CONTINUE  
}

public 
Zero()  
{
    
client_cmd(0"spk misc/Zero.wav")  
    return 
PLUGIN_CONTINUE  
}

public 
one()  
{
    
client_cmd(0"spk misc/one.wav")  
    return 
PLUGIN_CONTINUE  
}
 
public 
two()  

    
client_cmd(0"spk misc/two.wav"  )  
    return 
PLUGIN_CONTINUE  
}

public 
three()  
{
    
client_cmd(0"spk misc/three.wav" )  
    return 
PLUGIN_CONTINUE  
}

public 
foor()  
{
    
client_cmd(0"spk misc/foor.wav" )  
    return 
PLUGIN_CONTINUE  
}

public 
fine()  
{
    
client_cmd(0"spk misc/five.wav")  
    return 
PLUGIN_CONTINUE  
}

public 
six()  
{
    
client_cmd(0"spk misc/six.wav"  )  
    return 
PLUGIN_CONTINUE  
}

public 
seven()  
{
    
client_cmd(0"spk misc/seven.wav")  
    return 
PLUGIN_CONTINUE  
}

public 
eight()
{
    
client_cmd(0"spk misc/eight.wav")  
    return 
PLUGIN_CONTINUE
}

public 
nine()
{
    
client_cmd(0"spk misc/nine.wav")  
    return 
PLUGIN_CONTINUE
}

public 
RoundEnd()
{
    
remove_task(task_sound)
}

public 
RoundStart()  
{
    
remove_task(task_sound)


Last edited by SHIFT0; 12-12-2021 at 10:18.
SHIFT0 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 12-12-2021 , 11:02   Re: C4 Sound
Reply With Quote #5

You can test it. I don't see anything wrong at a first glance.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Reply


Thread Tools
Display Modes

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 05:58.


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