Plugin Cerut: c4 sabotaj
Descriere (adica ce face el mai exact): cand gasesti bomba c4 si esti CT ti apasat pe ea si se incarca ca si cand ai planta o iar cand tero o pune explodeaza imediat si pierde runda ca si cand ar dezactiva o un CT , si tero la randul sau poate sa o repare tinand apasat E pe ea , mesaje la coechipieri in chat ca ai sabotat-o si invers la echipa adversa ca a reparat o
Ai cautat pluginul?(daca da, precizeaza cum): am cautat dar n-am gasit
Serverul impune conditii strict HLDS/REHLDS?: rehlds
Necesita mod special?: nu
Versiune AMXX Server: 1.9.0
[Cerere Plugin] c4 sabotaj
Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com
Forum rules
Accesează link-ul pentru a putea vedea regulile forumului
Daca doriti sa vi se modifice un plugin, va rugam postati aici .
Accesează link-ul pentru a putea vedea regulile forumului
Daca doriti sa vi se modifice un plugin, va rugam postati aici .
-
- Membru, skill +1
- Posts: 104
- Joined: 30 Mar 2021, 23:14
- Detinator Steam: Nu
- CS Status: Citesc forumul eXtreamCS.com...!
- Fond eXtream: 0
- Has thanked: 4 times
- Been thanked: 1 time
-
- Membru, skill +1
- Posts: 104
- Joined: 30 Mar 2021, 23:14
- Detinator Steam: Nu
- CS Status: Citesc forumul eXtreamCS.com...!
- Fond eXtream: 0
- Has thanked: 4 times
- Been thanked: 1 time
up!
-
- Membru, skill +1
- Posts: 104
- Joined: 30 Mar 2021, 23:14
- Detinator Steam: Nu
- CS Status: Citesc forumul eXtreamCS.com...!
- Fond eXtream: 0
- Has thanked: 4 times
- Been thanked: 1 time
up!
-
- Membru, skill 0
- Posts: 12
- Joined: 11 Feb 2023, 14:34
- Detinator Steam: Nu
- CS Status: Citesc forumul eXtreamCS.com...!
- Fond eXtream: 0
Cred ca asta e
Code: Select all
///■■■■■■■■■■■■■■■■■■■■■■■ CONFIG START ■■■■■■■■■■■■■■■■■■■■■■■//
// #define CRACK_WITH_ONLY_DEFUSER // Можно взломать блмбу только с щипцами
#define CRACK_TIME 5 // Время разминирование в секундах (с щипцами 2 раза быстрее)
// #define FIXING_TIME 10 // Время исправление бомбы в секундах (чтоб запретить просто закомментируйте)
#define BOMB_DETONATE_TIME 3 // Время взрыва после плента (0 = сразу)
#define BOMB_RADIUS 200 // Радиус взрыва. Закомментить если нужен дефолтный (по дефолту 500 юнитов)
#define BOMB_USE_SAMPLE "weapons/c4_disarmed.wav" // Звук при "USE" (закомментируйте, если не нужен)
///■■■■■■■■■■■■■■■■■■■■■■■■ CONFIG END ■■■■■■■■■■■■■■■■■■■■■■■■//
// #define TEST_PRINT_CHAT // для тестов
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <reapi>
#define PL_VERSION "0.5"
#define MAX_BOMB_RADIUS 2048.0
#define IsPlayer(%1) (1 <= %1 <= MaxClients)
new g_pBombCracker, g_pBombPlanter, g_pBombFixer
new bool:g_bStartDefuse, bool:g_bHasCracked, bool:g_bStartFix
new Float:g_flFixCountDown, Float:g_flNextFix, Float:g_flDefuseCountDown, Float:g_flNextDefuse
#if defined BOMB_RADIUS
new Float:g_flBombRadiusDefault
#endif
#if defined BOMB_USE_SAMPLE
public plugin_precache() {
precache_sound(BOMB_USE_SAMPLE)
}
#endif
public plugin_init()
{
register_plugin("CT Bomb Cracker", PL_VERSION, "Vaqtincha")
if (!get_member_game(m_bMapHasBombTarget))
{
pause("ad")
return
}
register_message(get_user_msgid("BarTime"), "Message_BarTime")
RegisterHam(Ham_Think, "weaponbox", "CWeaponbox_Think", .Post = false)
RegisterHam(Ham_ObjectCaps, "weaponbox", "CWeaponbox_ObjectCaps", .Post = false)
RegisterHam(Ham_Use, "weaponbox", "CWeaponbox_Use", .Post = false)
RegisterHam(Ham_Item_AddToPlayer, "weapon_c4", "CBasePlayerItem_AddToPlayer", .Post = true)
RegisterHookChain(RG_PlantBomb, "PlantBomb", .post = true)
RegisterHookChain(RG_RoundEnd, "RoundEnd", .post = false)
RegisterHookChain(RG_CSGameRules_RestartRound, "CSGameRules_RestartRound", .post = false)
#if defined BOMB_RADIUS
g_flBombRadiusDefault = Float:get_member_game(m_flBombRadius)
#endif
}
public client_disconnected(pPlayer)
{
if (pPlayer == g_pBombCracker) {
g_pBombCracker = 0
}
else if (pPlayer == g_pBombPlanter) {
g_pBombPlanter = 0
}
else if (pPlayer == g_pBombFixer) {
g_pBombFixer = 0
}
}
public Message_BarTime(const iMsgId, const iMsgType, const pPlayer)
{
if (!g_bHasCracked)
return
const C4_ARMING_ON_TIME = 3
const MsgBarTime_Arg_Time = 1
new iTime = get_msg_arg_int(MsgBarTime_Arg_Time)
if (iTime == C4_ARMING_ON_TIME && BombPlanting(pPlayer))
{
set_msg_arg_int(MsgBarTime_Arg_Time, ARG_SHORT, iTime - 1)
}
}
public CSGameRules_RestartRound()
{
#if defined BOMB_RADIUS
if (g_flBombRadiusDefault > 0.0) {
set_member_game(m_flBombRadius, g_flBombRadiusDefault)
}
#endif
g_bStartDefuse = g_bHasCracked = g_bStartFix = false
g_flDefuseCountDown = g_flNextDefuse = g_flFixCountDown = g_flNextFix = 0.0
g_pBombCracker = g_pBombPlanter = g_pBombFixer = 0
}
public RoundEnd(const WinStatus:status, const ScenarioEventEndRound:event, const Float:tmDelay)
{
if (!g_bHasCracked)
return HC_CONTINUE
if (status == WINSTATUS_TERRORISTS && event == ROUND_TARGET_BOMB)
{
if (is_user_connected(g_pBombPlanter))
set_entvar(g_pBombPlanter, var_frags, get_entvar(g_pBombPlanter, var_frags) - 3.0)
rg_round_end(tmDelay, WINSTATUS_CTS, ROUND_BOMB_DEFUSED)
rg_update_teamscores(.iCtsWins = 1)
SetHookChainReturn(ATYPE_BOOL, false)
return HC_SUPERCEDE
}
return HC_CONTINUE
}
public PlantBomb(const pPlayer, Float:vecStart[3], Float:vecVelocity[3])
{
if (!g_bHasCracked)
return HC_CONTINUE
g_pBombPlanter = pPlayer
if (is_user_connected(g_pBombPlanter))
{
if (random(5) < 3)
client_print_color(g_pBombPlanter, print_team_default, "^4* ^1Wait ^3%d ^1seconds.", BOMB_DETONATE_TIME)
else
client_print_color(g_pBombPlanter, print_team_default, "^4* ^1You have ^3%d ^1sec. to save your ass", BOMB_DETONATE_TIME)
}
new pBomb = GetHookChainReturn(ATYPE_INTEGER)
if (!is_nullent(pBomb)) {
set_member(pBomb, m_Grenade_flC4Blow, get_gametime() + BOMB_DETONATE_TIME.0)
}
#if defined BOMB_RADIUS
set_member_game(m_flBombRadius, floatmin(BOMB_RADIUS.0, MAX_BOMB_RADIUS))
#endif
return HC_CONTINUE
}
public CBasePlayerItem_AddToPlayer(const pWeapon, const pPlayer)
{
if (pWeapon <= 0)
return HAM_IGNORED
new pWeaponBox = get_entvar(pWeapon, var_owner)
if (FClassnameIs(pWeaponBox, "weaponbox"))
{
set_task(0.2, "CWeaponBox_Killed", pWeaponBox)
}
return HAM_IGNORED
}
// Кто-то поднял бомбу при дефузе/фиксе отменим все
public CWeaponBox_Killed(const pWeaponBox)
{
if (is_nullent(pWeaponBox))
{
// server_print("g_bStartFix %s g_bStartDefuse %s", g_bStartFix ? "true":"false", g_bStartDefuse ? "true":"false")
if (g_bStartFix)
{
FinishDefuse(g_pBombFixer)
g_pBombFixer = 0
}
if (g_bStartDefuse)
{
FinishDefuse(g_pBombCracker)
g_pBombCracker = 0
}
}
}
public CWeaponbox_Think(const pWeaponBox)
{
if (pWeaponBox <= 0 || !IsPlayer(g_pBombCracker) || !get_member(pWeaponBox, m_WeaponBox_bIsBomb))
return HAM_IGNORED
new Float:flCurTime = get_gametime()
if (g_bStartDefuse)
{
if (flCurTime < g_flDefuseCountDown)
{
if (flCurTime > g_flNextDefuse)
{
FinishDefuse(g_pBombCracker)
g_pBombCracker = 0
return HAM_IGNORED
}
}
else if (flCurTime >= g_flDefuseCountDown && get_entvar(g_pBombCracker, var_deadflag) == DEAD_NO)
{
client_print(g_pBombCracker, print_center, "You successfully broke the bomb!")
FinishDefuse(g_pBombCracker)
PrintChatAll(g_pBombCracker, TEAM_CT)
g_pBombFixer = 0
g_bHasCracked = true
}
else
{
FinishDefuse(g_pBombCracker)
g_pBombCracker = 0
}
// CWeaponBox::BombThink() nextthink = 1.0
set_entvar(pWeaponBox, var_nextthink, flCurTime + 0.2)
return HAM_SUPERCEDE
}
else if (g_bStartFix)
{
if (flCurTime < g_flFixCountDown)
{
if (flCurTime > g_flNextFix)
{
FinishDefuse(g_pBombFixer)
g_pBombFixer = 0
return HAM_IGNORED
}
}
else if (flCurTime >= g_flFixCountDown && get_entvar(g_pBombFixer, var_deadflag) == DEAD_NO)
{
client_print(g_pBombFixer, print_center, "You have successfully fixed the bomb!")
FinishDefuse(g_pBombFixer)
PrintChatAll(g_pBombFixer, TEAM_TERRORIST)
g_pBombCracker = 0
g_bHasCracked = false
}
else
{
FinishDefuse(g_pBombFixer)
g_pBombFixer = 0
}
// CWeaponBox::BombThink() nextthink = 1.0
set_entvar(pWeaponBox, var_nextthink, flCurTime + 0.2)
return HAM_SUPERCEDE
}
return HAM_IGNORED
}
public CWeaponbox_ObjectCaps(const pWeaponBox)
{
if (pWeaponBox <= 0 || !get_member(pWeaponBox, m_WeaponBox_bIsBomb))
return HAM_IGNORED
SetHamReturnInteger(FCAP_CONTINUOUS_USE | FCAP_ONOFF_USE) // FCAP_ONOFF_USE unpressed button hook (value == 0.0)
return HAM_SUPERCEDE
}
public CWeaponbox_Use(const pWeaponBox, const pPlayer, const pCaller, const use_type, const Float:value)
{
if (pWeaponBox <= 0 || !IsPlayer(pPlayer) /* || !IsOnGround(pWeaponBox) */ )
return HAM_IGNORED
new TeamName:iTeam = get_member(pPlayer, m_iTeam)
new Float:flCurTime = get_gametime()
#if !defined FIXING_TIME
if (iTeam != TEAM_CT)
return HAM_SUPERCEDE
#else
if (iTeam == TEAM_CT)
#endif
{
if (g_bHasCracked)
{
if (g_pBombCracker != pPlayer)
client_print(pPlayer, print_center, "The bomb is already broken!")
return HAM_SUPERCEDE
}
if (value == 1.0)
{
#if defined CRACK_WITH_ONLY_DEFUSER
if (!get_member(pPlayer, m_bHasDefuser))
{
client_print(pPlayer, print_center, "You can crack the bomb only with tongs!")
return HAM_SUPERCEDE
}
#endif
if (g_bStartDefuse)
{
g_flNextDefuse = flCurTime + 0.2
return HAM_SUPERCEDE
}
#if defined CRACK_WITH_ONLY_DEFUSER
new iSeconds = CRACK_TIME
#else
new iSeconds = (get_member(pPlayer, m_bHasDefuser) ? (CRACK_TIME / 2) : CRACK_TIME)
#endif
g_bStartDefuse = true
g_pBombCracker = pPlayer
g_flDefuseCountDown = flCurTime + float(iSeconds)
g_flNextDefuse = flCurTime + 0.2
StartDefuse(pPlayer, pWeaponBox, iSeconds)
}
else if (value == 0.0)
{
FinishDefuse(pPlayer)
g_pBombCracker = 0
}
}
#if defined FIXING_TIME
else if (iTeam == TEAM_TERRORIST)
{
if (!g_bHasCracked)
{
if (g_pBombFixer != pPlayer)
client_print(pPlayer, print_center, "Bomb repaired!")
return HAM_SUPERCEDE
}
if (value == 1.0)
{
if (g_bStartFix)
{
g_flNextFix = flCurTime + 0.2
return HAM_SUPERCEDE
}
g_bStartFix = true
g_pBombFixer = pPlayer
g_flFixCountDown = flCurTime + float(FIXING_TIME)
g_flNextFix = flCurTime + 0.2
StartDefuse(pPlayer, pWeaponBox, FIXING_TIME)
}
else if (value == 0.0)
{
FinishDefuse(pPlayer)
g_pBombFixer = 0
}
}
#endif
return HAM_IGNORED
}
StartDefuse(const pPlayer, const pWeaponBox, const iTime)
{
#if defined BOMB_USE_SAMPLE
emit_sound(pWeaponBox, CHAN_WEAPON, BOMB_USE_SAMPLE, VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
#endif
rg_send_bartime(pPlayer, iTime)
set_member(pPlayer, m_bShieldDrawn, true)
}
FinishDefuse(const pPlayer)
{
g_bStartDefuse = g_bStartFix = false
g_flDefuseCountDown = g_flNextDefuse = g_flFixCountDown = g_flNextFix = 0.0
if (is_user_connected(pPlayer))
{
rg_send_bartime(pPlayer, 0) // reset bartime
set_member(pPlayer, m_bShieldDrawn, false)
}
}
PrintChatAll(const pPlayer, const TeamName:iTeam)
{
new iPlayers[32], szTempMsg[140], iCount, pReceiver
if (iTeam == TEAM_TERRORIST)
{
get_players_ex(iPlayers, iCount, GetPlayers_ExcludeDead | GetPlayers_ExcludeBots | GetPlayers_MatchTeam, "TERRORIST")
switch (random_num(1, 5))
{
case 1: formatex(szTempMsg, charsmax(szTempMsg), "^4* ^3%n ^1Noticed a broken bomb in time and fixed it.", pPlayer)
case 2: formatex(szTempMsg, charsmax(szTempMsg), "^4* ^1Bomb successfully fixed ^3%n", pPlayer)
case 3: formatex(szTempMsg, charsmax(szTempMsg), "^3%n^4: ^1Hey losers i fixed the bomb.", pPlayer)
case 4: formatex(szTempMsg, charsmax(szTempMsg), "^4* ^1Golden hands at^3%n", pPlayer)
case 5: formatex(szTempMsg, charsmax(szTempMsg), "^3%n^4: ^1Now it's safe to plant the bomb.", pPlayer)
}
}
else
{
get_players_ex(iPlayers, iCount, GetPlayers_ExcludeDead | GetPlayers_ExcludeBots | GetPlayers_MatchTeam, "CT")
switch (random_num(1, 5))
{
case 1: formatex(szTempMsg, charsmax(szTempMsg), "^3%n^4: ^1Don't stop the terrorists from planting the bomb.", pPlayer)
case 2: formatex(szTempMsg, charsmax(szTempMsg), "^4* ^3%n ^1Left a gift to the terrorists. :D", pPlayer)
case 3: formatex(szTempMsg, charsmax(szTempMsg), "^4* ^1Looks like ^3%n ^1 wanted to play a joke on the terrorists.", pPlayer)
case 4: formatex(szTempMsg, charsmax(szTempMsg), "^4* ^1Your teammate ^3%n ^1 broke the bomb. xD", pPlayer)
case 5: formatex(szTempMsg, charsmax(szTempMsg), "^4* ^1Carefully! ^3%n ^1 just broke a bomb.", pPlayer)
}
}
for (--iCount; iCount >= 0; iCount--)
{
pReceiver = iPlayers[iCount]
#if !defined TEST_PRINT_CHAT
if (pPlayer == pReceiver)
continue
#endif
client_print_color(pReceiver, print_team_default, "%s", szTempMsg)
}
}
stock bool:BombPlanting(const pPlayer)
{
if (!get_member(pPlayer, m_bHasC4))
return false
new pActiveItem = get_member(pPlayer, m_pActiveItem)
return bool:(FClassnameIs(pActiveItem, "weapon_c4") && get_member(pActiveItem, m_C4_bStartedArming))
}