Участник
Пользователь
- Сообщения
- 194
- Реакции
- 43
- Помог
- 4 раз(а)
- Ошибка
-
L 03/30/2022 - 18:12:40: [ReAPI] get_member_s: invalid or uninitialized entity
L 03/30/2022 - 18:12:40: [AMXX] Displaying debug trace (plugin "throw_knife.amxx", version "1.0.0")
L 03/30/2022 - 18:12:40: [AMXX] Run time error 10: native error (native "get_member_s")
L 03/30/2022 - 18:12:40: [AMXX] [0] throw_knife.sma::GetWeaponId (line 526)
L 03/30/2022 - 18:12:40: [AMXX] [1] throw_knife.sma::Command_Drop (line 326)
L 03/30/2022 - 19:37:59: Start of error session.
- ОС
- Linux
- Amx Mod X
-
AMX Mod X 1.9.0 5294
- Билд
-
Protocol version 48
Exe version 1.1.2.7/Stdio (cstrike)
ReHLDS version: 3.11.0.773-dev
Build date: 13:43:28 Feb 22 2022 (2873)
Build from: https://github.com/dreamstalker/rehlds/commit/2f0a402
- ReGamedll
-
game version
ReGameDLL version: 5.21.0.546-dev
Build date: 15:32:48 Dec 28 2021
Build from: https://github.com/s1lentq/ReGameDLL_CS/commit/09a6c61
- Версия Metamod
-
meta version
Metamod-r v1.3.0.128, API (5:13)
Metamod-r build: 17:47:54 Aug 24 2018
Metamod-r from: https://github.com/theAsmodai/metamod-r/commit/0cf2f70
- Список метамодулей
-
Currently loaded plugins:
description stat pend file vers src load unload
[ 1] SafeNameAndChat RUN - SafeNameAndChat.so v1.2 Beta 3 ini ANY ANY
[ 2] Reunion RUN - reunion_mm_i386.so v0.1.0.135 ini Start Never
[ 3] ReAuthCheck RUN - reauthcheck_mm_i386.so v0.1.6 ini Start Never
[ 4] VoiceTranscoder RUN - VoiceTranscoder.so v2017RC5 ini ANY ANY
[ 5] Rechecker RUN - rechecker_mm_i386.so v2.7 ini Chlvl ANY
[ 6] AMX Mod X RUN - amxmodx_mm_i386.so v1.9.0.5294 ini Start ANY
[ 7] ReSemiclip RUN - resemiclip_mm_i386.so v2.3.9 ini Chlvl ANY
[ 8] WHBlocker RUN - whblocker_mm_i386.so v1.5.697 ini Chlvl ANY
[ 9] MySQL RUN - mysql_amxx_i386.so v1.9.0.5294 pl6 ANY ANY
[10] ReAimDetector RUN - reaimdetector_amxx_i386.so v0.2.2 pl6 ANY Never
[11] AuthEmu RUN - authemu_amxx_i386.so v5.2.12.431 pl6 ANY Never
[12] Admins Kit RUN - adminskit_amxx_i386.so v2.1.0 pl6 ANY ANY
[13] ReAPI RUN - reapi_amxx_i386.so v5.21.0.252-dev pl6 ANY Never
[14] GeoIP RUN - geoip_amxx_i386.so v1.9.0.5294 pl6 ANY ANY
[15] IPHub Client RUN - iphubclient_amxx_i386.so v1.0.1 pl6 ANY Never
[16] FakeMeta RUN - fakemeta_amxx_i386.so v1.9.0.5294 pl6 ANY ANY
[17] Ham Sandwich RUN - hamsandwich_amxx_i386.so v1.9.0.5294 pl6 ANY ANY
[18] Engine RUN - engine_amxx_i386.so v1.9.0.5294 pl6 ANY ANY
[19] CStrike RUN - cstrike_amxx_i386.so v1.9.0.5294 pl6 ANY ANY
[20] gRIP RUN - grip_amxx_i386.so v0.1.5 Beta pl6 ANY ANY
20 plugins, 20 running
- Список плагинов
-
Currently loaded plugins:
name version author file status
[ 1] ScreenMaker 1.1 neygomon screen_maker.am running
[ 2] DopBan 3.0.8b kanagava dop_ban.amxx running
[ 3] GameCMS_API 5.6.0 zhorzh78 gamecms_api.amx running
[ 4] FreshBans 1.4.6b kanagava fresh_bans.amxx running
[ 5] ReAimDetector API 0.2.2 ReHLDS Team reaimdetector.a running
[ 6] AuthEmu API 1.0 Dev-MS Team authemu.amxx running
[ 7] CSStatsX SQL 0.7.4+2 serfreeman1337 csstatsx_sql.am debug
[ 8] Night VIPs 1.1.1 szawesome night_vips.amxx running
[ 9] Advanced Ultimate Weap 0.1.1b steelzzz auw.amxx running
[ 10] VIP System 0.0.8 steelzorrr vip_system.amxx running
[ 11] AWP Limit 0.12 mx?! awp_limit.amxx running
[ 12] [ReAPI] Healthnade 0.0.4f F@nt0M + mx?! reapi_healthnad running
[ 13] Admin Commands 1.9.0.5294 AMXX Dev Team admincmd.amxx running
[ 14] Menus Front-End 1.4 gyxoBka menufront.amxx running
[ 15] Commands Menu 1.9.0.5294 AMXX Dev Team cmdmenu.amxx running
[ 16] SF Warn Menu 0.1.4g serfreeman1337 sf_admin_warns. running
[ 17] Players Menu 1.7 neugomon plmenu.amxx running
[ 18] Maps Menu 1.4.1 neugomon mapsmenu.amxx running
[ 19] Admin Chat 1.9.0.5294 AMXX Dev Team adminchat.amxx running
[ 20] Anti Flood 1.9.0.5294 AMXX Dev Team antiflood.amxx running
[ 21] Admin Votes 1.9.0.5294 AMXX Dev Team adminvote.amxx running
[ 22] Stats Configuration 1.9.0.5294 AMXX Dev Team statscfg.amxx running
[ 23] AES: StatsX 0.6 Vega[R serfreeman1337/s aes_statsx_cstr running
[ 24] [ReAPI] Info Killer 1.1.0 Jumper Info_Killer.amx running
[ 25] Items Restrict 1.0 ReHLDS Team items_restrict. running
[ 26] Revive Die Players 2.3.2 Emma Jule revive_teammate running
[ 27] Throw knife 1.0.0 medusa throw_knife.amx debug
[ 28] AFK Control ReNew 1.3 neygomon afk_control.amx running
[ 29] DemoRecoder 1.2 neygomon amx_demorec.amx running
[ 30] Reklama 20.05.2020 mx?! reklama.amxx running
[ 31] Auto Team Balance Adva 1.5.1 Radius auto_team_balan running
[ 32] [ReAPI:AMXX] Buy Nades 0.0.3a steelzorrr buy_nades_limit running
[ 33] Buy ResetScore 1.0 mx?! buy_resetscore. debug
[ 34] Show Damage 1.0.0 fl0wer damager.amxx running
[ 35] Custom Smoke 1.1 medusa custom_smoke.am running
[ 36] GameName Changer 1.0 mx?! gamename_change running
[ 37] Advanced Kill Assists 1.3c Xelson kill_assist.amx running
[ 38] Mode 2x2 2.5re s1lent mode.amxx running
[ 39] [ReAPI] No Team Flash 1.0 ReHLDS Team noteamflash.amx running
[ 40] [ReAPI] Parachute 1.1 ReHLDS Team & me parachute_lite. running
[ 41] Ping Checker 26.0.1 RC1 h1k3 ping_checker.am running
[ 42] Recoil Control 1.1 mx?! recoil_control.amx running
[ 43] [ReAPI] Block Fire in 3.1.0 F@nt0M reapi_block_fit running
[ 44] Frags Counter 1.0 CHEL74 frags_counter.a running
[ 45] Steam Bonus 1.1 mx?! steam_bonus_vip running
[ 46] SlayNoobs 0.1 Vaqtincha slay_noobs.amxx running
[ 47] [ReAPI] Random Weapons 2.4.9+1 neugomon/h1k3 warmup.amxx running
[ 48] Advanced Experience Sy 0.5.9 [REA serfreeman1337/s aes_main.amxx running
[ 49] AES: CStrike Addon 0.5.9 [REA serfreeman1337/s aes_exp_cstrike running
[ 50] AES: Informer 0.5.9 [REA serfreeman1337/s aes_informer.am running
[ 51] AES: Admin Tools 0.5.9 [REA serfreeman1337/s aes_exp_editor. running
[ 52] AES: Bonus System 0.5.9 Vega serfreeman1337/s aes_bonus_syste running
[ 53] AES: Bonus CSTRIKE 0.5.9.1 [R serfreeman1337/s aes_bonus_cstri running
[ 54] ChatAdditions: Core 1.9.1 Sergey Shorokhov ChatAdditions_C running
[ 55] ChatAdditions: GameCMS 1.9.1 Sergey Shorokhov CA_Storage_Game running
[ 56] CA: Mute 1.9.1 Sergey Shorokhov CA_Mute.amxx running
[ 57] CA: Gag 1.9.1 Sergey Shorokhov CA_Gag.amxx running
[ 58] Custom Player Models A 0.2.1 F@nt0M & BlackSi custom_player_m running
[ 59] Custom Player Models C 0.2.2 BlackSignature custom_player_m running
[ 60] Custom Player Models T 0.2.1 BlackSignature custom_player_m running
[ 61] Map Manager: Core 3.1.4 Mistrick map_manager_cor running
[ 62] Map Manager: Scheduler 0.1.9 Mistrick map_manager_sch running
[ 63] Map Manager: Rtv 0.1.1 Mistrick map_manager_rtv running
[ 64] Map Manager: Nominatio 0.2.0 Mistrick map_manager_nom debug
[ 65] Map Manager: BlockList 0.0.4 Mistrick map_manager_blo running
[ 66] Map Manager: Online so 0.0.4 Mistrick map_manager_onl running
[ 67] Map Manager: Effects 0.1.0 Mistrick map_manager_eff running
[ 68] Map Manager: Informer 0.0.5 Mistrick map_manager_inf debug
[ 69] Map Manager: Advanced 0.1.0 Mistrick map_manager_adv running
[ 70] Block Change Name 1.0.0 unit pr_block_change running
[ 71] Chat Manager 1.1.2-16 Mistrick chatmanager.amx running
71 plugins, 71 running
- Автор плагина
- medusa
- Версия плагина
- 1.0.0
- Исходный код
-
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>
#include <reapi>
#define PLUGIN_NAME "Throw knife"
#define PLUGIN_VERSION "1.0.0"
#define PLUGIN_AUTHOR "medusa"
#define CLEAR_THROW_KNIVES_WHEN_ROUND_START // Удалять брошенные ножи с карты, после рестарта раунда
#define ALLOW_HANDS //Позволить пользоваться кулаками, если кончились ножи
const THROW_KNIFE_NUM_ON_SPAWN = 3; //Количество ножей дающихся в начале раунда
const THROW_KNIFE_VELOCITY = 1200; //Скорость полета ножа
const Float:THROW_KNIFE_DAMAGE = 45.0; //Урон наносимый ножом
const Float:THROW_KNIFE_COOLDOWN = 1.0; //Задержка в секундах между бросками ножей
new const THROW_KNIFE_VIEW_MODEL[] = "models/throw_knife/v_throw_knife.mdl"; //Модель ножа в руках
new const THROW_KNIFE_WORLD_MODEL[] = "models/throw_knife/w_throw_knife01.mdl"; //Модель ножа который летит
#if defined ALLOW_HANDS
new const HANDS_VIEW_MODEL[] = "models/throw_knife/v_hands.mdl";
new const HANDS_HIT1[] = "weapons/throw_knife/hands_hit1.wav";
new const HANDS_HITWALL1[] = "weapons/throw_knife/hands_hitwall1.wav";
new const HANDS_SLASH1[] = "weapons/throw_knife/hands_slash1.wav";
new const HANDS_SLASH2[] = "weapons/throw_knife/hands_slash2.wav";
new const HANDS_STAB[] = "weapons/throw_knife/hands_stab.wav";
const Float:HANDS_DAMAGE_MOUSE1 = 0.2;
const Float:HANDS_DAMAGE_MOUSE2 = 0.4;
#endif
new const THROW_KNIFE_DEPLOY[] = "weapons/knife_deploy1.wav";
new const THROW_KNIFE_HITWALL[] = "weapons/knife_hitwall1.wav";
new const THROW_KNIFE_CLASSNAME[] = "throw_knife";
new const WEAPON_NAME_KNIFE[] = "weapon_knife";
new const WEAPON_NAME_THROW_KNIFE[] = "weapon_throw_knife";
const TASK_THROW_KNIFE = 10723;
const TASK_IDLE_ANIMATION = 23410;
// weapon_p228 - ammo_357sig
const THROW_KNIFE_AMMO_ID = 9;
enum
{
THROW_KNIFE_ANIMATION_IDLE = 0,
THROW_KNIFE_ANIMATION_SLASH1,
THROW_KNIFE_ANIMATION_SLASH2,
THROW_KNIFE_ANIMATION_DRAW,
THROW_KNIFE_ANIMATION_STAB,
THROW_KNIFE_ANIMATION_STAB_MISS,
THROW_KNIFE_ANIMATION_MIDSLASH1,
THROW_KNIFE_ANIMATION_MIDSLASH2,
THROW_KNIFE_ANIMATION_THROW
};
enum TouchState
{
TOUCH_STATE_DAMAGE = 0,
TOUCH_STATE_PICK
};
#if defined ALLOW_HANDS
enum KnifeState
{
KNIFE_STATE_KNIFE = 0,
KNIFE_STATE_HANDS,
};
new KnifeState:g_eKnifeState[MAX_PLAYERS + 1];
#endif
new g_iThrowKnives[MAX_PLAYERS + 1], Float:g_flCooldown[MAX_PLAYERS + 1];
public plugin_precache()
{
precache_model(THROW_KNIFE_VIEW_MODEL);
precache_model(THROW_KNIFE_WORLD_MODEL);
#if defined ALLOW_HANDS
precache_model(HANDS_VIEW_MODEL);
precache_sound(HANDS_HIT1);
precache_sound(HANDS_HITWALL1);
precache_sound(HANDS_SLASH1);
precache_sound(HANDS_SLASH2);
precache_sound(HANDS_STAB);
/*precache_model(KNIFE_VIEW_MODEL);
precache_model(KNIFE_PLAYER_MODEL);*/
#endif
precache_generic(fmt("sprites/%s.txt", WEAPON_NAME_THROW_KNIFE));
}
public plugin_init()
{
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
register_clcmd("drop", "Command_Drop");
register_clcmd(WEAPON_NAME_THROW_KNIFE, "Command_ThrowKnife");
#if defined ALLOW_HANDS
RegisterHam(Ham_Item_Deploy, WEAPON_NAME_KNIFE, "Ham_Knife_Deploy_Post", true);
RegisterHookChain(RG_CBasePlayer_TakeDamage, "CBasePlayer_TakeDamage_Pre", false);
register_forward(FM_EmitSound, "EmitSound_Pre", false);
#endif
register_message(get_user_msgid("CurWeapon"), "Message_CurWeapon");
/*RegisterHam(Ham_Item_AddToPlayer, WEAPON_NAME_KNIFE, "Item_AddToPlayer_Post", true);*/
RegisterHam(Ham_Item_AddToPlayer, WEAPON_NAME_KNIFE, "Item_AddToPlayer_Post", true);
#if defined CLEAR_THROW_KNIVES_WHEN_ROUND_START
RegisterHookChain(RG_CSGameRules_RestartRound, "CSGameRules_RestartRound_Post", true);
#endif
RegisterHookChain(RG_CBasePlayer_Spawn, "CBasePlayer_Spawn_Post", true);
}
public Command_ThrowKnife(id)
{
engclient_cmd(id, "weapon_knife");
}
public client_putinserver(id)
{
#if defined ALLOW_HANDS
g_eKnifeState[id] = KNIFE_STATE_KNIFE;
#endif
g_iThrowKnives[id] = 0;
g_flCooldown[id] = 0.0;
}
public client_disconnected(id)
{
remove_task(id + TASK_THROW_KNIFE);
remove_task(id + TASK_IDLE_ANIMATION);
}
#if defined ALLOW_HANDS
public Ham_Knife_Deploy_Post(weapon)
{
/*if(is_nullent(weapon))
{
return;
}*/
new id = get_member(weapon, m_pPlayer);
if (g_eKnifeState[id] == KNIFE_STATE_HANDS)
{
set_entvar(id, var_viewmodel, HANDS_VIEW_MODEL);
set_entvar(id, var_weaponmodel, "");
//return;
}
else
{
set_entvar( id, var_viewmodel, THROW_KNIFE_VIEW_MODEL );
set_entvar( id, var_weaponmodel, THROW_KNIFE_WORLD_MODEL );
//set_member( weapon, m_flLastEventCheck, get_gametime( ) + 0.2 );
}
}
public CBasePlayer_TakeDamage_Pre(const victim, pevInflictor, attacker, Float:flDamage, bitsDamageType)
{
if (!is_user_connected(attacker))
{
return;
}
if (attacker == victim)
{
return;
}
if (bitsDamageType & DMG_GRENADE)
{
return;
}
if (g_eKnifeState[attacker] != KNIFE_STATE_HANDS)
{
return;
}
new WeaponIdType:iWeaponId = GetWeaponId(attacker);
if (iWeaponId != WEAPON_KNIFE)
{
return;
}
// mouse1
if (THROW_KNIFE_ANIMATION_MIDSLASH1 <= get_entvar(attacker, var_weaponanim) <= THROW_KNIFE_ANIMATION_MIDSLASH2)
{
SetHookChainArg(4, ATYPE_FLOAT, flDamage*HANDS_DAMAGE_MOUSE1);
}
else // mouse2
{
SetHookChainArg(4, ATYPE_FLOAT, flDamage*HANDS_DAMAGE_MOUSE2);
}
}
public EmitSound_Pre(id, channel, sample[])
{
if (!is_user_alive(id))
{
return FMRES_IGNORED;
}
if (sample[8] == 'k' && sample[9] == 'n' && sample[10] == 'i' && sample[11] == 'f' && sample[12] == 'e')//knife
{
if (g_eKnifeState[id] != KNIFE_STATE_HANDS)
{
return FMRES_IGNORED;
}
if (sample[14] == 'h')
{
if (sample[17] == 'w')//hitwall
{
emit_sound(id, CHAN_WEAPON, HANDS_HITWALL1, random_float(0.5, 1.0), ATTN_NORM, 0, PITCH_NORM);
}
else//hit
{
emit_sound(id, CHAN_WEAPON, HANDS_HIT1, random_float(0.5, 1.0), ATTN_NORM, 0, PITCH_NORM);
}
}
else if (sample[15] == 'l')//slash
{
emit_sound(id, CHAN_WEAPON, HANDS_SLASH1, random_float(0.5, 1.0), ATTN_NORM, 0, PITCH_NORM);
}
else if (sample[17] == 'b')//stab
{
emit_sound(id, CHAN_WEAPON, HANDS_STAB, random_float(0.5, 1.0), ATTN_NORM, 0, PITCH_NORM);
}
return FMRES_SUPERCEDE;
}
return FMRES_IGNORED;
}
#endif
public Message_CurWeapon(msg_id, msg_dest, id)
{
if (!is_user_alive(id))
{
return;
}
new WeaponIdType:iWeaponId = GetWeaponId(id);
if (iWeaponId == WEAPON_P228)
{
SendAmmoX(id, THROW_KNIFE_AMMO_ID, rg_get_user_bpammo(id, WEAPON_P228));
}
else if (iWeaponId == WEAPON_KNIFE)
{
SendAmmoX(id, THROW_KNIFE_AMMO_ID, g_iThrowKnives[id]);
}
}
/*public Item_AddToPlayer_Post(this, id)
{
if (is_nullent(this))
{
return;
}
set_member(this, m_Weapon_iClip, -1);
SendWeaponList(id, WEAPON_NAME_THROW_KNIFE, THROW_KNIFE_AMMO_ID, 1, -1, -1, 2, 1, _:WEAPON_KNIFE, 0);
}*/
public Item_AddToPlayer_Post(id, player)
{
SendWeaponList(player, WEAPON_NAME_THROW_KNIFE, THROW_KNIFE_AMMO_ID, 1, -1, -1, 2, 1, _:WEAPON_KNIFE, 0);
SendCurWeapon(player, 1, _:WEAPON_KNIFE, -1);
}
#if defined CLEAR_THROW_KNIVES_WHEN_ROUND_START
public CSGameRules_RestartRound_Post()
{
new iEnt = MaxClients+1;
while ((iEnt = rg_find_ent_by_class(iEnt, THROW_KNIFE_CLASSNAME)))
{
set_entvar(iEnt, var_flags, FL_KILLME);
}
}
#endif
public CBasePlayer_Spawn_Post(id)
{
if (!is_user_alive(id))
{
return;
}
#if defined ALLOW_HANDS
g_eKnifeState[id] = KNIFE_STATE_KNIFE;
#endif
g_iThrowKnives[id] = THROW_KNIFE_NUM_ON_SPAWN;
#if defined ALLOW_HANDS
if (GetWeaponId(id) == WEAPON_KNIFE)
{
set_entvar(id, var_viewmodel, THROW_KNIFE_VIEW_MODEL);
set_entvar(id, var_weaponmodel, THROW_KNIFE_WORLD_MODEL);
}
#endif
SendAmmoX(id, THROW_KNIFE_AMMO_ID, g_iThrowKnives[id]);
}
public Command_Drop(id)
{
if (GetWeaponId(id) != WEAPON_KNIFE)
{
return PLUGIN_CONTINUE;
}
new iWeaponAnim = get_entvar(id, var_weaponanim);
if (iWeaponAnim != THROW_KNIFE_ANIMATION_IDLE /*&& iWeaponAnim != THROW_KNIFE_ANIMATION_IDLE*/)
{
return PLUGIN_HANDLED;
}
if (!g_iThrowKnives[id])
{
return PLUGIN_HANDLED;
}
new Float:flGetGametime = get_gametime();
if (g_flCooldown[id] > flGetGametime)
{
client_print(id, print_center, "Подождите %0.f сек. перед броском.", g_flCooldown[id] - flGetGametime);
return PLUGIN_HANDLED;
}
g_iThrowKnives[id]--;
g_flCooldown[id] = get_gametime() + THROW_KNIFE_COOLDOWN;
client_print(id, print_center, "Вы бросили нож.");
SendAmmoX(id, THROW_KNIFE_AMMO_ID, g_iThrowKnives[id]);
ThrowKnife(id);
return PLUGIN_HANDLED;
}
ThrowKnife(id)
{
set_entvar(id, var_viewmodel, THROW_KNIFE_VIEW_MODEL);
SendWeaponAnimation(id, THROW_KNIFE_ANIMATION_THROW);
set_task(0.15, "Task_ThrowKnife", TASK_THROW_KNIFE + id);
}
public Task_ThrowKnife(id)
{
id -= TASK_THROW_KNIFE;
if (!is_user_alive(id))
{
return;
}
if (g_iThrowKnives[id])
{
//SendWeaponAnimation(id, THROW_KNIFE_ANIMATION_IDLE);
set_task(0.2, "Task_IdleAnimation", id + TASK_IDLE_ANIMATION); //Анимацию броска можно и продлить чутка, а то она с того таска меняеться сразу, а 0.3 на бросок долго
}
else
{
#if defined ALLOW_HANDS
new WeaponIdType:iWeaponId = GetWeaponId(id);
if (iWeaponId == WEAPON_KNIFE)
{
g_eKnifeState[id] = KNIFE_STATE_HANDS;
set_entvar(id, var_viewmodel, HANDS_VIEW_MODEL);
set_entvar(id, var_weaponmodel, "");
}
#else
if (rg_has_item_by_name(id, WEAPON_NAME_KNIFE))
{
rg_remove_item(id, WEAPON_NAME_KNIFE);
}
#endif
}
new iEnt = rg_create_entity("info_target");
if (is_nullent(iEnt))
{
return;
}
new Float:flOrigin[3]; get_entvar(id, var_origin, flOrigin);
new Float:flVelocity[3]; velocity_by_aim(id, THROW_KNIFE_VELOCITY, flVelocity);
new Float:flAngle[3]; vector_to_angle(flVelocity, flAngle);
set_entvar(iEnt, var_classname, THROW_KNIFE_CLASSNAME);
engfunc(EngFunc_SetModel, iEnt, THROW_KNIFE_WORLD_MODEL);
set_entvar(iEnt, var_movetype, MOVETYPE_TOSS);
set_entvar(iEnt, var_origin, flOrigin);
set_entvar(iEnt, var_angles, flAngle);
set_entvar(iEnt, var_velocity, flVelocity);
set_entvar(iEnt, var_framerate, 1.0);
set_entvar(iEnt, var_owner, id);
set_entvar(iEnt, var_chain, TOUCH_STATE_DAMAGE);
set_entvar(iEnt, var_solid, SOLID_TRIGGER);
engfunc(EngFunc_SetSize, iEnt, {-1.0, -1.0, -1.0}, {1.0, 1.0, 1.0});
SetTouch(iEnt, "TouchThrowKnife");
}
public Task_IdleAnimation(id)
{
id -= TASK_IDLE_ANIMATION;
if (!is_user_connected(id))
{
return;
}
new WeaponIdType:iWeaponId = GetWeaponId(id);
if (iWeaponId != WEAPON_KNIFE)
{
return;
}
SendWeaponAnimation(id, THROW_KNIFE_ANIMATION_IDLE);
}
public TouchThrowKnife(iTouched, iToucher)
{
if (is_nullent(iTouched))
{
return;
}
new iOwner = get_entvar(iTouched, var_owner);
if (is_user_connected(iToucher))
{
switch (get_entvar(iTouched, var_chain))
{
case TOUCH_STATE_DAMAGE:
{
if (iToucher == iOwner)
{
return;
}
ExecuteHamB(Ham_TakeDamage, iToucher, iTouched, iOwner, THROW_KNIFE_DAMAGE, DMG_SLASH);
}
case TOUCH_STATE_PICK:
{
g_iThrowKnives[iToucher]++;
client_print(iToucher, print_center, "Вы подобрали нож.");
#if defined ALLOW_HANDS
if (g_eKnifeState[iToucher] == KNIFE_STATE_HANDS)
{
g_eKnifeState[iToucher] = KNIFE_STATE_KNIFE;
if (GetWeaponId(iToucher) == WEAPON_KNIFE)
{
set_entvar(iToucher, var_viewmodel, THROW_KNIFE_VIEW_MODEL);
set_entvar(iToucher, var_weaponmodel, THROW_KNIFE_WORLD_MODEL);
}
rg_send_audio(iToucher, THROW_KNIFE_DEPLOY);
}
#else
if (!rg_has_item_by_name(iToucher, WEAPON_NAME_KNIFE))
{
rg_give_item(iToucher, WEAPON_NAME_KNIFE);
}
#endif
else
{
rg_send_audio(iToucher, THROW_KNIFE_DEPLOY);
}
if (GetWeaponId(iToucher) == WEAPON_KNIFE)
{
SendAmmoX(iToucher, THROW_KNIFE_AMMO_ID, g_iThrowKnives[iToucher]);
}
SendWeaponAnimation(iToucher, THROW_KNIFE_ANIMATION_IDLE);
}
}
set_entvar(iTouched, var_flags, FL_KILLME);
}
else
{
set_entvar(iTouched, var_movetype, MOVETYPE_NONE);
set_entvar(iTouched, var_chain, TOUCH_STATE_PICK);
set_entvar(iTouched, var_framerate, 0.0);
rh_emit_sound2(iTouched, 0, CHAN_VOICE, THROW_KNIFE_HITWALL, VOL_NORM, ATTN_STATIC, 0, PITCH_NORM);
}
}
stock WeaponIdType:GetWeaponId(id)
{
new iActiveItem = get_member(id, m_pActiveItem);
if (is_nullent(iActiveItem))
{
return WEAPON_NONE;
}
return WeaponIdType:get_member(iActiveItem, m_iId);
}
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();
}
stock SendWeaponList(iPlayer, const sName[], iAmmo1, iMaxAmmo1, iAmmo2, iMaxAmmo2, iSlot, iPosition, iId, iFlags)
{
static iMsgId_WeaponList;
if (!iMsgId_WeaponList)
iMsgId_WeaponList = get_user_msgid("WeaponList");
message_begin(MSG_ONE_UNRELIABLE, iMsgId_WeaponList, _, iPlayer);
write_string(sName);
write_byte(iAmmo1);
write_byte(iMaxAmmo1);
write_byte(iAmmo2);
write_byte(iMaxAmmo2);
write_byte(iSlot);
write_byte(iPosition);
write_byte(iId);
write_byte(iFlags);
message_end();
}
stock SendAmmoX(const id, const iAmmoId, const iAmmount)
{
static iMsgId_AmmoX;
if (!iMsgId_AmmoX)
iMsgId_AmmoX = get_user_msgid("AmmoX");
message_begin(MSG_ONE_UNRELIABLE, iMsgId_AmmoX, _, id);
write_byte(iAmmoId);
write_byte(iAmmount);
message_end();
}
stock SendCurWeapon(const id, const isActive, const iWeaponId, const iClipAmmo)
{
static iMsgId_CurWeapon;
if (!iMsgId_CurWeapon)
iMsgId_CurWeapon = get_user_msgid("CurWeapon");
message_begin(MSG_ONE_UNRELIABLE, iMsgId_CurWeapon, _, id);
write_byte(isActive);
write_byte(iWeaponId);
write_byte(iClipAmmo);
message_end();
}
через раз сыпет ошибку
В этой теме было размещено решение! Перейти к решению.
Вложения
-
16.4 KB Просмотры: 101