C4 Taker
Posted: 2017 Jan 02 18:45

Gal kas gali paredaguoti šitą kodą ir įterpti tekstą kaip screene - HUD tekstą su užrašu.
Jeigu kas patvarkytų - tai būtų galima perkelt į internete rasti pluginai skyrių ir platint masiniam naudojimui, nes geras dalykas su šiuolaikiniais žaidėjais kurie nededa to C4.
Code: Select all
/* AMX Mod X* Steal the Bomb** (c) Copyright 2006 by VEN/Satan** This file is provided as is (no warranties)** - to take the bomb:* - come close to the carrier (distance < 50, configurable)* - aim at the carrier* - USE the carrier (i.e. "+use" command which usually bound to the "E" key)* - appropriate barney speak sound would be played:* - for both persons: to indicate that menu is opened* - for recipient: to indicate that bomb queries is restricted by the current carrier* - bomb carrier's menu contains 3 items:* - 1. "Yes": transfers the bomb to the recipient (transfers, not just drops)* - 2. "No": refuses to transfer the bomb* - 3. "No, don't ask me again": refuses and disables menu queries for that carrier for the current round* - after selection appropriate barney speak sound would be played for recipient to indicate the carrier's choice* - menu display time is 7 seconds (configurable)* - if no menu item is selected while menu is opened, bomb would be transferred to the recipient automatically* - plugin will have no effect at non-bomb maps* - fakemeta module required** Credits: * ^_^Satan^_^: Idea, original coding.* VEN: This coding :P** Versions:* 3.2 - backpack transfer method improved* 3.1 - now it's not possible to "ask" if bomb is planting* now "ask" restriction clears after bomb drop* get carrier id method changed to more efficient one* 3.0 - now fakemeta module instead of engine required* prethink method changed to use-sound hook* some other changes*/ #include <amxmodx>#include <fakemeta> // plugin's main information#define PLUGIN_NAME "Steal the Bomb"#define PLUGIN_VERSION "3.2"#define PLUGIN_AUTHOR "VEN/Satan" #define MAX_DISTANCE 200 #define TASK_ID 594753#define TEAM_T 1 #define IN_USE (1<<5)#define FL_ONGROUND (1<<9) new SOUND_DONT[] = "spk barney/dontaskme"new USE_SOUND[] = "common/wpn_denyselect.wav" new DROP[] = "drop"new WEAPON[] = "weapon_c4"new CLASSNAME[] = "classname" new g_stealernew g_carrier new bool:g_dontasknew bool:g_planting new g_maxplayers public plugin_init() { register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR) if (!engfunc(EngFunc_FindEntityByString, -1, CLASSNAME, "func_bomb_target")) return register_event("WeapPickup", "event_got_bomb", "be", "1=6") register_event("BarTime", "event_bar_time", "be") register_event("TextMsg", "clear", "bc", "2=#Game_bomb_drop") register_event("TextMsg", "clear", "a", "2=#Bomb_Planted") register_event("HLTV", "clear", "a", "1=0", "2=0") register_forward(FM_EmitSound, "forward_emit_sound") g_maxplayers = get_maxplayers()} public forward_emit_sound(id, channel, sound[]) { if (id > g_maxplayers || !id || !equali(sound, USE_SOUND) || !g_carrier || g_planting || !is_user_alive(id) || get_user_team(id) != TEAM_T || !(pev(id, pev_button) & IN_USE) || task_exists(TASK_ID)) return FMRES_IGNORED new id2, body, Float:distance = get_user_aiming(id, id2, body) if (id2 != g_carrier || !is_user_alive(id2) || distance > MAX_DISTANCE) return FMRES_IGNORED if (g_dontask) { client_cmd(id, SOUND_DONT) return FMRES_SUPERCEDE } g_stealer = id set_task(0.1, "task_bomb_drop", TASK_ID) return FMRES_SUPERCEDE} public task_bomb_drop() { if (!g_planting && check()) transfer()} bool:check() { if (!is_user_alive(g_stealer) || !is_user_alive(g_carrier) || get_user_team(g_stealer) != TEAM_T) return false return true} bool:transfer() { new stealer = g_stealer engclient_cmd(g_carrier, DROP, WEAPON) new c4 = engfunc(EngFunc_FindEntityByString, -1, CLASSNAME, WEAPON) if (!c4) return false new backpack = pev(c4, pev_owner) if (backpack <= g_maxplayers) return false set_pev(backpack, pev_flags, pev(backpack, pev_flags) | FL_ONGROUND) dllfunc(DLLFunc_Touch, backpack, stealer) return true} public event_got_bomb(id) { g_carrier = id} public event_bar_time(id) { if (id == g_carrier) g_planting = bool:read_data(1)} public clear() { remove_task(TASK_ID) g_stealer = 0 g_carrier = 0 g_dontask = false g_planting = false}