[ReAPI] Healthnade 0.0.9f

Статус
В этой теме нельзя размещать новые ответы.
Сообщения
10
Реакции
0
Ошибка
Ошибок нету
ОС
Linux
Amx Mod X
amxx version
AMX Mod X 1.9.0.5294 (http://www.amxmodx.org)
Authors:
David "BAILOPAN" Anderson, Pavol "PM OnoTo" Marko
Felix "SniperBeamer" Geyer, Jonny "Got His Gun" Bergstrom
Lukasz "SidLuke" Wlasinski, Christian "Basic-Master" Hammacher
Borja "faluco" Ferrer, Scott "DS" Ehlert
Compiled: Dec 3 2021 15:54:56
Built from: https://github.com/alliedmodders/amxmodx/commit/363871a
Build ID: 5294:363871a
Core mode: JIT+ASM32
Билд
version
Protocol version 48
Exe version 1.1.2.7/Stdio (cstrike)
ReHLDS version: 3.12.0.780-dev
Build date: 16:20:56 Sep 19 2022 (3082)
Build from: https://github.com/dreamstalker/rehlds/commit/d6ebe82
ReGamedll
game version
ReGameDLL version: 5.21.0.556-dev
Build date: 08:50:42 Jul 22 2022
Build from: https://github.com/s1lentq/ReGameDLL_CS/commit/1081301
Версия Metamod
meta version
Metamod-r v1.3.0.131, API (5:13)
Metamod-r build: 18:51:02 Jul 11 2022
Metamod-r from: https://github.com/theAsmodai/metamod-r/commit/adc9414
Список метамодулей
meta list
Currently loaded plugins:
description stat pend file vers src load unload
[ 1] Rechecker RUN - rechecker.so v2.7 ini ANY
[ 2] Reunion RUN - reunion.so v0.1.0.137 ini Start Never
[ 3] AMX Mod X RUN - amxmodx.so v1.9.0.5294 ini Start ANY
[ 4] ReSemiclip RUN - resemiclip.so v2.3.9 ini ANY
[ 5] Revoice RUN - revoice.so v0.1.0.34 ini Start Never
[ 6] WHBlocker RUN - whblocker.so v1.5.697 ini ANY
[ 7] CStrike RUN - cstrike_amxx_i386.so v1.9.0.5294 pl3 ANY
[ 8] CSX RUN - csx_amxx_i386.so v1.9.0.5294 pl3 ANY
[ 9] gRIP RUN - grip_amxx_i386.so v0.1.5 Beta pl3 ANY
[10] ReAPI RUN - reapi_amxx_i386.so v5.22.0.254-dev pl3 ANY Never
[11] MySQL RUN - mysql_amxx_i386.so v1.9.0.5294 pl3 ANY ANY
[12] Ham Sandwich RUN - hamsandwich_amxx_i386.so v1.9.0.5294 pl3 ANY ANY
[13] Engine RUN - engine_amxx_i386.so v1.9.0.5294 pl3 ANY ANY
[14] FakeMeta RUN - fakemeta_amxx_i386.so v1.9.0.5294 pl3 ANY ANY
[15] Fun RUN - fun_amxx_i386.so v1.9.0.5294 pl3 ANY ANY
[16] GeoIP RUN - geoip_amxx_i386.so v1.9.0.5294 pl3 ANY ANY
16 plugins, 16 running
Список плагинов
amxx plugins
Currently loaded plugins:
name version author file status
[ 1] GameCMS_API 5.6.2 zhorzh78 gamecms_api_5.6 running
[ 2] GameCMS_Registration 1.5 zhorzh78 gamecms_registr running
[ 3] Bypass Guard 1.0.1 mx?! bypass_guard.am running
[ 4] [182] Ultimate Weapons 22.11.15 SKAJIbnEJIb ultimate_weapon running
[ 5] [190] Ultimate Flags 22.11.15 SKAJIbnEJIb ultimate_flags. running
[ 6] [190] StatsX Unlimited 22.12.08 SKAJIbnEJIb statsx_unlimite running
[ 7] Admin Commands 1.9.0.5294 AMXX Dev Team admincmd.amxx running
[ 8] Players Menu 1.9.0.5294 AMXX Dev Team plmenu.amxx running
[ 9] [190] VIP RBS 20.07.20 SKAJIbnEJIb vip_rbs.amxx running
[ 10] Admin Help 1.9.0.5294 AMXX Dev Team adminhelp.amxx running
[ 11] [190] MapChooser RBS 20.08.02 SKAJIbnEJIb & UF mapchooser_rbs. running
[ 12] [190] NextMap 18.09.25 SKAJIbnEJIb & AM nextmap.amxx running
[ 13] Teleport Menu 1.9.0.5294 AMXX Dev Team telemenu.amxx running
[ 14] [190] VoteBan RBS 20.06.06 SKAJIbnEJIb voteban_rbs.amx running
[ 15] [190] MOTD RBS 21.03.23 SKAJIbnEJIb motd_rbs.amxx running
[ 16] [190] Skill ELO 22.11.15 SKAJIbnEJIb skill_elo.amxx running
[ 17] [190] CsStats MySQL 22.11.15 SKAJIbnEJIb csstats_mysql.a running
[ 18] [190] Ultimate Gag 21.01.02BE SKAJIbnEJIb ultimate_gag.am running
[ 19] Anti Flood 1.9.0.5294 AMXX Dev Team antiflood.amxx running
[ 20] [190] Chat RBS 20.06.06 SKAJIbnEJIb chat_rbs.amxx running
[ 21] Menus Front-End 1.9.0.5271 AMXX Dev Team menufront.amxx running
[ 22] Plugin Menu 1.9.0.5294 AMXX Dev Team pluginmenu.amxx running
[ 23] Restrict Weapons 1.9.0.5294 AMXX Dev Team restmenu.amxx running
[ 24] CS Misc. Stats 1.9.0.5294 AMXX Dev Team miscstats.amxx running
[ 25] CS Stats Logging 1.9.0.5294 AMXX Dev Team stats_logging.a running
[ 26] Stats Configuration 1.9.0.5294 AMXX Dev Team statscfg.amxx running
[ 27] FreshBans 1.4.7b kanagava fresh_bans.amxx running
[ 28] ResetScore 1.1 Silenttt resetscore.amxx running
[ 29] [BG] Provider: iphub.i 0.5 mx?! bg_provider_iph running
[ 30] [182] DemoRecorder RBS 20.06.06 SKAJIbnEJIb demorecorder_rb running
[ 31] Rechecker Log 0.1 F@nt0M rc_log.amxx running
[ 32] Advert Messages 1.5.5 Radius advert_messages running
[ 33] Block Change Name 1.0 DJ_WEST block_change_na running
[ 34] Auto Team Balance Adva 1.5.1 Radius auto_team_balan running
[ 35] [190] Analizator 22.12.07BE SKAJIbnEJIb analizator.amxx running
[ 36] TimeLeft 1.9.0.5263 AMXX Dev Team timeleft.amxx running
[ 37] [190] Snipers RBS 20.06.06 SKAJIbnEJIb snipers_rbs.amx running
[ 38] [ReAPI] Molotov 2.5.1 wellasgood reapi_molotov.a running
[ 39] [190] Army Ranks Ultim 20.06.06 SKAJIbnEJIb army_ranks_ulti running
[ 40] Weapon Model + Sound R 1.2 GHW_Chronic ghw_weapon_repl running
[ 41] Nice Grenade 1.0 sector nade_messages.a running
[ 42] Mode 2x2 2.5re s1lent mode_2x2.amxx running
[ 43] [190] Parachute RBS 22.11.15 SKAJIbnEJIb & KR parachute_rbs.a running
[ 44] [190] ESP RBS 20.06.06 SKAJIbnEJIb & Ko esp_rbs.amxx running
[ 45] AntiFlash 2.1 Jack Daniel`s antiflash.amxx running
[ 46] AFK Control ReNew 1.2(a) neygomon new_afk_control running
[ 47] [ReAPI] Healthnade 0.0.9f DEV-CS.RU Commun reapi_healthnad running
[ 48] Revive Teammates: Core 1.1.0 ufame & Albertio rt_core.amxx running
[ 49] Revive Teammates: Plan 1.1.0 ufame & Albertio rt_planting.amx running
[ 50] Revive Teammates: Rest 1.1.0 ufame & Albertio rt_restrictions running
[ 51] Revive Teammates: Time 1.1.0 ufame & Albertio rt_timer.amxx running
[ 52] Revive Teammates: Effe 1.1.0 ufame & Albertio rt_effects.amxx running
[ 53] Revive Teammates: Soun 1.1.0 ufame & Albertio rt_sounds.amxx running
[ 54] Revive Teammates: Bonu 1.1.0 ufame & Albertio rt_bonus.amxx running
54 plugins, 54 running
Автор плагина
fantom BlackSignature ArKaNeMaN bizon
Версия плагина
0.0.9f
Исходный код
/*
Форк лечебной гранаты на основе Healthnade 0.0.2 от F@nt0M: https://dev-cs.ru/resources/992/

GitHub: https://github.com/Giferns/HealthNade

0.0.3f:
* Добавлена возможность пить зелье на ПКМ (спасибо AnonymousAmx, MayroN, Psycrow)
* Опция HEAL_AMOUNT переименована в HEAL_AMOUNT_THROW
* Добавлена опция HEAL_AMOUNT_DRINK
* Добавлены опции USAGE_MSG и FULL_HP_MSG
* Заменена модель в руках (v_) на модель с анимацией выпивания
* Добавлен звук выпивания (обрататие внимание, модель содержит другие пути к звукам!)

0.0.4f:
* Добавлена опция MIN_ROUND (минимальный раунд для автовыдачи по флагу)
0.0.5f:
* Добавлен натив HealthNade_GiveNade()
0.0.6f:
* Перенос параметров хилки в переменные сущности: https://github.com/Giferns/HealthNade/pull/1
0.0.7f:
* Добавлены квары и словарь
0.0.8f:
* Фикс учёта mp_nadedrops (теперь учитывает значение на лету)
* Добавлен недостающий учёт квара HealthNade_Give
* Значение квара HealthNade_Give по-умолчанию теперь 1 (было 0)
* Исправлена логика создания кастомного веапонбокса
0.0.9f:
* Добавлен квар HealthNade_SlotId
*/

new const PLUGIN_VERSION[] = "0.0.9f";

#pragma semicolon 1

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <reapi>
#include <xs>
#include <healthnade>

enum E_NadeDropType {
NadeDrop_Off = 0,
NadeDrop_On = 1,
NadeDrop_ByCvar = 2,
}

enum E_Cvars {
Float:Cvar_ExplodeRadius,
Float:Cvar_ThrowHealingAmount,
Float:Cvar_DrinkHealingAmount,
bool:Cvar_Give,
Cvar_Give_AccessFlags[16],
Cvar_Give_MinRound,
bool:Cvar_Msg_FullHp,
bool:Cvar_Msg_UsageHint,
E_NadeDropType:Cvar_NadeDrop,
InventorySlotType:Cvar_SlotId,
}
new gCvars[E_Cvars];
#define Cvar(%1) gCvars[Cvar_%1]

new const DICTIONARY_FILENAME[] = "HealthNade.ini";

#define LangS(%1) fmt("%l", %1)

const WeaponIdType:WEAPON_ID = WEAPON_SMOKEGRENADE;
const WeaponIdType:WEAPON_NEW_ID = WEAPON_GLOCK;
const WeaponIdType:WEAPON_FAKE_ID = WeaponIdType:75;
new const WEAPON_NAME[] = "weapon_smokegrenade";
new const AMMO_NAME[] = "HealthNade";
new const WEAPON_NEW_NAME[] = "reapi_healthnade/weapon_healthnade";
new const ITEM_CLASSNAME[] = "weapon_healthnade";
new const GRENADE_CLASSNAME[] = "healthnade";
const AMMO_ID = 16;
const InventorySlotType:ITEM_SLOT = GRENADE_SLOT;

new const VIEWMODEL[] = "models/reapi_healthnade/v_drink9.mdl";
new const WEAPONMODEL[] = "models/reapi_healthnade/p_healthnade.mdl";
new const WORLDMODEL[] = "models/reapi_healthnade/w_healthnade.mdl";
new const SOUND_PULLPIN[] = "weapons/holywater_pinpul.wav";
new const SOUND_DEPLOY[] = "weapons/holywater_deploy.wav";
new const SOUND_DRINK[] = "weapons/holywater_drink.wav";
new const SOUND_EXPLODE[] = "weapons/reapi_healthnade/heal.wav";
// TODO: Вынести остальные пути в константы

#define rg_get_current_round() (get_member_game(m_iTotalRoundsPlayed) + 1)

// copy_entvar(const iEntFrom, const iEntTo, const EntVar:iVar)
#define copy_entvar(%1,%2,%3) set_entvar(%2, %3, get_entvar(%1, %3))

new SpriteCylinder, SpriteExplode, SpriteShape;
new MsgIdWeaponList, MsgIdAmmoPickup, MsgIdStatusIcon, MsgIdScreenFade;
#if WEAPON_NEW_ID != WEAPON_GLOCK
new FwdRegUserMsg, MsgHookWeaponList;
#endif
new g_iCvarNadeDrops;

public plugin_precache() {
register_plugin("[ReAPI] Healthnade", PLUGIN_VERSION, "DEV-CS.RU Community");
register_dictionary(DICTIONARY_FILENAME);

InitCvars();

precache_generic("sprites/reapi_healthnade/weapon_healthnade.txt");
precache_generic("sprites/reapi_healthnade/640hud128.spr");

precache_model(VIEWMODEL);
precache_model(WEAPONMODEL);
precache_model(WORLDMODEL);

precache_sound(SOUND_PULLPIN);
precache_sound(SOUND_DEPLOY);
precache_sound(SOUND_DRINK);

SpriteExplode = precache_model("sprites/reapi_healthnade/heal_explode.spr");
SpriteShape = precache_model("sprites/reapi_healthnade/heal_shape.spr");
SpriteCylinder = precache_model("sprites/shockwave.spr");

precache_sound("weapons/reapi_healthnade/heal.wav");

#if WEAPON_NEW_ID != WEAPON_GLOCK
MsgIdWeaponList = get_user_msgid("WeaponList");
if (MsgIdWeaponList) {
MsgHookWeaponList = register_message(MsgIdWeaponList, "HookWeaponList");
} else {
FwdRegUserMsg = register_forward(FM_RegUserMsg, "RegUserMsg_Post", true);
}
#endif
}

public plugin_init() {
register_clcmd(WEAPON_NEW_NAME, "CmdSelect");

RegisterHookChain(RG_CBasePlayer_OnSpawnEquip, "CBasePlayer_OnSpawnEquip_Post", true);
RegisterHookChain(RG_CBasePlayer_Killed, "CBasePlayer_Killed_Pre", false);

RegisterHookChain(RG_CSGameRules_CleanUpMap, "CSGameRules_CleanUpMap_Post", true);
RegisterHookChain(RG_CBasePlayer_GiveAmmo, "CBasePlayer_GiveAmmo_Pre", false);
RegisterHookChain(RG_CBasePlayerWeapon_DefaultDeploy, "CBasePlayerWeapon_DefaultDeploy_Pre", false);

RegisterHam(Ham_Item_Deploy, WEAPON_NAME, "Item_Deploy_Post", true);
RegisterHam(Ham_Item_Holster, WEAPON_NAME, "Item_Holster_Post", true);

RegisterHam(Ham_Weapon_SecondaryAttack, WEAPON_NAME, "CBasePlayerWeapon_SecondaryAttack_Post", true);
RegisterHam(Ham_Item_PostFrame, WEAPON_NAME, "CBasePlayerWeapon_ItemPostFrame_Pre");

RegisterHookChain(RG_CBasePlayer_ThrowGrenade, "CBasePlayer_ThrowGrenade_Pre", false);

MsgIdAmmoPickup = get_user_msgid("AmmoPickup");
MsgIdStatusIcon = get_user_msgid("StatusIcon");
MsgIdScreenFade = get_user_msgid("ScreenFade");

#if WEAPON_NEW_ID == WEAPON_GLOCK
MsgIdWeaponList = get_user_msgid("WeaponList");
UTIL_WeapoList(
MSG_INIT, 0,
WEAPON_NEW_NAME,
AMMO_ID, 1,
-1, -1, Cvar(SlotId), 4, WEAPON_NEW_ID,
ITEM_FLAG_LIMITINWORLD | ITEM_FLAG_EXHAUSTIBLE
);
#else
if (FwdRegUserMsg) {
unregister_forward(FM_RegUserMsg, FwdRegUserMsg, true);
}
unregister_message(MsgIdWeaponList, MsgHookWeaponList);
#endif
}

#if WEAPON_NEW_ID != WEAPON_GLOCK
public RegUserMsg_Post(const name[]) {
if (strcmp(name, "WeaponList") == 0) {
MsgIdWeaponList = get_orig_retval();
MsgHookWeaponList = register_message(MsgIdWeaponList, "HookWeaponList");
}
}

public HookWeaponList(const msg_id, const msg_dest, const msg_entity) {
enum {
arg_name = 1,
arg_ammo1,
arg_ammo1_max,
arg_ammo2,
arg_ammo2_max,
arg_slot,
arg_position,
arg_id,
arg_flags,
};

if (msg_dest != MSG_INIT || WeaponIdType:get_msg_arg_int(arg_id) != WEAPON_NEW_ID) {
return PLUGIN_CONTINUE;
}

set_msg_arg_string(arg_name,WEAPON_NEW_NAME);
set_msg_arg_int(arg_ammo1, ARG_BYTE, AMMO_ID);
set_msg_arg_int(arg_ammo1_max, ARG_BYTE, 1);
set_msg_arg_int(arg_ammo2, ARG_BYTE, -1);
set_msg_arg_int(arg_ammo2_max, ARG_BYTE, -1);
set_msg_arg_int(arg_slot, ARG_BYTE, _:Cvar(SlotId) - 1);
set_msg_arg_int(arg_position, ARG_BYTE, 4);
set_msg_arg_int(arg_flags, ARG_BYTE, ITEM_FLAG_LIMITINWORLD | ITEM_FLAG_EXHAUSTIBLE);

return PLUGIN_CONTINUE;
}
#endif

public CBasePlayer_OnSpawnEquip_Post(const id) {
if (!Cvar(Give) || !UserHasFlagsS(id, Cvar(Give_AccessFlags))) {
return;
}

if(rg_get_current_round() < Cvar(Give_MinRound)) {
return;
}

giveNade(id);
}

public CBasePlayer_Killed_Pre(const id) {
if (Cvar(NadeDrop) == NadeDrop_Off) {
return;
}

if (Cvar(NadeDrop) == NadeDrop_ByCvar) {
switch (g_iCvarNadeDrops) {
case 0:
return;
case 1: {
new iItem = get_member(id, m_rgpPlayerItems, ITEM_SLOT);

if (is_nullent(iItem) || !FClassnameIs(iItem, ITEM_CLASSNAME)) {
return;
}
}
}
}

if (!get_member(id, m_rgAmmo, AMMO_ID)) {
return;
}

new eEnt, Float:fOrigin[3];

get_entvar(id, var_origin, fOrigin);

new Float:fVelocity[3];
get_entvar(id, var_velocity, fVelocity);
xs_vec_mul_scalar(fVelocity, 0.75, fVelocity);

eEnt = rg_create_entity("info_target");

if(is_nullent(eEnt)) {
return;
}

set_entvar(eEnt, var_classname, "healthnade_drop");

engfunc(EngFunc_SetOrigin, eEnt, fOrigin);
set_entvar(eEnt, var_movetype, MOVETYPE_TOSS);
set_entvar(eEnt, var_solid, SOLID_TRIGGER);
engfunc(EngFunc_SetModel, eEnt, WORLDMODEL);
engfunc(EngFunc_SetSize, eEnt, Float:{-6.0, -6.0, -1.0}, Float:{6.0, 6.0, 1.0});

set_entvar(eEnt, var_velocity, fVelocity);
SetThink(eEnt, "think_healthnade_drop");
set_entvar(eEnt, var_nextthink, get_gametime() + get_cvar_float("mp_item_staytime"));

SetTouch(eEnt, "touch_healthnade_drop");
}

public think_healthnade_drop(const eEnt) {
if(is_entity(eEnt)) {
set_entvar(eEnt, var_flags, FL_KILLME);
}
}

public touch_healthnade_drop(const eEnt, const id) {
if (
is_nullent(eEnt)
|| !is_user_connected(id)
|| get_member(id, m_rgAmmo, AMMO_ID)
) {
return;
}

set_entvar(eEnt, var_nextthink, -1.0);
set_entvar(eEnt, var_flags, FL_KILLME);

giveNade(id);
}

public CmdSelect(const id) {
if (!is_user_alive(id)) {
return PLUGIN_HANDLED;
}

new item = rg_get_player_item(id, ITEM_CLASSNAME, ITEM_SLOT);
if (item != 0 && get_member(id, m_pActiveItem) != item) {
rg_switch_weapon(id, item);
}
return PLUGIN_HANDLED;
}

public CSGameRules_CleanUpMap_Post() {
new ent = rg_find_ent_by_class(NULLENT, GRENADE_CLASSNAME, false);
while (ent > 0) {
destroyNade(ent);
ent = rg_find_ent_by_class(ent, GRENADE_CLASSNAME, false);
}

ent = rg_find_ent_by_class(NULLENT, "healthnade_drop", false);
while (ent > 0) {
destroyNade(ent);
ent = rg_find_ent_by_class(ent, "healthnade_drop", false);
}
}

public CBasePlayer_GiveAmmo_Pre(const id, const amount, const name[]) {
if (strcmp(name, AMMO_NAME) != 0) {
return HC_CONTINUE;
}

giveAmmo(id, amount, AMMO_ID, 1);
SetHookChainReturn(ATYPE_INTEGER, AMMO_ID);
return HC_SUPERCEDE;
}


public CBasePlayerWeapon_DefaultDeploy_Pre(const item, const szViewModel[], const szWeaponModel[], const iAnim, const szAnimExt[], const skiplocal) {
new UserId = get_member(item, m_pPlayer);

if (FClassnameIs(item, ITEM_CLASSNAME)) {
SetHookChainArg(2, ATYPE_STRING, VIEWMODEL);
SetHookChainArg(3, ATYPE_STRING, WEAPONMODEL);

if (Cvar(Msg_UsageHint)) {
client_print(UserId, print_center, "%L", UserId, "HEALTHNADE_USAGE_HINT");
}
}

new WeaponIdType:wid = WeaponIdType:rg_get_iteminfo(item, ItemInfo_iId);
if (wid != WEAPON_ID && wid != WEAPON_FAKE_ID) {
return HC_CONTINUE;
}

new lastItem = get_member(UserId, m_pLastItem);
if (is_nullent(lastItem) || item == lastItem) {
return HC_CONTINUE;
}

if (WeaponIdType:rg_get_iteminfo(lastItem, ItemInfo_iId) == WEAPON_ID) {
SetHookChainArg(6, ATYPE_INTEGER, 0);
}

return HC_CONTINUE;
}

public Item_Deploy_Post(const item) {
if (WeaponIdType:rg_get_iteminfo(item, ItemInfo_iId) == WEAPON_FAKE_ID) {
rg_set_iteminfo(item, ItemInfo_iId, WEAPON_ID);
}

new other = get_member(get_member(item, m_pPlayer), m_rgpPlayerItems, ITEM_SLOT);
while (!is_nullent(other)) {
if (item != other && WeaponIdType:rg_get_iteminfo(other, ItemInfo_iId) == WEAPON_ID) {
rg_set_iteminfo(other, ItemInfo_iId, WEAPON_FAKE_ID);
}
other = get_member(other, m_pNext);
}
}

public Item_Holster_Post(const item) {
new other = get_member(get_member(item, m_pPlayer), m_rgpPlayerItems, ITEM_SLOT);
while (!is_nullent(other)) {
if (item != other && WeaponIdType:rg_get_iteminfo(other, ItemInfo_iId) == WEAPON_FAKE_ID) {
rg_set_iteminfo(other, ItemInfo_iId, WEAPON_ID);
}
other = get_member(other, m_pNext);
}
}

enum {
HG_ANIMATION_IDLE = 0,
HG_ANIMATION_PULLPIN,
HG_ANIMATION_THROW,
HG_ANIMATION_DEPLOY,
HG_ANIMATION_DRINK
};

public CBasePlayerWeapon_SecondaryAttack_Post(weapon) {
if(!is_entity(weapon) || !FClassnameIs(weapon, ITEM_CLASSNAME)) {
return;
}

set_member(weapon, m_Weapon_flNextSecondaryAttack, 0.3);

if(get_member(weapon, m_flStartThrow) > 0.0) {
return;
}

new pPlayer = get_member(weapon, m_pPlayer);

new iBpAmmo = get_member(pPlayer, m_rgAmmo, AMMO_ID);

if(!iBpAmmo) {
return;
}

if(Float:get_entvar(pPlayer, var_health) >= Float:get_entvar(pPlayer, var_max_health)) {
if (Cvar(Msg_FullHp)) {
client_print(pPlayer, print_center, "%L", pPlayer, "HEALTHNADE_FULL_HP");
}

return;
}

const Float:fAnimTime = 3.15; // 63 frames / 20 fps
set_member(weapon, m_Weapon_flTimeWeaponIdle, fAnimTime);
set_member(weapon, m_Weapon_flNextPrimaryAttack, fAnimTime);
set_member(weapon, m_Weapon_flNextSecondaryAttack, fAnimTime);
SendWeaponAnimation(pPlayer, HG_ANIMATION_DRINK);
}

// PostFrame() а не WeaponIdle() т.к. при прожатых IN_ATTACK|IN_ATTACK2|IN_RELOAD WeaponIdle() не вызывается
// т.е. зажатие любой из этих кнопок приведёт к неработоспособности логики
public CBasePlayerWeapon_ItemPostFrame_Pre(weapon) {
if(/*!is_entity(weapon) || */!FClassnameIs(weapon, ITEM_CLASSNAME)) {
return;
}

if(get_member(weapon, m_Weapon_flTimeWeaponIdle) > 0.0) {
return;
}

new pPlayer = get_member(weapon, m_pPlayer);

if(get_entvar(pPlayer, var_weaponanim) != HG_ANIMATION_DRINK) {
return;
}

// Нам надо обеспечить вызов WeaponIdle()
// https://github.com/s1lentq/ReGameDLL_CS/blob/67cc153f5d0abab1e42b32a83ef4a470c8781a5c/regamedll/dlls/weapons.cpp#L1007
// https://github.com/s1lentq/ReGameDLL_CS/blob/67cc153f5d0abab1e42b32a83ef4a470c8781a5c/regamedll/dlls/weapons.cpp#L1019
// https://github.com/s1lentq/ReGameDLL_CS/blob/67cc153f5d0abab1e42b32a83ef4a470c8781a5c/regamedll/dlls/weapons.cpp#L1092
set_entvar(pPlayer, var_button, get_entvar(pPlayer, var_button) & ~(IN_ATTACK|IN_ATTACK2|IN_RELOAD));

new iBpAmmo = get_member(pPlayer, m_rgAmmo, AMMO_ID);

if(!iBpAmmo) {
return;
}

set_member(pPlayer, m_rgAmmo, iBpAmmo - 1, AMMO_ID);

// RetireWeapon() средствами regamedll если бпаммо нет, либо отправка анимации деплоя
// https://github.com/s1lentq/ReGameDLL_CS/blob/b979b5e84f36dc0eb870f97da670b700756217f1/regamedll/dlls/wpn_shared/wpn_smokegrenade.cpp#L225
set_member(weapon, m_flReleaseThrow, 0.1);

ExecuteHamB(Ham_TakeHealth, pPlayer, get_entvar(weapon, var_HealthNade_DrinkHealingAmount), DMG_GENERIC);
UTIL_ScreenFade(pPlayer);
}

stock SendWeaponAnimation(const id, const iAnimation) {
set_entvar(id, var_weaponanim, iAnimation);

message_begin(MSG_ONE_UNRELIABLE, SVC_WEAPONANIM, .player = id);
write_byte(iAnimation);
write_byte(0);
message_end();
}

public CBasePlayer_ThrowGrenade_Pre(const id, const item, const Float:vecSrc[3], const Float:vecThrow[3], const Float:time, const const usEvent) {
if (!FClassnameIs(item, ITEM_CLASSNAME)) {
return HC_CONTINUE;
}

new grenade = throwNade(id, item, vecSrc, vecThrow, time);
SetHookChainReturn(ATYPE_INTEGER, grenade);
return HC_SUPERCEDE;
}

public GrenadeTouch(const grenade, const other) {
if (!is_nullent(grenade)) {
explodeNade(grenade);
}
}

public GrenadeThink(const grenade) {
if (!is_nullent(grenade)) {
explodeNade(grenade);
}
}

giveNade(const id) {
new item = rg_get_player_item(id, ITEM_CLASSNAME, ITEM_SLOT);
if (item != 0) {
giveAmmo(id, 1, AMMO_ID, 1);
return item;
}

item = rg_create_entity(WEAPON_NAME, false);
if (is_nullent(item)) {
return NULLENT;
}

new Float:origin[3];
get_entvar(id, var_origin, origin);
set_entvar(item, var_origin, origin);
set_entvar(item, var_spawnflags, get_entvar(item, var_spawnflags) | SF_NORESPAWN);

set_member(item, m_Weapon_iPrimaryAmmoType, AMMO_ID);
set_member(item, m_Weapon_iSecondaryAmmoType, -1);

set_entvar(item, var_classname, ITEM_CLASSNAME);

set_entvar(item, var_HealthNade_Radius, Cvar(ExplodeRadius));
set_entvar(item, var_HealthNade_ThrowHealingAmount, Cvar(ThrowHealingAmount));
set_entvar(item, var_HealthNade_DrinkHealingAmount, Cvar(DrinkHealingAmount));

dllfunc(DLLFunc_Spawn, item);

set_member(item, m_iId, WEAPON_NEW_ID);

rg_set_iteminfo(item, ItemInfo_pszName, WEAPON_NEW_NAME);
rg_set_iteminfo(item, ItemInfo_pszAmmo1, AMMO_NAME);
rg_set_iteminfo(item, ItemInfo_iMaxAmmo1, 1);
rg_set_iteminfo(item, ItemInfo_iId, WEAPON_FAKE_ID);
rg_set_iteminfo(item, ItemInfo_iPosition, 4);
rg_set_iteminfo(item, ItemInfo_iWeight, 1);

dllfunc(DLLFunc_Touch, item, id);

if (get_entvar(item, var_owner) != id) {
set_entvar(item, var_flags, FL_KILLME);
return NULLENT;
}

return item;
}

giveAmmo(const id, const amount, const ammo, const max) {
if (get_entvar(id, var_flags) & FL_SPECTATOR) {
return;
}

new count = get_member(id, m_rgAmmo, ammo);
new add = min(amount, max - count);
if (add < 1) {
return;
}

set_member(id, m_rgAmmo, count + add, ammo);

emessage_begin(MSG_ONE, MsgIdAmmoPickup, .player = id);
ewrite_byte(ammo);
ewrite_byte(add);
emessage_end();
}

throwNade(const id, const item, const Float:vecSrc[3], const Float:vecThrow[3], const Float:time) {
new grenade = rg_create_entity("info_target", false);
if (is_nullent(grenade)) {
return 0;
}

set_entvar(grenade, var_classname, GRENADE_CLASSNAME);

set_entvar(grenade, var_movetype, MOVETYPE_BOUNCE);
set_entvar(grenade, var_solid, SOLID_BBOX);

engfunc(EngFunc_SetOrigin, grenade, vecSrc);

new Float:angles[3];
get_entvar(id, var_angles, angles);
set_entvar(grenade, var_angles, angles);

set_entvar(grenade, var_owner, id);

if (time < 0.1) {
set_entvar(grenade, var_nextthink, get_gametime());
set_entvar(grenade, var_velocity, Float:{0.0, 0.0, 0.0});
} else {
set_entvar(grenade, var_nextthink, get_gametime() + time);
set_entvar(grenade, var_velocity, vecThrow);
}

set_entvar(grenade, var_sequence, random_num(3, 6));
set_entvar(grenade, var_framerate, 1.0);
set_entvar(grenade, var_gravity, 0.5);
set_entvar(grenade, var_friction, 0.8);
engfunc(EngFunc_SetModel, grenade, WORLDMODEL);

copy_entvar(item, grenade, var_HealthNade_Radius);
copy_entvar(item, grenade, var_HealthNade_ThrowHealingAmount);

SetTouch(grenade, "GrenadeTouch");
SetThink(grenade, "GrenadeThink");
return grenade;
}

explodeNade(const grenade) {
new Float:origin[3];
get_entvar(grenade, var_origin, origin);

new Float:fRadius = get_entvar(grenade, var_HealthNade_Radius);

UTIL_BeamCylinder(origin, SpriteCylinder, 1, 5, 30, 1, {10, 255, 40}, 255, 5, fRadius);
UTIL_CreateExplosion(origin, 65.0, SpriteExplode, 30, 20, (TE_EXPLFLAG_NOSOUND | TE_EXPLFLAG_NOPARTICLES));
UTIL_SpriteTrail(origin, SpriteShape);

rh_emit_sound2(grenade, 0, CHAN_WEAPON, SOUND_EXPLODE, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);

new id = get_entvar(grenade, var_owner);
new team = get_member(id, m_iTeam);

for (new player = 1, Float:playerOrigin[3]; player <= MaxClients; player++) {
if (!is_user_alive(player) || get_member(player, m_iTeam) != team) {
continue;
}

get_entvar(player, var_origin, playerOrigin);
if (get_distance_f(origin, playerOrigin) < fRadius) {
ExecuteHamB(Ham_TakeHealth, player, get_entvar(grenade, var_HealthNade_ThrowHealingAmount), DMG_GENERIC);
UTIL_ScreenFade(player);
}
}

destroyNade(grenade);
}

destroyNade(const grenade) {
SetTouch(grenade, "");
SetThink(grenade, "");
set_entvar(grenade, var_flags, FL_KILLME);
}

InitCvars() {
bind_pcvar_float(create_cvar(
"HealthNade_ExplodeRadius", "300.0", FCVAR_NONE,
LangS("HEALTHNADE_CVAR_EXPLODE_RADIUS"),
true, 1.0
), Cvar(ExplodeRadius));

bind_pcvar_float(create_cvar(
"HealthNade_ThrowHealingAmount", "20.0", FCVAR_NONE,
LangS("HEALTHNADE_CVAR_THROW_HEALING_AMOUNT")
), Cvar(ThrowHealingAmount));

bind_pcvar_float(create_cvar(
"HealthNade_DrinkHealingAmount", "35.0", FCVAR_NONE,
LangS("HEALTHNADE_CVAR_DRINK_HEALING_AMOUNT")
), Cvar(DrinkHealingAmount));

bind_pcvar_num(create_cvar(
"HealthNade_Give", "1", FCVAR_NONE,
LangS("HEALTHNADE_CVAR_GIVE")
), Cvar(Give));

bind_pcvar_string(create_cvar(
"HealthNade_Give_AccessFlags", "t", FCVAR_NONE,
LangS("HEALTHNADE_CVAR_GIVE_ACCESS_FLAGS")
), Cvar(Give_AccessFlags), charsmax(Cvar(Give_AccessFlags)));

bind_pcvar_num(create_cvar(
"HealthNade_Give_MinRound", "1", FCVAR_NONE,
LangS("HEALTHNADE_CVAR_GIVE_MIN_ROUND"),
true, 1.0
), Cvar(Give_MinRound));

bind_pcvar_num(create_cvar(
"HealthNade_Msg_UsageHint", "1", FCVAR_NONE,
LangS("HEALTHNADE_CVAR_MSG_USAGE_HINT"),
true, 0.0, true, 1.0
), Cvar(Msg_UsageHint));

bind_pcvar_num(create_cvar(
"HealthNade_Msg_FullHp", "1", FCVAR_NONE,
LangS("HEALTHNADE_CVAR_MSG_FULL_HP"),
true, 0.0, true, 1.0
), Cvar(Msg_FullHp));

bind_pcvar_num(create_cvar(
"HealthNade_NadeDrop", "2", FCVAR_NONE,
LangS("HEALTHNADE_CVAR_NADE_DROP"),
true, 0.0, true, 2.0
), Cvar(NadeDrop));

bind_pcvar_num(create_cvar(
"HealthNade_SlotId", "5", FCVAR_NONE,
LangS("HEALTHNADE_CVAR_SLOT_ID"),
true, 1.0, true, 5.0
), Cvar(SlotId));

AutoExecConfig(true, "HealthNade");

bind_pcvar_num(get_cvar_pointer("mp_nadedrops"), g_iCvarNadeDrops);
}

stock rg_get_player_item(const id, const classname[], const InventorySlotType:slot = NONE_SLOT) {
new item = get_member(id, m_rgpPlayerItems, slot);
while (!is_nullent(item)) {
if (FClassnameIs(item, classname)) {
return item;
}
item = get_member(item, m_pNext);
}

return 0;
}

stock bool:IsBlind(const player) {
return bool:(Float:get_member(player, m_blindUntilTime) > get_gametime());
}

stock UTIL_WeapoList(
const type,
const player,
const name[],
const ammo1,
const maxAmmo1,
const ammo2,
const maxammo2,
const InventorySlotType:slot,
const position,
const WeaponIdType:id,
const flags
) {
message_begin(type, MsgIdWeaponList, .player = player);
write_string(name);
write_byte(ammo1);
write_byte(maxAmmo1);
write_byte(ammo2);
write_byte(maxammo2);
write_byte(_:slot - 1);
write_byte(position);
write_byte(_:id);
write_byte(flags);
message_end();
}

stock UTIL_StatusIcon(const player, const type, const sprite[], const color[3]) {
message_begin(MSG_ONE, MsgIdStatusIcon, .player = player);
write_byte(type); // 0 - hide 1 - show 2 - flash
write_string(sprite);
write_byte(color[0]);
write_byte(color[1]);
write_byte(color[2]);
message_end();
}

stock UTIL_ScreenFade(const player, const Float:fxTime = 1.0, const Float:holdTime = 0.3, const color[3] = {170, 255, 0}, const alpha = 80) {
if (IsBlind(player)) {
return;
}

const FFADE_IN = 0x0000;

message_begin(MSG_ONE_UNRELIABLE, MsgIdScreenFade, .player = player);
write_short(FixedUnsigned16(fxTime));
write_short(FixedUnsigned16(holdTime));
write_short(FFADE_IN);
write_byte(color[0]);
write_byte(color[1]);
write_byte(color[2]);
write_byte(alpha);
message_end();
}

stock UTIL_BeamCylinder(const Float:origin[3], const sprite, const framerate, const life, const width, const amplitude, const color[3], const bright, const speed, const Float:size) {
message_begin_f(MSG_PVS, SVC_TEMPENTITY, origin, 0);
write_byte(TE_BEAMCYLINDER);
write_coord_f(origin[0]);
write_coord_f(origin[1]);
write_coord_f(origin[2]);
write_coord_f(origin[0]);
write_coord_f(origin[1]);
write_coord_f(origin[2] + size);
write_short(sprite);
write_byte(0);
write_byte(framerate);
write_byte(life);
write_byte(width);
write_byte(amplitude);
write_byte(color[0]);
write_byte(color[1]);
write_byte(color[2]);
write_byte(bright);
write_byte(speed);
message_end();
}

stock UTIL_CreateExplosion(const Float:origin[3], const Float:vecUp, const modelIndex, const scale, const frameRate, const flags) {
message_begin_f(MSG_PVS, SVC_TEMPENTITY, origin, 0);
write_byte(TE_EXPLOSION);
write_coord_f(origin[0]);
write_coord_f(origin[1]);
write_coord_f(origin[2] + vecUp);
write_short(modelIndex);
write_byte(scale);
write_byte(frameRate);
write_byte(flags);
message_end();
}

stock UTIL_SpriteTrail(Float:origin[3], const sprite, const cound = 20, const life = 20, const scale = 4, const noise = 20, const speed = 10) {
message_begin(MSG_BROADCAST, SVC_TEMPENTITY); // MSG_PVS
write_byte(TE_SPRITETRAIL);
write_coord_f(origin[0]);
write_coord_f(origin[1]);
write_coord_f(origin[2] + 20.0);
write_coord_f(origin[0]);
write_coord_f(origin[1]);
write_coord_f(origin[2] + 80.0);
write_short(sprite);
write_byte(cound);
write_byte(life);
write_byte(scale);
write_byte(noise);
write_byte(speed);
message_end();
}

stock FixedUnsigned16(Float:value, scale = (1 << 12)) {
return clamp(floatround(value * scale), 0, 0xFFFF);
}

bool:UserHasFlagsS(const UserId, const sFlags[], const bool:bStrict = false) {
if (!sFlags[0]) {
return true;
}

new iFlags = read_flags(sFlags);
new iUserFlags = get_user_flags(UserId);

return bStrict
? (iUserFlags & iFlags) == iFlags
: (iUserFlags & iFlags) > 0;
}

public plugin_natives() {
register_native("HealthNade_GiveNade", "_HealthNade_GiveNade");
}

public _HealthNade_GiveNade() {
enum { player = 1 };
new pPlayer = get_param(player);

if(is_user_alive(pPlayer)) {
return giveNade(pPlayer);
}

return NULLENT;
}
Проблема с данным плагином. Но скорее всего из-за молотова. Если я reapi_molotov ставлю выше в plugins.ini, то выдаётся только хилка, если наоборот, то только молотов.
В самом плагине хилки поставил её в 5 слот.
 
В этой теме было размещено решение! Перейти к решению.
Сообщения
678
Реакции
56
Помог
16 раз(а)
Обратите внимание, если вы хотите заключить сделку с этим пользователем, он заблокирован
Сообщения
678
Реакции
56
Помог
16 раз(а)
Обратите внимание, если вы хотите заключить сделку с этим пользователем, он заблокирован
Сообщения
1,292
Реакции
2,288
Помог
57 раз(а)
конфликт в типе предмета-основы. надо поменять
Код:
const WeaponIdType:WEAPON_NEW_ID = WEAPON_GLOCK;
например на
Код:
const WeaponIdType:WEAPON_NEW_ID = WEAPON_P228;
8 Апр 2023
Stelsman18 попробуй решение выше и отпиши о результате
 
Сообщения
678
Реакции
56
Помог
16 раз(а)
Обратите внимание, если вы хотите заключить сделку с этим пользователем, он заблокирован
Stelsman18, Молотов чей используешь?
 
Сообщения
3,582
Реакции
1,570
Помог
137 раз(а)
XyLiGaN,
Код:
 [ 38] [ReAPI] Molotov         2.5.1       wellasgood        reapi_molotov.a  running
 
Сообщения
678
Реакции
56
Помог
16 раз(а)
Обратите внимание, если вы хотите заключить сделку с этим пользователем, он заблокирован
Nordic Warrior, Точно, не заметил.
Ну да, у хилки и молотова один и тот же предмет юзается, поэтому и трабл.
1681035525747.png

А поменять либо в хилке, либо в молотове предмет на другой.
 
Сообщения
10
Реакции
0
Попробовал выше. Теперь немного другая ситуация. Пробовал менять на P228, всё что имело WEAPON_GLOCK, т.е. WEAPON_P228 и потом менял только данную строку"const WeaponIdType:WEAPON_NEW_ID = WEAPON_GLOCK;". В итоге появились и молик, и хилка, но если я юзаю к примеру только хилку, то при выборе молика он становится красным, т.е. его взять не могу, а если юзаю молик, то хилка исчезает
 
Сообщения
775
Реакции
293
Помог
11 раз(а)
Stelsman18, они ставятся так, чтобы не совпадали в других плагинах
 
Сообщения
1,292
Реакции
2,288
Помог
57 раз(а)
Stelsman18,
Код:
const AMMO_ID = 16;
на
Код:
const AMMO_ID = 17;
 
Статус
В этой теме нельзя размещать новые ответы.

Пользователи, просматривающие эту тему

Сейчас на форуме нет ни одного пользователя.
Сверху Снизу