Code: Select all
/* Plugin generated by AMXX-Studio */
#include < amxmodx >
#include < cstrike >
#include < alt_chat >
#define PLUGIN "NewBombEvents"
#define VERSION "1.1"
#define AUTHOR "crazy.cipry"
// Hud-Messages Customization
#define T_R 255 // RGB
#define T_G 0 // for
#define T_B 0 // the messages shown to Terrorists
#define CT_R 0 // RGB
#define CT_G 0 // for
#define CT_B 255 // the messages shown to Counter-Terrorists
#define X_POS -1.0 //Orizontal coordinate
#define Y_POS 0.85 //Vertical coordinate
#define I_EFFECT 2 //The effect of the message
#define F_FXTIME 0.5 //The time for the effects to last on the message
#define F_HOLDTIME 1.5 //The time it takes for the message to stay on the screen
#define F_FADEIN 0.1 //The time it takes for the message to appear
#define F_FADEOUT 0.15 //The time it takes for the message to disappear
#define CHANNEL -1
// Bomb Pickup / Bomb Drop settings. If you want them leave it as it is, if not put // in front of the net line
#define BOMB_PICKUP_DROP
new const g_SoundPath[ ] [ ] = {
"misc/bomba.wav",
"misc/defused.wav"
}
new PluginOnOff, Bonus, g_SyncMsg, g_Bonus, CurrentMoney, FinalMoney, Sound, g_Sound;
public plugin_precache ( ) {
for ( new i = 0; i < sizeof ( g_SoundPath ); i++ )
precache_sound ( g_SoundPath[ i ] );
return PLUGIN_CONTINUE;
}
public plugin_init ( ) {
register_plugin ( PLUGIN, VERSION, AUTHOR );
//Events
register_event ( "TextMsg", "bomb_planted", "a", "2&%!MRAD_BOMBPL" );
register_event ( "TextMsg", "bomb_defused", "a", "2&%!MRAD_BOMBDEF" );
register_event ( "BarTime", "bomb_planting", "be", "1=3" );
register_logevent ( "bomb_defusing", 3, "2=Begin_Bomb_Defuse_Without_Kit" );
register_logevent ( "bomb_defusing", 3, "2=Begin_Bomb_Defuse_With_Kit" );
new mapname[ 32 ];
get_mapname ( mapname, charsmax ( mapname ) );
if ( equali ( mapname, "de_", 3 ) || equali ( mapname, "csde_", 5 ) ) {
register_event ( "TextMsg", "eBombPickUp", "bc", "2&#Got_bomb" );
register_event ( "TextMsg", "eBombDrop", "bc", "2&#Game_bomb_d" );
}
//Cvars
PluginOnOff = register_cvar ( "amx_bmb", "1" );
Bonus = register_cvar ( "amx_bmb_bonus", "1000" );
Sound = register_cvar ( "amx_bmb_sounds", "1" );
//Dictionaries
register_dictionary ( "NewBombEvents.txt" );
//Other
g_msgsaytext = get_user_msgid( "SayText" );
g_SyncMsg = CreateHudSyncObj ( );
g_Bonus = get_pcvar_num ( Bonus );
g_Sound = get_pcvar_num ( Sound );
}
public bomb_defusing ( id ) {
if ( get_pcvar_num ( PluginOnOff ) != 1 )
return PLUGIN_CONTINUE;
new name[ 32 ];
get_user_name ( id, name, charsmax ( name ) );
TeamMessage ( "CT", "%L", LANG_PLAYER, "BOMB_DEFUSING", name );
return PLUGIN_CONTINUE;
}
public bomb_planting ( id ) {
if ( get_pcvar_num ( PluginOnOff ) != 1 )
return PLUGIN_CONTINUE;
new name[ 32 ];
get_user_name ( id, name, charsmax ( name ) );
TeamMessage ( "TERRORIST", "%L", LANG_PLAYER, "BOMB_PLANTING", name );
return PLUGIN_CONTINUE;
}
public bomb_planted ( planter ) {
if ( get_pcvar_num ( PluginOnOff ) != 1 )
return PLUGIN_CONTINUE;
if ( g_Sound == 1 )
client_cmd ( 0, "spk %s", g_SoundPath[ 0 ]);
new name[ 32 ];
get_user_name ( planter, name, charsmax ( name ) );
TeamMessage ( "TERRORIST", "%L", LANG_PLAYER, "BOMB_PLANTED_B", name, g_Bonus );
CurrentMoney = cs_get_user_money ( planter );
FinalMoney = CurrentMoney + g_Bonus;
cs_set_user_money ( planter, FinalMoney, 1 );
print ( planter, "%L", LANG_PLAYER, "BOMB_PLANTED_A", g_Bonus );
return PLUGIN_CONTINUE;
}
public bomb_defused ( defuser ) {
if ( get_pcvar_num ( PluginOnOff ) != 1 )
return PLUGIN_CONTINUE;
if ( g_Sound == 1 )
client_cmd ( 0, "spk %s", g_SoundPath[ 1 ]);
new name[ 32 ];
get_user_name ( defuser, name, charsmax ( name ) );
TeamMessage ( "CT", "%L", LANG_PLAYER, "BOMB_DEFUSED_B", name, g_Bonus );
CurrentMoney = cs_get_user_money ( defuser );
FinalMoney = CurrentMoney + g_Bonus;
cs_set_user_money ( defuser, FinalMoney, 1 );
print ( defuser, "%L", LANG_PLAYER, "BOMB_DEFUSED_A", g_Bonus );
return PLUGIN_CONTINUE;
}
#if defined BOMB_PICKUP_DROP
public eBombPickUp ( id ) {
if ( get_pcvar_num ( PluginOnOff ) != 1 )
return PLUGIN_CONTINUE;
new name[ 32 ];
get_user_name ( id, name, charsmax ( name ) );
TeamMessage ( "TERRORIST", "%L", LANG_PLAYER, "BOMB_PICKUP", name );
return PLUGIN_HANDLED;
}
#endif
#if defined BOMB_PICKUP_DROP
public eBombDrop ( id ) {
if ( get_pcvar_num ( PluginOnOff ) != 1 )
return PLUGIN_CONTINUE;
new name[ 32 ];
get_user_name ( id, name, charsmax ( name ) );
TeamMessage ( "TERRORIST", "%L", LANG_PLAYER, "BOMB_DROP", name );
return PLUGIN_HANDLED;
}
#endif
TeamMessage ( const team[ ], const message[ ], { Float, Sql, Result, _ }:... ) {
new Buffer[ 128 ], Buffer2[ 128 ];
formatex ( Buffer2, charsmax ( Buffer2 ), "%s", message );
vformat ( Buffer, charsmax ( Buffer ), Buffer2, 3 );
new players[ 32 ], num, id;
get_players ( players, num, "he", team );
for ( new i = 0; i < num; i++ ) {
id = players[ i ];
if ( ! is_user_alive ( id ) )
continue;
if ( equali ( team, "TERRORIST" ) )
set_hudmessage ( T_R, T_G, T_B, X_POS, Y_POS, I_EFFECT, F_FXTIME, F_HOLDTIME, F_FADEIN, F_FADEOUT, CHANNEL );
if ( equali ( team, "CT" ) )
set_hudmessage ( CT_R, CT_G, CT_B, X_POS, Y_POS, I_EFFECT, F_FXTIME, F_HOLDTIME, F_FADEIN, F_FADEOUT, CHANNEL );
ShowSyncHudMsg ( id, g_SyncMsg, Buffer );
}
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/