From e1c786d4fcb16623972ec824f69d8d19736777ac Mon Sep 17 00:00:00 2001 From: kruz1337 Date: Fri, 7 Jul 2023 01:41:39 +0300 Subject: [PATCH] Updated to 1.2.1 version, fixed bot hooks. --- scripts/nst_weapons.pwn | 2 +- scripts/nst_weapons_melee.pwn | 23 ++++++++++++++--- scripts/nst_weapons_primary.pwn | 39 ++++++++++++---------------- scripts/nst_weapons_secondary.pwn | 43 +++++++++++++------------------ 4 files changed, 54 insertions(+), 53 deletions(-) diff --git a/scripts/nst_weapons.pwn b/scripts/nst_weapons.pwn index 0e00347..f9dd2dd 100644 --- a/scripts/nst_weapons.pwn +++ b/scripts/nst_weapons.pwn @@ -2,7 +2,7 @@ #include #define PLUGIN "NST Weapons" -#define VERSION "1.2.0" +#define VERSION "1.2.1" #define AUTHOR "github.com/kruz1337" const MAX_PLAYER = 32 diff --git a/scripts/nst_weapons_melee.pwn b/scripts/nst_weapons_melee.pwn index d0f1379..203c344 100644 --- a/scripts/nst_weapons_melee.pwn +++ b/scripts/nst_weapons_melee.pwn @@ -7,7 +7,7 @@ #include #define PLUGIN "NST Melee Weapons" -#define VERSION "1.2.0" +#define VERSION "1.2.1" #define AUTHOR "github.com/kruz1337" const m_pPlayer = 41 @@ -62,8 +62,6 @@ public plugin_init() { register_forward(FM_PlayerPreThink, "fw_PlayerPreThink") RegisterHam(Ham_TakeDamage, "player", "Ham_TakeDamage_Pre") - RegisterHam(Ham_TakeDamage, "bot", "Ham_TakeDamage_Pre") - RegisterHam(Ham_Spawn, "bot", "Ham_BotSpawn_Post") RegisterHam(Ham_Item_Deploy, "weapon_knife", "Weapon_Deploy_Post", 1) RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_knife", "Primary_Attack_Post", 1) RegisterHam(Ham_Weapon_SecondaryAttack, "weapon_knife", "Secondary_Attack_Post", 1) @@ -742,7 +740,9 @@ public Ham_TakeDamage_Pre(victim, inflictor, attacker, Float: damage) { } public Ham_BotSpawn_Post(client) { - if (IsConfigBroken || !get_cvar_num("nst_give_bot")) { + if (IsConfigBroken || + !get_cvar_num("nst_give_bot") || + !is_user_alive(client)) { return HAM_IGNORED } @@ -909,4 +909,19 @@ public Task_BotWeapons(client) { if (random_weapon_id != 0) { Buy_Weapon(client, random_weapon_id) } +} + +public client_putinserver(client) { + if (IsConfigBroken || + !is_user_bot(client)) { + return PLUGIN_CONTINUE + } + + set_task(0.1, "Do_RegisterHam_Bot", client) + return PLUGIN_HANDLED +} + +public Do_RegisterHam_Bot(client) { + RegisterHamFromEntity(Ham_Spawn, client, "Ham_BotSpawn_Post") + RegisterHamFromEntity(Ham_TakeDamage, client, "Ham_TakeDamage_Pre") } \ No newline at end of file diff --git a/scripts/nst_weapons_primary.pwn b/scripts/nst_weapons_primary.pwn index ea59aa7..d4f1e40 100644 --- a/scripts/nst_weapons_primary.pwn +++ b/scripts/nst_weapons_primary.pwn @@ -7,7 +7,7 @@ #include #define PLUGIN "NST Primary Weapons" -#define VERSION "1.2.0" +#define VERSION "1.2.1" #define AUTHOR "github.com/kruz1337" const m_pPlayer = 41 @@ -98,8 +98,6 @@ public plugin_init() { register_forward(FM_CmdStart, "fw_CmdStart") RegisterHam(Ham_TakeDamage, "player", "Ham_TakeDamage_Pre") - RegisterHam(Ham_TakeDamage, "bot", "Ham_TakeDamage_Pre") - RegisterHam(Ham_Spawn, "bot", "Ham_BotSpawn_Post") RegisterHam(Ham_Touch, "weaponbox", "Ham_PlayerTouchWeaponBox") RegisterHam(Ham_TraceAttack, "worldspawn", "Ham_TraceAttack_Post", 1) RegisterHam(Ham_TraceAttack, "func_breakable", "Ham_TraceAttack_Post", 1) @@ -1751,26 +1749,6 @@ public Event_Death() { return PLUGIN_HANDLED } -/* -public client_putinserver(client) { - if (IsConfigBroken || !is_user_bot(client)) { - return PLUGIN_CONTINUE - } - - set_task(0.1, "Do_RegisterHam_Bot", client) - return PLUGIN_HANDLED -} - -public Do_RegisterHam_Bot(client) { - if (IsConfigBroken || !is_user_alive(client)) { - return - } - - RegisterHamFromEntity(Ham_Item_PostFrame, client, "Rifles_PostFrame_Pre") - RegisterHamFromEntity(Ham_Item_Deploy, client, "Weapon_Deploy_Post", 1) - RegisterHamFromEntity(Ham_Touch, client, "Ham_PlayerTouchWeaponBox") -}*/ - public Task_BotWeapons(client) { if (IsConfigBroken || !is_valid_ent(client)) { return @@ -1791,4 +1769,19 @@ public Task_BotWeapons(client) { } else if (random_weapon_id != 0) { Buy_Weapon(client, random_weapon_id) } +} + +public client_putinserver(client) { + if (IsConfigBroken || + !is_user_bot(client)) { + return PLUGIN_CONTINUE + } + + set_task(0.1, "Do_RegisterHam_Bot", client) + return PLUGIN_HANDLED +} + +public Do_RegisterHam_Bot(client) { + RegisterHamFromEntity(Ham_Spawn, client, "Ham_BotSpawn_Post") + RegisterHamFromEntity(Ham_TakeDamage, client, "Ham_TakeDamage_Pre") } \ No newline at end of file diff --git a/scripts/nst_weapons_secondary.pwn b/scripts/nst_weapons_secondary.pwn index a6889c3..37afed7 100644 --- a/scripts/nst_weapons_secondary.pwn +++ b/scripts/nst_weapons_secondary.pwn @@ -7,7 +7,7 @@ #include #define PLUGIN "NST Secondary Weapons" -#define VERSION "1.2.0" +#define VERSION "1.2.1" #define AUTHOR "github.com/kruz1337" const m_pPlayer = 41 @@ -86,8 +86,6 @@ public plugin_init() { register_event("TextMsg", "Event_Commencing", "a", "2=#Game_Commencing", "2=#Game_End", "2=#Game_will_restart_in") RegisterHam(Ham_TakeDamage, "player", "Ham_TakeDamage_Pre") - RegisterHam(Ham_TakeDamage, "bot", "Ham_TakeDamage_Pre") - RegisterHam(Ham_Spawn, "bot", "Ham_BotSpawn_Post") RegisterHam(Ham_Touch, "weaponbox", "Ham_PlayerTouchWeaponBox") RegisterHam(Ham_TraceAttack, "worldspawn", "Ham_TraceAttack_Post", 1) RegisterHam(Ham_TraceAttack, "func_breakable", "Ham_TraceAttack_Post", 1) @@ -1556,26 +1554,6 @@ public Event_Death() { return PLUGIN_CONTINUE } -/* -public client_putinserver(client) { - if (IsConfigBroken || !is_user_bot(client)) { - return PLUGIN_CONTINUE - } - - set_task(0.1, "Do_RegisterHam_Bot", client) - return PLUGIN_HANDLED -} - -public Do_RegisterHam_Bot(client) { - if (IsConfigBroken || !is_valid_ent(client)) { - return - } - - RegisterHamFromEntity(Ham_Item_PostFrame, client, "Pistols_PostFrame_Pre") - RegisterHamFromEntity(Ham_Item_Deploy, client, "Weapon_Deploy_Post", 1) - RegisterHamFromEntity(Ham_Touch, client, "Ham_PlayerTouchWeaponBox") -}*/ - public Task_BotWeapons(client) { if (IsConfigBroken || !is_valid_ent(client)) { return @@ -1585,10 +1563,10 @@ public Task_BotWeapons(client) { new CHANGE_WEAPON = str_to_num(ParseConfig(CURRENT_WEAPON, "wpn_id")) new wpnId = get_user_weapon(client) - + /* if (HasUserSecondary(client)) { return - } + }*/ new random_weapon_id = random_num(0, ArraySize(Pistol_Names) - 1) @@ -1597,4 +1575,19 @@ public Task_BotWeapons(client) { } else if (random_weapon_id != 0) { Buy_Weapon(client, random_weapon_id) } +} + +public client_putinserver(client) { + if (IsConfigBroken || + !is_user_bot(client)) { + return PLUGIN_CONTINUE + } + + set_task(0.1, "Do_RegisterHam_Bot", client) + return PLUGIN_HANDLED +} + +public Do_RegisterHam_Bot(client) { + RegisterHamFromEntity(Ham_Spawn, client, "Ham_BotSpawn_Post") + RegisterHamFromEntity(Ham_TakeDamage, client, "Ham_TakeDamage_Pre") } \ No newline at end of file