Участник
Пользователь
- Сообщения
- 39
- Реакции
- 11
- Ошибка
-
L 05/16/2021 - 10:42:31: Start of error session.
L 05/16/2021 - 10:42:31: Info (map "de_dust2") (file "addons/amxmodx/logs/error_20210516.log")
L 05/16/2021 - 10:42:31: [ReAPI] get_member_s: invalid or uninitialized entity
L 05/16/2021 - 10:42:31: [AMXX] Displaying debug trace (plugin "throw_knife.amxx", version "1.0.0")
L 05/16/2021 - 10:42:31: [AMXX] Run time error 10: native error (native "get_member_s")
L 05/16/2021 - 10:42:31: [AMXX] [0] throw_knife.sma::GetWeaponId (line 526)
L 05/16/2021 - 10:42:31: [AMXX] [1] throw_knife.sma::Command_Drop (line 326)
- ОС
- Linux
- Amx Mod X
-
AMX Mod X 1.9.0.5271 (http://www.amxmodx.org)
Authors:
<TAB>David "BAILOPAN" Anderson, Pavol "PM OnoTo" Marko
<TAB>Felix "SniperBeamer" Geyer, Jonny "Got His Gun" Bergstrom
<TAB>Lukasz "SidLuke" Wlasinski, Christian "Basic-Master" Hammacher
<TAB>Borja "faluco" Ferrer, Scott "DS" Ehlert
Compiled: Jun 24 2020 13:53:30
Built from: https://github.com/alliedmodders/amxmodx/commit/5eea3e5
Build ID: 5271:5eea3e5
Core mode: JIT+ASM32
- Билд
-
Protocol version 48
Exe version 1.1.2.7/Stdio (cstrike)
ReHLDS version: 3.8.0.739-dev
Build date: 09:46:24 Apr 21 2021 (2566)
Build from: https://github.com/dreamstalker/rehlds/commit/6a916d7
- ReGamedll
-
ReGameDLL version: 5.20.0.505-dev
Build date: 11:06:14 Apr 17 2021
- Версия Metamod
-
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] Reunion RUN - reunion_mm_i386.so v0.1.0.137 ini Start Never
[ 2] ReAuthCheck RUN - reauthcheck_mm_i386.so v0.1.6 ini Start Never
[ 3] VoiceTranscoder RUN - VoiceTranscoder.so v2017RC5 ini ANY ANY
[ 4] ReSemiclip RUN - resemiclip_mm_i386.so v2.3.9 ini Chlvl ANY
[ 5] ReSRDetector RUN - resrdetector_mm_i386.so v0.1.0 ini Chlvl ANY
[ 6] SafeNameAndChat RUN - SafeNameAndChat.so v1.1 ini ANY ANY
[ 7] AMX Mod X RUN - amxmodx_mm_i386.so v1.9.0.5271 ini Start ANY
[ 8] WHBlocker RUN - whblocker_mm_i386.so v1.5.697 ini Chlvl ANY
[ 9] Fix Custom iMaxClip RUN - fixmaxclip_mm_i386.so v0.1 ini ANY ANY
[10] Placeholders disabler RUN - plfix_mm_i386.so v0.0.3 ini Start Never
[11] ReAPI RUN - reapi_amxx_i386.so v5.19.0.211-dev pl7 ANY Never
11:32:46 [12] Fun RUN - fun_amxx_i386.so v1.9.0.5271 pl7 ANY ANY
[13] Engine RUN - engine_amxx_i386.so v1.9.0.5271 pl7 ANY ANY
[14] FakeMeta RUN - fakemeta_amxx_i386.so v1.9.0.5271 pl7 ANY ANY
[15] CStrike RUN - cstrike_amxx_i386.so v1.9.0.5271 pl7 ANY ANY
[16] CSX RUN - csx_amxx_i386.so v1.9.0.5271 pl7 ANY ANY
[17] Ham Sandwich RUN - hamsandwich_amxx_i386.so v1.9.0.5271 pl7 ANY ANY
[18] Aim Esp Fix RUN - 82_162_62_28_27015_amxx_i386.so v1.7 pl7 Start Never
[19] Admins Kit RUN - adminskit_amxx_i386.so v1.0.2 pl7 ANY Never
[20] MySQL RUN - mysql_amxx_i386.so v1.9.0.5271 pl7 ANY ANY
[21] VTC AMXX API RUN - VtcApi_amxx_i386.so v2017 RC2 pl7 ANY ANY
21 plugins, 21 running
- Список плагинов
-
Currently loaded plugins:
name version author file status
[ 1] Trial Access 1.0.0 mx?! trial_access.am running
[ 2] GameCMS_API 5.5.0 zhorzh78 gamecms_api_5.5 running
[ 3] [190] Cvar On Map 20.06.06 SKAJIbnEJIb cvar_on_map.amx running
[ 4] [190] BonusMenu RBS 20.06.06 SKAJIbnEJIb bonusmenu_rbs.a running
[ 5] Throw knife 1.0.0 medusa throw_knife.amx debug
[ 6] [190] Ultimate Weapons 21.03.23 SKAJIbnEJIb ultimate_weapon running
[ 7] [190] VIP RBS 20.07.20 SKAJIbnEJIb vip_rbs.amxx running
[ 8] [190] Top Award RBS 20.06.06 SKAJIbnEJIb topaward_rbs.am running
[ 9] Shopchik 1.0 Sokol xp_shop_rbs.amx running
[ 10] Give ADMIN *SoNeeKkk SoNeeKK1 menu_donata.amx running
[ 11] [ReAPI] Healthnade 0.0.2 F@nt0M reapi_healthnad running
[ 12] [All mod] Grab 2.1 Ian Cammarata / grab.amxx running
[ 13] [190] Damager RBS 20.06.06 SKAJIbnEJIb damager_rbs.amx running
[ 14] [ReAPI] Custom Models 1.6.1 neugomon custom_models.a running
11:34:50 [ 15] AR Double 14.12.02 SKAJIbnEJIb ar_double2.amxx running
[ 16] [190] BonusTime RBS 20.08.08 SKAJIbnEJIb bonustime_rbs.a running
[ 17] FreshBans 1.4.3b kanagava fresh_bans_143_ running
[ 18] DopBan 3.0.6b kanagava dop_ban306_183. running
[ 19] AIM detector 0.9.4.3b kanagava aim_detector_09 running
[ 20] [190] Screen Player 20.06.06 SKAJIbnEJIb screen_player.a running
[ 21] cmd_rewrite 0.1 kanagava offban_restrict running
[ 22] [190] WallHack Viewer 20.06.06 SKAJIbnEJIb wallhack_viewer running
[ 23] [190] Blind RBS 20.06.06 SKAJIbnEJIb blind_rbs.amxx running
[ 24] unknown unknown unknown amx_console.amx running
[ 25] Auto Demo Recorder 2.0 the_hunter auto_demo_recor running
[ 26] block ip 0.2 legenda amx_blockip.amx running
[ 27] VoteBan Menu 1.1 Author + ApXuTek VoteBan_Menu.am running
[ 28] One Name 0.1.0 ConnorMcLeod block_change_ni running
[ 29] UpdateHint 1.3 Lev updatehint.amxx running
11:34:50 [ 30] [190] CsStats MySQL 20.06.06 SKAJIbnEJIb csstats_mysql.a running
[ 31] [190] StatsX RBS 21.03.23 SKAJIbnEJIb & AM statsx_rbs.amxx running
[ 32] [190] Stats Configurat 20.06.06 SKAJIbnEJIb & AM statscfg_rbs.am running
[ 33] [190] Skill ELO 20.06.06 SKAJIbnEJIb skill_elo.amxx running
[ 34] [190] Army Ranks Ultim 20.06.06 SKAJIbnEJIb army_ranks_ulti running
[ 35] New Kick Menu 1.2.2 Radius newkickmenu.amx running
[ 36] Plugin Menu 1.9.0.5271 AMXX Dev Team pluginmenu.amxx running
[ 37] Commands Menu 1.9.0.5271 AMXX Dev Team cmdmenu.amxx running
[ 38] Teleport Menu 1.9.0.5271 AMXX Dev Team telemenu.amxx running
[ 39] Multi-Lingual System 1.9.0.5271 AMXX Dev Team multilingual.am running
[ 40] Pause Plugins 1.9.0.5271 AMXX Dev Team pausecfg.amxx running
[ 41] [190] AdminChat RBS 20.06.06 SKAJIbnEJIb adminchat_rbs.a running
[ 42] [190] MapsMenu RBS 20.06.06 SKAJIbnEJIb & AM mapsmenu_rbs.am running
[ 43] [190] AdminCmd RBS 20.06.06 SKAJIbnEJIb & AM admincmd_rbs.am running
[ 44] Menus Front-End 20.06.06 SKAJIbnEJIb & AM amxmodmenu_rbs. running
11:34:50 [ 45] Reset_Score 1.0 Silenttt Fixed b Resetscore.amxx running
[ 46] Admin Groups 1.0 OciXCrom crx_admingroups running
[ 47] Admin Groups 1.0 OciXCrom crx_vipgroups.a running
[ 48] Menu System 0.1.2 serfreeman1337 menuSystem.amxx running
[ 49] GameCMS_Registration 1.5 zhorzh78 gamecms_registr running
[ 50] [190] Ad From Server 20.06.06 SKAJIbnEJIb ad_from_server. running
[ 51] [190] Kill Assist RBS 20.06.06 SKAJIbnEJIb & Di killassist_rbs. running
[ 52] [190] First Players Re 20.06.06 SKAJIbnEJIb FirstPlayersRes running
[ 53] 'Fire in the hole' blo 1.0 xPaw hidefireintheho running
[ 54] Map Spawns Editor 1.0.16 iG_os Map_Spawns_Edit running
[ 55] Revive teammate 3.0 beast revive_teammate running
[ 56] [190] Parachute RBS 20.06.06 SKAJIbnEJIb & KR parachute_rbs.a running
[ 57] AFK Control 1.4.1 [Rnd neygomon afk_control.amx running
[ 58] Custom Smoke 1.06 bionext custom_smoke_bl running
[ 59] Knife Duel with Telepo 1.2 neygomon knife_duel.amxx running
11:34:50 [ 60] Warmup 1.1.8 Radius warmup.amxx stopped
[ 61] AWP Limiter 1.0.0 the_hunter awp_limiter.amx running
[ 62] Team Balancer 1.8b3 Ptahhotep ptb_rus.amxx running
[ 63] unknown unknown unknown transfer_money. running
[ 64] Items Restrict 1.1 s1lent items_restrict. running
[ 65] Spawn Protection 1.2 Safety1st spawnprotection running
[ 66] [AR] [B.C.N.L.] API 1.0 Leo_[BH] ar_bcnl_api.amx running
[ 67] [AR] [B.C.N.L.] Bonus 1.0 Leo_[BH] ar_bcnl_bonus.a running
[ 68] [AR] [B.C.N.L.] 1 1.0 Leo_[BH] ar_bcnl1.amxx running
[ 69] [AR] [B.C.N.L.] Menu 1.0 Leo_[BH] ar_menu.amxx running
[ 70] Svinorez 2.0 Fintok! svinorez.amxx running
[ 71] Color Flash Screen 1.6.4 Radius (Stimul i color_flash_scr running
[ 72] [ReAPI] TopRoundDamage 1.0.5 Dager* *.* -G- damage_round.am running
[ 73] CSO Kill Sounds 1.0.7 Radius (based on cso_kill_sounds running
[ 74] [182] Crux Ansata 17.10.30 Sanlerus crux_ansata.amx running
11:34:50 [ 75] GameCMS BonusSystem 1.1 +- DUKKHAZ0R gamecms_bonus.a running
[ 76] GameCMS_Informer 2.3 API5 zhorzh78 gamecms_hud_inf running
[ 77] [ReAPI] Kills Counter 0.3 serfreeman1337 kills_counter_r running
[ 78] AMXX Public server rul 1.20 Priski public_rules.am running
[ 79] VK Tab 1.0 vk.com/CS_MAFIA_ vk_tab.amxx running
[ 80] Permanent message 1.1 He3aBuCuM permanent_messa running
[ 81] Round/Info 1.0 Limo[?!] info.amxx running
[ 82] Spectator Bots 2.1 SISA spectator_bots. running
[ 83] GameName Changer 1.0 neugomon gamename_change running
[ 84] [190] MapChooser RBS 20.08.02 SKAJIbnEJIb & UF mapchooser_rbs. running
[ 85] [190] TimeLeft 18.09.25 SKAJIbnEJIb & AM timeleft.amxx running
[ 86] [190] NextMap 18.09.25 SKAJIbnEJIb & AM nextmap.amxx running
[ 87] Mode 2x2 2.5re s1lent mode.amxx running
[ 88] GameCMS_GagManager 2.2.3 zhorzh78 gamecms_gagmana running
[ 89] From Rock to Ban 1.02 Safety1st++ rock2gag.amxx running
11:34:50 [ 90] CMS_GM_Sorry_Addon 1.0 sorry.amxx running
[ 91] [190] Chat RBS 20.10.24BE SKAJIbnEJIb chat_rbs.amxx running
[ 92] [reAPI] Flash Control 1.1 neugomon flash_control.a running
[ 93] [ReAPI] Records 0.1 Impossible NOLKF reapi_records.a running
[ 94] Spec Banner 0.0.1 PurposeLess specbanner.amxx running
[ 95] [ReAPI] Team Destroyed 0.1 Impossible NOLKF reapi_team_dest running
[ 96] [190] C4 Destroyer 21.03.23 SKAJIbnEJIb c4_destroyer.am running
[ 97] Transfer Addons 1.0 SKAJIbnEJIb transfer_health running
[ 98] [190] Transfer RBS 21.03.25 SKAJIbnEJIb transfer_rbs.am running
[ 99] CS Revo: Anti IP 1.1 Wilian M. csr_anti_ip.amx running
99 plugins, 98 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();
}
Столкнулся с ошибкой в плагине throw_knife..подскажите, о чем эти ошибки говорят и можно ли их исправить?
В этой теме было размещено решение! Перейти к решению.