View Single Post
Author Message
golfu59
New Member
Join Date: Jan 2020
Old 01-12-2020 , 05:15   request to modify erotic_bomb plugin
Reply With Quote #1

Hello !
I also asked you to help me with this plugin ... I saw on other servers that when you plant the bomb the model dances ... to this plugin that I only dance when you do broadcast ...
Please if you can dance from the moment the bomb is planted.

Thank you very much!

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

#define PLUGIN			"Erotic Bomb"
#define VERSION			"0.4"
#define AUTHOR			"8dp & Spection"

#define EROTIC_BOMB_W	"models/erotic_bomb/erotic_bomb.mdl"
#define m_flNextBeep	102
#define m_flNextBlink	106
#define	m_bIsC4			385 

/*=============================================================================================================*/

#define DEFUSE_ANIMATION_START 									// Анимация танца начинается при разминировании
//#define BEEP_SOUND											// Звуки бомбы
#define CUSTOM_SOUND "erotic_bomb/erotic_bomb.wav"				// Кастомная музыка

/*=============================================================================================================*/

new g_iBomb, g_iSequence 

#if defined DEFUSE_ANIMATION_START 
public Event_BombDefusing()
{
	if(pev(g_iBomb, pev_sequence)) return
	if(++g_iSequence == 4) g_iSequence = 1
	set_pev(g_iBomb, pev_frame, 0.0)
	set_pev(g_iBomb, pev_animtime, get_gametime())
	set_pev(g_iBomb, pev_sequence, g_iSequence)
}
#endif

bool:get_pdata_boolc(ent, charbased_offset, intbase_linuxdiff = 5) return !!( get_pdata_int(ent, charbased_offset / 4, intbase_linuxdiff) & (0xFF<<((charbased_offset % 4) * 8)) )
public Event_BombPlanted() 
{
	g_iBomb = FM_NULLENT
	while((g_iBomb = engfunc(EngFunc_FindEntityByString, g_iBomb, "classname", "grenade")))
	{
		if(pev_valid(g_iBomb) && get_pdata_boolc(g_iBomb, m_bIsC4))
		{
			Setup_Bomb()
			return
		}
	} 
}

Setup_Bomb()
{
	engfunc(EngFunc_SetModel, g_iBomb, EROTIC_BOMB_W)
	#if !defined DEFUSE_ANIMATION_START
	if(++g_iSequence == 4) g_iSequence = 1
	set_pev(g_iBomb, pev_sequence, g_iSequence)
	#endif
	set_pev(g_iBomb, pev_frame, 0.0)
	set_pev(g_iBomb, pev_animtime, get_gametime())
	set_pev(g_iBomb, pev_framerate, 1.0)
	set_pdata_float(g_iBomb, m_flNextBlink, get_gametime() + 9999.9)
	#if !defined BEEP_SOUND
	set_pdata_float(g_iBomb, m_flNextBeep, get_gametime() + 9999.9)
	#endif
	#if defined CUSTOM_SOUND
	emit_sound(g_iBomb, CHAN_STATIC, CUSTOM_SOUND, VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
	#endif
}

public plugin_precache()
{
	engfunc(EngFunc_PrecacheModel, EROTIC_BOMB_W)
	#if defined CUSTOM_SOUND
	engfunc(EngFunc_PrecacheSound, CUSTOM_SOUND)
	#endif
}

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	#if defined CUSTOM_SOUND
	register_logevent("Stop_BombSound", 2, "1=Round_End")
	register_event("HLTV", "Stop_BombSound", "a", "1=0", "2=0")
	#endif
	#if defined DEFUSE_ANIMATION_START
	register_event("BarTime", "Event_BombDefusing", "be", "1=5", "1=10") 
	#endif
	register_logevent("Event_BombPlanted", 3, "2=Planted_The_Bomb")
}

#if defined CUSTOM_SOUND
public Stop_BombSound() 
{
	if(g_iBomb)
	{
		emit_sound(g_iBomb, CHAN_STATIC, CUSTOM_SOUND, VOL_NORM, ATTN_NORM, SND_STOP, PITCH_NORM)
		g_iBomb = 0
	}
}
#endif
golfu59 is offline