#include <amxmodx>
#include <hamsandwich>
#include <reapi>
#if AMXX_VERSION_NUM < 183
#include <colorchat>
#define MAX_NAME_LENGTH 32
#endif
#define ADMIN_FLAG ADMIN_LEVEL_H //игроки с каким флагом могут отбирать бомбу
#define PL_VERSION "0.0.1b"
#define PLAYER_USE_RADIUS 75
#define IsUserVip(%1) (get_user_flags(%1) & ADMIN_FLAG)
public plugin_init()
{
register_plugin("Bomb Taker", PL_VERSION, "Vaqtincha")
if(bool:get_member_game(m_bMapHasBombTarget))
{
RegisterHam(Ham_ObjectCaps, "bot", "CBasePlayer_ObjectCaps", .Post = false)
RegisterHam(Ham_ObjectCaps, "player", "CBasePlayer_ObjectCaps", .Post = false)
RegisterHam(Ham_Use, "bot", "CBasePlayer_PlayerUse", .Post = true)
RegisterHam(Ham_Use, "player", "CBasePlayer_PlayerUse", .Post = true)
register_event("StatusValue", "Event_StatusValue_Show", "be", "1=3"/*HEALTH*/, "2>0")
}
else {
pause("ad")
}
}
public CBasePlayer_ObjectCaps(const pPlayer)
{
SetHamReturnInteger(FCAP_ONOFF_USE)
return HAM_SUPERCEDE
}
public CBasePlayer_PlayerUse(const pPlayer, const pActivator, const pCaller, const use_type, const Float:value)
{
new name1[MAX_NAME_LENGTH], name2[MAX_NAME_LENGTH];
if(value == 0.0 || !is_user_alive(pActivator) || get_member(pActivator, m_iTeam) != TEAM_TERRORIST)
return
if(is_user_alive(pPlayer) && CanUseThisPlayer(pPlayer)) {
rg_transfer_c4(pPlayer, pActivator)
get_entvar(pActivator, var_netname, name1, charsmax(name1));
get_entvar(pPlayer, var_netname, name2, charsmax(name2));
// client_print_color(pPlayer,0, "^1[^4FZM^1] ^3%s ^1забрал у вас бомбу", name1);
// client_print_color(pActivator,0, "^1[^4FZM^1] Вы забрали бомбу у ^3%s", name2);
}
}
public Event_StatusValue_Show(const pPlayer)
{
if(get_member(pPlayer, m_iTeam) != TEAM_TERRORIST)
return
new pTarget, iBody
get_user_aiming(pPlayer, pTarget, iBody, PLAYER_USE_RADIUS)
}
stock bool:CanUseThisPlayer(pPlayer)
{
if(!get_member(pPlayer, m_bHasC4) && !IsUserVip(pPlayer))
return false
else
return true
}