#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
new g_Enable;
new g_bwEnt[33];
new g_CachedStringInfoTarget;
new const DropTheBomb[] = "DropTheBomb.wav" // звук дропа
new const PickedUpTheBomb[] = "PickedUpTheBomb.wav" // звук поднятия
public plugin_init() {
register_plugin( "Bomb Hat", "1.0", "Subb98" );
register_logevent("EventPickedUpTheBomb", 3, "2=Spawned_With_The_Bomb", "2=Got_The_Bomb");
register_logevent("EventDropTheBomb", 3, "2=Dropped_The_Bomb", "2=Planted_The_Bomb");
register_cvar("bomb_hat", "1.2", FCVAR_SERVER);
g_Enable = register_cvar("amx_bombhat", "1");
RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawn");
RegisterHam(Ham_Killed, "player", "fwHamPlayerKilledPost", 1);
g_CachedStringInfoTarget = engfunc( EngFunc_AllocString, "info_target" );
}
public plugin_precache() {
precache_model("models/sombreroos.mdl");
precache_sound(DropTheBomb)
precache_sound(PickedUpTheBomb)
}
public EventPickedUpTheBomb() {
new id = get_loguser_index();
client_cmd(id, "spk %s", PickedUpTheBomb)
if(pev_valid(g_bwEnt[id])) {
set_pev(g_bwEnt[id], pev_effects, pev(g_bwEnt[id], pev_effects) & ~EF_NODRAW);
}
}
public EventDropTheBomb() {
new id = get_loguser_index();
client_cmd(id, "spk %s", DropTheBomb)
if(pev_valid(g_bwEnt[id])) {
set_pev(g_bwEnt[id], pev_effects, pev(g_bwEnt[id], pev_effects) | EF_NODRAW);
}
}
public fwHamPlayerSpawn( const player ) {
if ( get_pcvar_num( g_Enable ) && is_user_alive( player ) ) {
new iEnt = g_bwEnt[ player ];
if( !pev_valid( iEnt ) ) {
g_bwEnt[ player ] = iEnt = engfunc ( EngFunc_CreateNamedEntity, g_CachedStringInfoTarget );
set_pev( iEnt, pev_movetype, MOVETYPE_FOLLOW );
set_pev( iEnt, pev_aiment, player );
set_pev( iEnt, pev_effects, pev(iEnt, pev_effects) | EF_NODRAW);
engfunc( EngFunc_SetModel, iEnt, "models/sombreroos.mdl" );
}
else set_pev( iEnt, pev_effects, pev(iEnt, pev_effects) | EF_NODRAW);
}
}
public fwHamPlayerKilledPost(const id) {
if(pev_valid(g_bwEnt[id])) {
set_pev(g_bwEnt[id], pev_effects, pev(g_bwEnt[id], pev_effects) | EF_NODRAW);
}
}
stock get_loguser_index() { // author: VEN
new loguser[80], name[32];
read_logargv(0, loguser, 79);
parse_loguser(loguser, name, 31);
return get_user_index(name);
}
@cruze191, есть reapi?
@ThePhoenix, да есть
А зачем нужно было подключать целую библиотеку для использования лишь одной мессаги, если эту же мессагу можно использовать и без подключения библиотеки?!Тогда пробуй
Код:#include <amxmodx> #include <fakemeta> #include <hamsandwich> #include <reapi> new g_Enable; new g_bwEnt[33]; new g_CachedStringInfoTarget; new const DropTheBomb[] = "DropTheBomb.wav" // звук дропа new const PickedUpTheBomb[] = "PickedUpTheBomb.wav" // звук поднятия public plugin_init() { register_plugin( "Bomb Hat", "1.0", "Subb98" ); register_logevent("EventPickedUpTheBomb", 3, "2=Spawned_With_The_Bomb", "2=Got_The_Bomb"); register_logevent("EventDropTheBomb", 3, "2=Dropped_The_Bomb", "2=Planted_The_Bomb"); register_cvar("bomb_hat", "1.2", FCVAR_SERVER); g_Enable = register_cvar("amx_bombhat", "1"); RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawn"); RegisterHam(Ham_Killed, "player", "fwHamPlayerKilledPost", 1); g_CachedStringInfoTarget = engfunc( EngFunc_AllocString, "info_target" ); } public plugin_precache() { precache_model("models/sombreroos.mdl"); precache_sound(DropTheBomb) precache_sound(PickedUpTheBomb) } public EventPickedUpTheBomb() { new id = get_loguser_index(); if(pev_valid(g_bwEnt[id])) { set_pev(g_bwEnt[id], pev_effects, pev(g_bwEnt[id], pev_effects) & ~EF_NODRAW); rg_send_audio(id, fmt("sound/%s", PickedUpTheBomb)); } } public EventDropTheBomb() { new id = get_loguser_index(); if(pev_valid(g_bwEnt[id])) { set_pev(g_bwEnt[id], pev_effects, pev(g_bwEnt[id], pev_effects) | EF_NODRAW); rg_send_audio(id, fmt("sound/%s", DropTheBomb)); } } public fwHamPlayerSpawn( const player ) { if ( get_pcvar_num( g_Enable ) && is_user_alive( player ) ) { new iEnt = g_bwEnt[ player ]; if( !pev_valid( iEnt ) ) { g_bwEnt[ player ] = iEnt = engfunc ( EngFunc_CreateNamedEntity, g_CachedStringInfoTarget ); set_pev( iEnt, pev_movetype, MOVETYPE_FOLLOW ); set_pev( iEnt, pev_aiment, player ); set_pev( iEnt, pev_effects, pev(iEnt, pev_effects) | EF_NODRAW); engfunc( EngFunc_SetModel, iEnt, "models/sombreroos.mdl" ); } else set_pev( iEnt, pev_effects, pev(iEnt, pev_effects) | EF_NODRAW); } } public fwHamPlayerKilledPost(const id) { if(pev_valid(g_bwEnt[id])) { set_pev(g_bwEnt[id], pev_effects, pev(g_bwEnt[id], pev_effects) | EF_NODRAW); } } stock get_loguser_index() { // author: VEN new loguser[80], name[32]; read_logargv(0, loguser, 79); parse_loguser(loguser, name, 31); return get_user_index(name); }