Try this :
PHP Code:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#define PLUGIN "Custom Bomb Pre-Warning"
#define VERSION "1.0.0"
#define AUTHOR "Kia"
// !!!
// ===============================================================================
// WARNING! THIS PLUGIN IS UNTESTED! USE ON OWN RISK!
// ===============================================================================
// !!!
// ===============================================================================
// Editing begins here
// ===============================================================================
// Time in Seconds when the Sound should start before Bomb explodes (X seconds before Bomb explodes)
#define TIME_LEFT_TO_PLAY 4.0
// Your sound file (.wav or .mp3 (Note : If you want to use a .mp3 add "sound/" at szSound))
new szSound[] = "misc/csclubdd2infnuke/Warning.wav"
// ===============================================================================
// and stops here. DO NOT MODIFY BELOW UNLESS YOU KNOW WHAT YOU'RE DOING
// ===============================================================================
// ===============================================================================
// Variables
// ===============================================================================
/* Defines */
#define TASK_ID_SOUND 1921
// ===============================================================================
// plugin_precache
// ===============================================================================
public plugin_precache()
{
if (equal(szSound[strlen(szSound)-4], ".mp3"))
precache_generic(szSound)
else
precache_sound(szSound)
}
// ===============================================================================
// plugin_init
// ===============================================================================
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
/* Events */
register_logevent("LogEvent_BombPlanted", 3, "2=Planted_The_Bomb")
register_logevent("LogEvent_BombDefused", 3, "2=Defused_The_Bomb")
}
// ===============================================================================
// LogEvent_BombPlanted - Called when the bomb was planted
// ===============================================================================
public LogEvent_BombPlanted()
{
new iTime = get_cvar_pointer("mp_c4timer")
set_task(iTime - TIME_LEFT_TO_PLAY, "PlayCustomSound", TASK_ID_SOUND)
}
// ===============================================================================
// LogEvent_BombDefused - Called when the bomb was defused
// ===============================================================================
public LogEvent_BombDefused()
{
if(task_exists(TASK_ID_SOUND))
remove_task(TASK_ID_SOUND)
}
// ===============================================================================
// PlayCustomSound - Plays your custom sound
// ===============================================================================
public PlayCustomSound()
{
if (equal(szSound[strlen(szSound)-4], ".mp3"))
client_cmd(0, "mp3 play ^"%s^"", szSound)
else
client_cmd(0, "spk ^"%s^"", szSound)
}
__________________