Проблема с плагином Healthnade

Статус
В этой теме нельзя размещать новые ответы.
Сообщения
102
Реакции
-1
Ошибка
Не выдается граната на следующий раунд.
ОС
Linux
Amx Mod X
AMX Mod X 1.9.0-dev+5210
Билд
ReHLDS version: 3.11.0.776-dev
ReGamedll
ReGameDLL version: 5.21.0.546-dev
Версия Metamod
Metamod v1.21p37 2013/05/30 (5:13)
Список метамодулей
[ 1] Reunion RUN - reunion_mm_i386. v0.1.92d ini Start Never
[ 2] AMX Mod X RUN - amxmodx_mm_i386. v1.9.0-d ini Start ANY
[ 3] Rechecker RUN - rechecker_mm_i38 v2.3 ini Chlvl ANY
[ 4] WHBlocker RUN - whblocker_mm_i38 v1.5.692 ini Chlvl ANY
[ 5] Revoice RUN - revoice_mm_i386. v0.1.0.3 ini Start Never
[ 6] ReAPI RUN - reapi_amxx_i386. v5.21.0. pl2 ANY Never
[ 7] gRIP RUN - grip_amxx_i386.s v0.1.5 B pl2 ANY ANY
[ 8] FakeMeta RUN - fakemeta_amxx_i3 v1.9.0-d pl2 ANY ANY
[ 9] Ham Sandwich RUN - hamsandwich_amxx v1.9.0-d pl2 ANY ANY
[10] MySQL RUN - mysql_amxx_i386. v1.9.0-d pl2 ANY ANY
[11] CStrike RUN - cstrike_amxx_i38 v1.9.0-d pl2 ANY ANY
[12] Engine RUN - engine_amxx_i386 v1.9.0-d pl2 ANY ANY
[13] Fun RUN - fun_amxx_i386.so v1.9.0-d pl2 ANY ANY
[14] CSX RUN - csx_amxx_i386.so v1.9.0-d pl2 ANY ANY
[15] ReAimDetector RUN - reaimdetector_am v0.2.2 pl2 ANY Never
15 plugins, 15 running
Список плагинов
[ 1] Grenade Throw Multipli 0.4.0 F@nt0M grenade_throw_m running
[ 2] [Discord] Core 1.0 JDW Discord.amxx running
[ 3] Custom Player Models A 0.2.1 F@nt0M & BlackSi custom_player_m running
[ 4] Custom Player Models T 0.2.1 BlackSignature custom_player_m running
[ 5] Custom Player Models C 0.2.2 BlackSignature custom_player_m running
[ 6] Night VIPs 1.1.1 szawesome night_vips.amxx running
[ 7] [ReAPI] Healthnade 0.0.4f F@nt0M + mx?! reapi_healthnad running
[ 8] Admin Chat 1.8.2 AMXX Dev Team AdminChat.amxx running
[ 9] FreshBans 1.4.0b kanagava fresh_bans.amxx running
[ 10] Yekta's Combo Sprite 3.2 Yek'-ta yek_combosprite running
[ 11] Health Bar 2.0 Bboy Grun health_bar.amxx running
[ 12] Telegram MSG 1.2.0 ex3m777 Telegam_sender. running
[ 13] [RS] Auto-Demo Recorde 1.0.2 vk/felhalas RS_DemoRecord.a running
[ 14] All Death Beams 0.9 SpaceDude all_death_beams running
[ 15] Mode 2x2 1.9 s1lent mode.amxx running
[ 16] GameCMS_MapManager 1.1 zhorzh78 gamecms_mapmana running
[ 17] say /adminka 1.1 Pa1n say_adminka.amx running
[ 18] Check Admin & Vip 2.2 Leo_[BH] check_admin_vip running
[ 19] Change Team 1.1 neygomon changeteam.amxx running
[ 20] Unlimited ChooseTeam ( 1.0 ConnorMcLeod & p unlimited_choos running
[ 21] Advanced Ultimate Weap 0.0.3-Alph steelzzz advanced_ultima running
[ 22] SF Warn Menu 0.1.4g serfreeman1337 sf_admin_warns. running
[ 23] WinTeam Sprite 0.0.8 BENI-CS.RU WinTeam_Sprite. running
[ 24] VIP 04.02.20 OSTROG vip.amxx running
[ 25] Admin Loader 2.9 neygomon admin_loader.am running
[ 26] Steam Bonus 1.6.0 Radius | Stimul steam_bonus.amx running
[ 27] Say Prefix 0.93 Safety1st say_prefix.amxx running
[ 28] InfoConnects 1.0 PAffAEJIkA :3 InfoConnects.am running
[ 29] No Team Flash 0.2 KRoTaL no_team_flash.a running
[ 30] AWPoff 1.2 PAffAEJIkA :3 awp_off.amxx running
[ 31] Block Pickup Gold 0.1 Vaqtincha Block_VIP_MF.am running
[ 32] CSGO Grafiti Plugin 2.0 Fatih ~ EjderYa CSGO_Graffiti_P running
[ 33] Scope Alert 1.1 Kriminal ScopeAlert.amxx running
[ 34] Меню Диджея 1.1 101FPS menu_didjeya.am running
[ 35] Killa HP 1.6 jas0n killa_hp.amxx running
[ 36] Team Grenade Trail 1.2 Numb team_grenade_tr running
[ 37] VIP Menu [CS RAIN] 0.15 Leo_[BH] vip_girl.amxx running
[ 38] MultiJump 1.1 twistedeuphoria multijump.amxx running
[ 39] Advanced Kill Assists 1.2 Xelson next21_kill_ass running
[ 40] AMXX Gag 1.5.0 xPaw & Exolent ( amx_gag.amxx running
[ 41] Connect users 0.1 neugomon.ru, Rem connect_users.a running
[ 42] XMAS Skybox 1.0 SeMax xmas_sky.amxx running
[ 43] Knives Menu 0.1 Subb98 knifes_menu.amx running
[ 44] FreeAmmoEveryRound 0.1 SHLAKBAUM freeammoeveryro running
[ 45] Furien Score & Round 0.2.1 Askhanar Score.amxx running
[ 46] Lite Translit 2.8 neygomon lite_translit.a running
[ 47] Silly C4 1.1 Cheap_Suit sillyc4.amxx running
[ 48] WarmUP Pro 5.6 Beta ReymonARG warmuppro.amxx running
[ 49] Info Rank 0.2 maFFyoZZyk info_rank.amxx running
[ 50] mute menu 1.0 cheap_suit Mute_Menu.amxx running
[ 51] Block cheat key 1.1 9 rpamm!? block_key.amxx running
[ 52] Automatic knife duel 0.3x JGHG / Leo_[BH] knf_duel.amxx running
[ 53] Restrict Weapons 1.9.0-dev+ AMXX Dev Team restmenu.amxx running
[ 54] Back Weapons 1.87 hoboman313/cheap backweapons.amx running
[ 55] Ban Cs 10.0 Empower amx_bancs.amxx running
[ 56] Autoresponder/Advertis 0.5 MaximusBrood ad_manager.amxx running
[ 57] Server AMXMODMENU [INI 1.0 Leo_[BH] amxmodmenu.amxx running
[ 58] VIP Score Board 1.0 Leo_[BH] vip_score_board running
[ 59] VOTEBAN_BY_SLIMSHADY 3.0 SLIMSHADY_MOD voteban_by_slim running
[ 60] AFK Manager v1.4d Leon McVeran afk_manager.amx running
[ 61] Admin Spectator ESP 1.3 KoST admin_spec_esp. running
[ 62] Ultimate Sound 1.5 Dizzy ultimate_sounds running
[ 63] Killing Particles 1.01 metallicawOw KP_FIX.amxx running
[ 64] Time Lights 1.1 Leo_[BH] time_light.amxx running
[ 65] unknown unknown unknown render.amxx running
[ 66] c4 timer 1.1 cheap_suit c4timer.amxx running
[ 67] Server Menu [INI] 1.0 server_menu.amx running
[ 68] Reset Score 1.0 Silenttt resetscore.amxx running
[ 69] unknown unknown unknown transfer.amxx running
[ 70] CS Revo: Camera New 1.0 Nani | Wilian M. csrevo_camera_n running
[ 71] HATS 0.2 SgtBane Hats02.amxx running
[ 72] Parachute 2.0 Leo_[BH] parachute.amxx running
[ 73] anti block 0.1 cheap_suit zp_antiblock.am running
[ 74] Admin Commands 1.9.0-dev+ AMXX Dev Team admincmd.amxx running
[ 75] Slots Reservation 1.9.0-dev+ AMXX Dev Team adminslots.amxx running
[ 76] Menus Front-End 1.9.0-dev+ AMXX Dev Team menufront.amxx running
[ 77] Commands Menu 1.9.0-dev+ AMXX Dev Team cmdmenu.amxx running
[ 78] Players Menu 1.9.0-dev+ AMXX Dev Team plmenu.amxx running
[ 79] Maps Menu 1.9.0-dev+ AMXX Dev Team mapsmenu.amxx running
[ 80] Plugin Menu 1.9.0-dev+ AMXX Dev Team pluginmenu.amxx running
[ 81] Anti Flood 1.9.0-dev+ AMXX Dev Team antiflood.amxx running
[ 82] Scrolling Message 1.9.0-dev+ AMXX Dev Team scrollmsg.amxx running
[ 83] Info. Messages 1.9.0-dev+ AMXX Dev Team imessage.amxx running
[ 84] Admin Votes 1.9.0-dev+ AMXX Dev Team adminvote.amxx running
[ 85] NextMap 1.9.0-dev+ AMXX Dev Team nextmap.amxx running
[ 86] TimeLeft 1.8.2 AMXX Dev Team timeleft_rus.am running
[ 87] Pause Plugins 1.9.0-dev+ AMXX Dev Team pausecfg.amxx running
[ 88] ReAimDetector API 0.2.2 ReHLDS Team reaimdetector.a running
[ 89] Unreal Cheater Cry 1.0.5 Karaulov unreal_cheater_ running
[ 90] CS Misc. Stats 1.9.0-dev+ AMXX Dev Team miscstats.amxx running
[ 91] CS Stats Logging 1.9.0-dev+ AMXX Dev Team stats_logging.a running
[ 92] AES: Bonus CSTRIKE 0.5.9 [REA serfreeman1337/s aes_bonus_cstri running
[ 93] AES: Bonus System 0.5.9 Vega serfreeman1337/s aes_bonus_syste running
[ 94] AES: CStrike Addon 0.5.9 [REA serfreeman1337/s aes_exp_cstrike running
[ 95] AES: Admin Tools 0.5.9 [REA serfreeman1337/s aes_exp_editor. running
[ 96] AES: Informer 0.5.9 [REA serfreeman1337/s aes_informer.am running
[ 97] Advanced Experience Sy 0.5.9 [REA serfreeman1337/s aes_main.amxx running
[ 98] AES: StatsX 0.5.9 [REA serfreeman1337/s aes_statsx_cstr running
[ 99] CSStatsX SQL 0.7.4+1 serfreeman1337 csstatsx_sql.am running
[100] Stats Configuration 1.9.0-dev+ AMXX Dev Team statscfg.amxx running
Автор плагина
fantom BlackSignature
Версия плагина
0.0.4f
Исходный код
new const PLUGIN_VERSION[] = "0.0.4f";

#pragma semicolon 1

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

// Минимальный раунд для выдачи (сбрасывается при рестарте)
const MIN_ROUND = 1;

// Радиус лечения
const Float:HEAL_RADIUS = 300.0;

// Объём лечения при броске
const Float:HEAL_AMOUNT_THROW = 40.0;

// Объём лечения при выпивании
const Float:HEAL_AMOUNT_DRINK = 60.0;

// Информирование по центру о функциях (закомментировать для отключения)
new const USAGE_MSG[] = "ЛКМ - Бросить | ПКМ - Выпить";

// Информирование по центру о невозможности выпить зелье (закомментировать для отключения)
new const FULL_HP_MSG[] = "Вы полностью здоровы!";

// Флаг автовыдачи при спавне (закомментировать для выдачи всем)
const ACCESS_FLAG = ADMIN_LEVEL_F;

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;

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";

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

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

public plugin_precache() {
register_plugin("[ReAPI] Healthnade", PLUGIN_VERSION, "F@nt0M + mx?!");

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_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, GRENADE_SLOT, 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, _:GRENADE_SLOT - 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 defined ACCESS_FLAG
if (~get_user_flags(id) & ACCESS_FLAG) {
return;
}
#endif

#if defined MIN_ROUND
if(rg_get_current_round() < MIN_ROUND) {
return;
}
#endif

giveNade(id);
}

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

new item = rg_get_player_item(id, ITEM_CLASSNAME, GRENADE_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);
}
}

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) {
if (FClassnameIs(item, ITEM_CLASSNAME)) {
SetHookChainArg(2, ATYPE_STRING, VIEWMODEL);
SetHookChainArg(3, ATYPE_STRING, WEAPONMODEL);
#if defined USAGE_MSG
client_print(get_member(item, m_pPlayer), print_center, USAGE_MSG);
#endif
}

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(get_member(item, m_pPlayer), 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, GRENADE_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, GRENADE_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 defined FULL_HP_MSG
client_print(pPlayer, print_center, FULL_HP_MSG);
#endif
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, HEAL_AMOUNT_DRINK, 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, 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, GRENADE_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);

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 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);
set_entvar(grenade, var_dmg, 30.0);
set_entvar(grenade, var_dmgtime, get_gametime() + time);

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

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

UTIL_BeamCylinder(origin, SpriteCylinder, 1, 5, 30, 1, {10, 255, 40}, 255, 5, HEAL_RADIUS);
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, "weapons/reapi_healthnade/heal.wav", 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) < HEAL_RADIUS) {
ExecuteHamB(Ham_TakeHealth, player, HEAL_AMOUNT_THROW, DMG_GENERIC);
UTIL_ScreenFade(player);
}
}

destroyNade(grenade);
}

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

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);
}
Half Life Screenshot 2022.05.18 - 23.47.16.05.png
Half Life Screenshot 2022.05.18 - 23.47.32.07.png
 
В этой теме было размещено решение! Перейти к решению.

Download all Attachments

Последнее редактирование:
Сообщения
366
Реакции
46
Помог
6 раз(а)
Вообще никому? Или как?

Форматирование (BB-код):
// Флаг автовыдачи при спавне (закомментировать для выдачи всем)
const ACCESS_FLAG = ADMIN_LEVEL_F;
По идеи, должно выдаваться игрокам с флагом "r".
 

RockTheStreet

Саппорт года
Сообщения
1,743
Реакции
345
Помог
40 раз(а)
Обратите внимание, если вы хотите заключить сделку с этим пользователем, он заблокирован
Сообщения
102
Реакции
-1
RockTheStreet, флаг не пропадает. Он стоит на месте.

Сейчас на сервере:
# nick authid userid и с права
1 Jimmy STEAM_1:1:566445440 1 Да Да abcdefghijklmnoqrstu
Всего 1
 
Сообщения
366
Реакции
46
Помог
6 раз(а)
Jimasik
Может в логах есть какие-то ошибки? Если сам плагин должен работать исправно, возможно, есть какой-то конфликт.
 
Сообщения
1,543
Реакции
1,543
Предупреждения
1
Помог
2 раз(а)
Jimasik,
И такая же ситуация с одним этим плагином в списке плагинов на следующий раунд ?
 

fox

Сообщения
176
Реакции
49
Помог
7 раз(а)
Jimasik, попробуйте отключить Grenade Throw Multipli 0.4.
 
Сообщения
102
Реакции
-1
fox, Отключен, всеравно. Даже отключил team_grenade_trail.amxx
20 Май 2022
MayroN, Да, и ошибок никаких нет
 
Сообщения
366
Реакции
46
Помог
6 раз(а)
Мне кажется дело в других сомнительных плагинах, я проверил - всё работает идеально (На последних версиях ReGameDLL, ReAPI). Попробуй отключать по плагину и тестировать (их всё таки 100 штук).
 
Сообщения
102
Реакции
-1
DEVV, Спасибо конфликтировали спрайты о оповещении какая команда выиграла. Я отключил все работает.
 
Статус
В этой теме нельзя размещать новые ответы.

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

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