From eedb2ab05fa1ea8aecc06cc29fa020f774889c12 Mon Sep 17 00:00:00 2001 From: Kruziikrel1 Date: Mon, 14 Feb 2022 22:03:32 +0300 Subject: [PATCH] Optimized codes. --- scripts/nst_weapons.pwn | 6 +- scripts/nst_weapons_knifes.pwn | 592 ++++++++++++++---------------- scripts/nst_weapons_primary.pwn | 129 ++----- scripts/nst_weapons_secondary.pwn | 127 +++---- 4 files changed, 366 insertions(+), 488 deletions(-) diff --git a/scripts/nst_weapons.pwn b/scripts/nst_weapons.pwn index 3efd4c3..885a329 100644 --- a/scripts/nst_weapons.pwn +++ b/scripts/nst_weapons.pwn @@ -9,11 +9,9 @@ #include #include -#pragma tabsize 0 - #define PLUGIN "NST Weapons" -#define VERSION "1.0" -#define AUTHOR "Ҡruziikrel#6822" +#define VERSION "1.1" +#define AUTHOR "github.com/Kruziikrel1" new auto_buy_enabled = 0 diff --git a/scripts/nst_weapons_knifes.pwn b/scripts/nst_weapons_knifes.pwn index 8ebed5d..fe79603 100644 --- a/scripts/nst_weapons_knifes.pwn +++ b/scripts/nst_weapons_knifes.pwn @@ -12,19 +12,17 @@ #include #include -#pragma tabsize 0 - #define PLUGIN "NST Knifes" -#define VERSION "1.0" -#define AUTHOR "Ҡruziikrel#6822" +#define VERSION "1.1" +#define AUTHOR "github.com/Kruziikrel1" /* Other Variables */ #if defined UL_COMPAT - #define get_user_money(%1) cs_get_user_money_ul(%1) - #define set_user_money(%1,%2) cs_set_user_money_ul(%1,%2) + #define get_user_money(%1) cs_get_user_money_ul(%1) + #define set_user_money(%1,%2) cs_set_user_money_ul(%1,%2) #else - #define set_user_money(%1,%2) cs_set_user_money(%1,%2) - #define get_user_money(%1) cs_get_user_money(%1) + #define set_user_money(%1,%2) cs_set_user_money(%1,%2) + #define get_user_money(%1) cs_get_user_money(%1) #endif #define Get_BitVar(%1,%2) (%1 & (1 << (%2 & 31))) @@ -32,86 +30,25 @@ #define UnSet_BitVar(%1,%2) %1 &= ~(1 << (%2 & 31)) /* Offsets */ -const XTRA_OFS_PLAYER = 5 const m_pPlayer = 41 -const m_iId = 43 -const m_fKnown = 44 const m_flNextPrimaryAttack = 46 const m_flNextSecondaryAttack = 47 const m_flTimeWeaponIdle = 48 -const m_iPrimaryAmmoType = 49 -const m_iClip = 51 -const m_fInReload = 54 -const m_fInSpecialReload = 55 -const m_flAccuracy = 62 -const m_fSilent = 74 -const m_flDecreaseShotsFired = 76 -const m_flNextAttack = 83 -const m_iFOV = 363 -const m_rgAmmo_player_Slot0 = 376 -const m_pActiveItem = 373 /* Arrays */ new Array: Knife_InfoText; new Array: Knife_Names; new Array: Knifes_Number; -/* Config Variables */ -const NEXT_SECTION = 24 -const END_SECTION = 22 -const s_administrator = 1 -const s_administrator_next = 25 -const s_cost = 2 -const s_cost_next = 26 -const s_damage = 3 -const s_damage_next = 27 -const s_deploy = 4 -const s_deploy_next = 28 -const s_speed = 5 -const s_speed_next = 29 -const s_speed2 = 6 -const s_speed2_next = 30 -const s_knockback = 7 -const s_knockback_next = 31 -const s_fastrun = 8 -const s_fastrun_next = 32 -const s_jump_power = 9 -const s_jump_power_next = 33 -const s_jump_gravity = 10 -const s_jump_gravity_next = 34 -const s_sound_deploy = 11 -const s_sound_deploy_next = 35 -const s_sound_hit1 = 12 -const s_sound_hit1_next = 36 -const s_sound_hit2 = 13 -const s_sound_hit2_next = 37 -const s_sound_hit3 = 14 -const s_sound_hit3_next = 38 -const s_sound_hit4 = 15 -const s_sound_hit4_next = 39 -const s_sound_hitwall = 16 -const s_sound_hitwall_next = 40 -const s_sound_slash1 = 17 -const s_sound_slash1_next = 41 -const s_sound_slash2 = 18 -const s_sound_slash2_next = 42 -const s_sound_stab = 19 -const s_sound_stab_next = 43 -const s_v_model = 20 -const s_v_model_next = 44 -const s_p_model = 21 -const s_p_model_next = 45 -const s_w_model = 22 -const s_w_model_next = 46 - /* Integers */ const MAX_WPN = 5000 -new brokenConfig = 0 -new commencing = 0 new HAS_WEAPON[33] new CURRENT_WEAPON[33] new IN_BITVAR_JUMP +new brokenConfig = 0 +new commencing = 0 + /* Weapon Variables */ new class_knifes[MAX_WPN][32] @@ -135,17 +72,17 @@ public plugin_init() register_dictionary("nst_weapons.txt") register_concmd("nst_knife_rebuy", "ReBuy_Knife") register_clcmd("nst_menu_type7", "NST_Knife") - + register_event("HLTV", "event_new_round", "a", "1=0", "2=0"); register_event("HLTV", "event_start_freezetime", "a", "1=0", "2=0") register_event("CurWeapon", "Current_Weapon", "be", "1=1") register_event("Damage", "event_damage", "b", "2>0") register_event("DeathMsg", "event_death", "a", "1>0") register_event("TextMsg", "event_commencing", "a", "2=#event_commencing", "2=#Game_will_restart_in") - + register_forward(FM_EmitSound, "fw_EmitSound") register_forward(FM_PlayerPreThink, "fw_PlayerPreThink") - + RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage") RegisterHam(Ham_Item_Deploy, "weapon_knife", "Weapon_Deploy_Post", 1) RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_knife", "Primary_Attack_Post", 1) @@ -157,7 +94,7 @@ public plugin_startup() Knifes_Number = ArrayCreate(1) Knife_Names = ArrayCreate(64) Knife_InfoText = ArrayCreate(128) - + C_read_knife_config() C_read_knife_sections() C_check_knife_config() @@ -166,27 +103,27 @@ public plugin_startup() public plugin_precache() { plugin_startup() - + if (brokenConfig == 0) { for (new i = 1; i < ArraySize(Knife_Names); i++) { - new v_model[252], p_model[252], w_model[252], sight_model[252] + new v_model[252], p_model[252], w_model[252] formatex(v_model, charsmax(v_model), "models/%s", C_parse_knife_config(i, "v_model")) formatex(p_model, charsmax(p_model), "models/%s", C_parse_knife_config(i, "p_model")) formatex(w_model, charsmax(w_model), "models/%s", C_parse_knife_config(i, "w_model")) - + precache_model(v_model) precache_model(p_model) precache_model(w_model) } - + for (new i = 1; i < ArraySize(Knife_Names); i++) { new hitwall[252], deploy[252], stab[252] new hit1[252], hit2[252], hit3[252], hit4[252] new slash1[252], slash2[252] - + formatex(hitwall, charsmax(hitwall), "weapons/%s", C_parse_knife_config(i, "sound_hitwall")) formatex(deploy, charsmax(deploy), "weapons/%s", C_parse_knife_config(i, "sound_deploy")) formatex(stab, charsmax(stab), "weapons/%s", C_parse_knife_config(i, "sound_stab")) @@ -196,7 +133,7 @@ public plugin_precache() formatex(hit2, charsmax(hit2), "weapons/%s", C_parse_knife_config(i, "sound_hit2")) formatex(hit3, charsmax(hit3), "weapons/%s", C_parse_knife_config(i, "sound_hit3")) formatex(hit4, charsmax(hit4), "weapons/%s", C_parse_knife_config(i, "sound_hit4")) - + precache_sound(hitwall) precache_sound(deploy) precache_sound(stab) @@ -207,23 +144,23 @@ public plugin_precache() precache_sound(slash1) precache_sound(slash2) } - + new model[64] for (new wpnid = 0; wpnid < ArraySize(Knifes_Number); wpnid++) { if (wpnid != 0) { ArrayGetString(Knife_Names, wpnid, model, charsmax(model)) - + trim(model) replace(model, 64, " ", "_") strtolower(model) - + format(class_knifes[wpnid], 31, "nst_%s", model) - + cvar_cost[wpnid] = str_to_num(C_parse_knife_config(wpnid, "cost")) cvar_administrator[wpnid] = str_to_num(C_parse_knife_config(wpnid, "administrator")) - + cvar_deploy[wpnid] = str_to_float(C_parse_knife_config(wpnid, "deploy")) cvar_knockback[wpnid] = str_to_float(C_parse_knife_config(wpnid, "knockback")) cvar_dmgmultiplier[wpnid] = str_to_float(C_parse_knife_config(wpnid, "damage")) @@ -238,27 +175,74 @@ public plugin_precache() } /*Config Functions */ +const NEXT_SECTION = 24 +const END_SECTION = 22 +const s_administrator = 1 +const s_administrator_next = 25 +const s_cost = 2 +const s_cost_next = 26 +const s_damage = 3 +const s_damage_next = 27 +const s_deploy = 4 +const s_deploy_next = 28 +const s_speed = 5 +const s_speed_next = 29 +const s_speed2 = 6 +const s_speed2_next = 30 +const s_knockback = 7 +const s_knockback_next = 31 +const s_fastrun = 8 +const s_fastrun_next = 32 +const s_jump_power = 9 +const s_jump_power_next = 33 +const s_jump_gravity = 10 +const s_jump_gravity_next = 34 +const s_sound_deploy = 11 +const s_sound_deploy_next = 35 +const s_sound_hit1 = 12 +const s_sound_hit1_next = 36 +const s_sound_hit2 = 13 +const s_sound_hit2_next = 37 +const s_sound_hit3 = 14 +const s_sound_hit3_next = 38 +const s_sound_hit4 = 15 +const s_sound_hit4_next = 39 +const s_sound_hitwall = 16 +const s_sound_hitwall_next = 40 +const s_sound_slash1 = 17 +const s_sound_slash1_next = 41 +const s_sound_slash2 = 18 +const s_sound_slash2_next = 42 +const s_sound_stab = 19 +const s_sound_stab_next = 43 +const s_v_model = 20 +const s_v_model_next = 44 +const s_p_model = 21 +const s_p_model_next = 45 +const s_w_model = 22 +const s_w_model_next = 46 + public C_read_knife_sections() { new sectionNumber = 0 - new szTemp[64] - + new temp[64] + for (new i = 0; i < ArraySize(Knife_InfoText); i++) { if (i == 0) { - ArrayPushString(Knife_Names, szTemp) + ArrayPushString(Knife_Names, temp) ArrayPushCell(Knifes_Number, sectionNumber) i++; } - - ArrayGetString(Knife_InfoText, sectionNumber, szTemp, charsmax(szTemp)) - replace(szTemp, 999, "[", "") - replace(szTemp, 999, "]", "") - replace(szTemp, 999, "^n", "") - ArrayPushString(Knife_Names, szTemp) + + ArrayGetString(Knife_InfoText, sectionNumber, temp, charsmax(temp)) + replace(temp, 999, "[", "") + replace(temp, 999, "]", "") + replace(temp, 999, "^n", "") + ArrayPushString(Knife_Names, temp) ArrayPushCell(Knifes_Number, sectionNumber) - + if (ArraySize(Knife_InfoText) > sectionNumber + NEXT_SECTION) { sectionNumber = sectionNumber + NEXT_SECTION @@ -268,17 +252,17 @@ public C_read_knife_sections() i = ArraySize(Knife_InfoText) } } - + sectionNumber = 0 } public C_check_knife_config() { new messageTex[999] - new _knifes_File[100] = { "addons/amxmodx/configs/nst_weapons/nst_knifes.ini" } - + new configFile[100] = { "addons/amxmodx/configs/nst_weapons/nst_knifes.ini" } + formatex(messageTex[0], charsmax(messageTex) - 0, "%L", LANG_PLAYER, "BROKEN_CONFIG") - if (file_exists(_knifes_File) == 1) + if (file_exists(configFile) == 1) { if (C_knife_syntaxRules() == -1) { @@ -296,164 +280,163 @@ public C_check_knife_config() public C_read_knife_config() { new buffer[128] - new right[128], left[128] new left_comment[128], right_comment[128], left_s_comment[128], right_s_comment[128] - - new fp_knifes = fopen("addons/amxmodx/configs/nst_weapons/nst_knifes.ini", "r") - while (!feof(fp_knifes)) + + new fKnifes = fopen("addons/amxmodx/configs/nst_weapons/nst_knifes.ini", "r") + while (!feof(fKnifes)) { - fgets(fp_knifes, buffer, charsmax(buffer)) - + fgets(fKnifes, buffer, charsmax(buffer)) + //Comment Line Remover strtok(buffer, left_comment, 128, right_comment, 128, ';') format(right_comment, 128, ";%s", right_comment) str_replace(buffer, 128, right_comment, "_THIS_IS_COMMENT_LINE_") - + //Comment Line Remover 2 strtok(buffer, left_s_comment, 128, right_s_comment, 128, ']') if (!equali(right_s_comment, "")) { str_replace(buffer, 128, right_s_comment, "") } - + ArrayPushString(Knife_InfoText, buffer) - + for (new i = 0; i < ArraySize(Knife_InfoText); i++) { - new szTemp[128] - ArrayGetString(Knife_InfoText, i, szTemp, charsmax(szTemp)) - if (equali(szTemp, "_THIS_IS_COMMENT_LINE_")) + new temp[128] + ArrayGetString(Knife_InfoText, i, temp, charsmax(temp)) + if (equali(temp, "_THIS_IS_COMMENT_LINE_")) { ArrayDeleteItem(Knife_InfoText, i) } } } - - fclose(fp_knifes) + + fclose(fKnifes) } stock C_parse_knife_config(const strKey, const Property[]) { new parserLine[128] - new rightValue[128], leftValue[32], right_C[128], left_C[32] - + new rightValue[128], leftValue[32] + new PropertyNumber - + if (equali(Property, "administrator")) { PropertyNumber = s_administrator } - + if (equali(Property, "cost")) { PropertyNumber = s_cost } - + if (equali(Property, "damage")) { PropertyNumber = s_damage } - + if (equali(Property, "deploy")) { PropertyNumber = s_deploy } - + if (equali(Property, "speed")) { PropertyNumber = s_speed } - + if (equali(Property, "speed2")) { PropertyNumber = s_speed2 } - + if (equali(Property, "knockback")) { PropertyNumber = s_knockback } - + if (equali(Property, "jump_power")) { PropertyNumber = s_jump_power } - + if (equali(Property, "jump_gravity")) { PropertyNumber = s_jump_gravity } - + if (equali(Property, "fastrun")) { PropertyNumber = s_fastrun } - + if (equali(Property, "sound_deploy")) { PropertyNumber = s_sound_deploy } - + if (equali(Property, "sound_hit1")) { PropertyNumber = s_sound_hit1 } - + if (equali(Property, "sound_hit2")) { PropertyNumber = s_sound_hit2 } - + if (equali(Property, "sound_hit3")) { PropertyNumber = s_sound_hit3 } - + if (equali(Property, "sound_hit4")) { PropertyNumber = s_sound_hit4 } - + if (equali(Property, "sound_hitwall")) { PropertyNumber = s_sound_hitwall } - + if (equali(Property, "sound_slash1")) { PropertyNumber = s_sound_slash1 } - + if (equali(Property, "sound_slash2")) { PropertyNumber = s_sound_slash2 } - + if (equali(Property, "sound_stab")) { PropertyNumber = s_sound_stab } - + if (equali(Property, "v_model")) { PropertyNumber = s_v_model } - + if (equali(Property, "p_model")) { PropertyNumber = s_p_model } - + if (equali(Property, "w_model")) { PropertyNumber = s_w_model } - + ArrayGetString(Knife_InfoText, ArrayGetCell(Knifes_Number, strKey) + PropertyNumber, parserLine, charsmax(parserLine)) strtok(parserLine, leftValue, 64, rightValue, 127, '=') trim(leftValue); trim(rightValue); - + return rightValue } @@ -462,7 +445,7 @@ stock C_knife_syntaxRules() new buffer[128], leftValue[128], rightValue[128] new lineFixer[24] new firstChar[15], endChar[15] - + for (new i = 0; i < ArraySize(Knife_InfoText); i++) { ArrayGetString(Knife_InfoText, i, buffer, charsmax(buffer)) @@ -470,21 +453,21 @@ stock C_knife_syntaxRules() strtok(buffer, leftValue, 128, rightValue, 128, '=') trim(leftValue); trim(rightValue); - + new commentLine[128], le[1] strtok(rightValue, le, 1, commentLine, 128, ';') replace(commentLine, 128, "^n", "") trim(commentLine); - + if (!equali(commentLine, "")) { str_replace(rightValue, 999, commentLine, "") str_replace(rightValue, 999, ";", "") } - + formatex(firstChar, charsmax(firstChar), "%c", buffer[0]) formatex(endChar, charsmax(endChar), "%c", buffer[strlen(buffer) - 1]) - + //1- if (i == 0) { @@ -501,7 +484,7 @@ stock C_knife_syntaxRules() return -1; } } - + if (i == s_administrator) { if (equal(leftValue, "administator")) @@ -519,11 +502,11 @@ stock C_knife_syntaxRules() return -1 } } - + if (i == lineFixer[2] + s_administrator_next) { lineFixer[2] = lineFixer[2] + NEXT_SECTION; - + if (equal(leftValue, "administator")) { if (!equali(rightValue, "0")) @@ -539,7 +522,7 @@ stock C_knife_syntaxRules() return -1 } } - + if (i == s_cost) { if (equal(leftValue, "cost")) @@ -554,11 +537,11 @@ stock C_knife_syntaxRules() return -1 } } - + if (i == lineFixer[3] + s_cost_next) { lineFixer[3] = lineFixer[3] + NEXT_SECTION; - + if (equal(leftValue, "cost")) { if (!isdigit(rightValue[0])) @@ -571,7 +554,7 @@ stock C_knife_syntaxRules() return -1 } } - + if (i == s_damage) { if (equal(leftValue, "damage")) @@ -586,11 +569,11 @@ stock C_knife_syntaxRules() return -1 } } - + if (i == lineFixer[4] + s_damage_next) { lineFixer[4] = lineFixer[4] + NEXT_SECTION; - + if (equal(leftValue, "damage")) { if (!isdigit(rightValue[0])) @@ -603,7 +586,7 @@ stock C_knife_syntaxRules() return -1 } } - + if (i == s_deploy) { if (equal(leftValue, "deploy")) @@ -618,11 +601,11 @@ stock C_knife_syntaxRules() return -1 } } - + if (i == lineFixer[5] + s_deploy_next) { lineFixer[5] = lineFixer[5] + NEXT_SECTION; - + if (equal(leftValue, "deploy")) { if (!isdigit(rightValue[0])) @@ -635,7 +618,7 @@ stock C_knife_syntaxRules() return -1 } } - + if (i == s_speed) { if (equal(leftValue, "speed")) @@ -650,11 +633,11 @@ stock C_knife_syntaxRules() return -1 } } - + if (i == lineFixer[6] + s_speed_next) { lineFixer[6] = lineFixer[6] + NEXT_SECTION; - + if (equal(leftValue, "speed")) { if (!isdigit(rightValue[0])) @@ -667,7 +650,7 @@ stock C_knife_syntaxRules() return -1 } } - + if (i == s_speed2) { if (equal(leftValue, "speed2")) @@ -682,11 +665,11 @@ stock C_knife_syntaxRules() return -1 } } - + if (i == lineFixer[7] + s_speed2_next) { lineFixer[7] = lineFixer[7] + NEXT_SECTION; - + if (equal(leftValue, "speed2")) { if (!isdigit(rightValue[0])) @@ -699,7 +682,7 @@ stock C_knife_syntaxRules() return -1 } } - + if (i == s_knockback) { if (equal(leftValue, "knockback")) @@ -714,11 +697,11 @@ stock C_knife_syntaxRules() return -1 } } - + if (i == lineFixer[8] + s_knockback_next) { lineFixer[8] = lineFixer[8] + NEXT_SECTION; - + if (equal(leftValue, "knockback")) { if (!isdigit(rightValue[0])) @@ -731,7 +714,7 @@ stock C_knife_syntaxRules() return -1 } } - + if (i == s_fastrun) { if (equal(leftValue, "fastrun")) @@ -746,11 +729,11 @@ stock C_knife_syntaxRules() return -1 } } - + if (i == lineFixer[9] + s_fastrun_next) { lineFixer[9] = lineFixer[9] + NEXT_SECTION; - + if (equal(leftValue, "fastrun")) { if (!isdigit(rightValue[0])) @@ -763,7 +746,7 @@ stock C_knife_syntaxRules() return -1 } } - + if (i == s_jump_power) { if (equal(leftValue, "jump_power")) @@ -778,11 +761,11 @@ stock C_knife_syntaxRules() return -1 } } - + if (i == lineFixer[10] + s_jump_power_next) { lineFixer[11] = lineFixer[11] + NEXT_SECTION; - + if (equal(leftValue, "jump_power")) { if (!isdigit(rightValue[0])) @@ -795,7 +778,7 @@ stock C_knife_syntaxRules() return -1 } } - + if (i == s_jump_gravity) { if (equal(leftValue, "jump_gravity")) @@ -810,11 +793,11 @@ stock C_knife_syntaxRules() return -1 } } - + if (i == lineFixer[11] + s_jump_gravity_next) { lineFixer[11] = lineFixer[11] + NEXT_SECTION; - + if (equal(leftValue, "jump_gravity")) { if (!isdigit(rightValue[0])) @@ -827,7 +810,7 @@ stock C_knife_syntaxRules() return -1 } } - + if (i == s_sound_deploy) { if (equal(leftValue, "sound_deploy")) @@ -842,11 +825,11 @@ stock C_knife_syntaxRules() return -1 } } - + if (i == lineFixer[12] + s_sound_deploy_next) { lineFixer[12] = lineFixer[12] + NEXT_SECTION; - + if (equal(leftValue, "sound_deploy")) { if (!contain(rightValue, ".wav")) @@ -859,7 +842,7 @@ stock C_knife_syntaxRules() return -1 } } - + if (i == s_sound_hit1) { if (equal(leftValue, "sound_hit1")) @@ -874,11 +857,11 @@ stock C_knife_syntaxRules() return -1 } } - + if (i == lineFixer[13] + s_sound_hit1_next) { lineFixer[13] = lineFixer[13] + NEXT_SECTION; - + if (equal(leftValue, "sound_hit1")) { if (!contain(rightValue, ".wav")) @@ -891,7 +874,7 @@ stock C_knife_syntaxRules() return -1 } } - + if (i == s_sound_hit2) { if (equal(leftValue, "sound_hit2")) @@ -906,11 +889,11 @@ stock C_knife_syntaxRules() return -1 } } - + if (i == lineFixer[14] + s_sound_hit2_next) { lineFixer[14] = lineFixer[14] + NEXT_SECTION; - + if (equal(leftValue, "sound_hit2")) { if (!contain(rightValue, ".wav")) @@ -923,7 +906,7 @@ stock C_knife_syntaxRules() return -1 } } - + if (i == s_sound_hit3) { if (equal(leftValue, "sound_hit3")) @@ -938,11 +921,11 @@ stock C_knife_syntaxRules() return -1 } } - + if (i == lineFixer[15] + s_sound_hit3_next) { lineFixer[15] = lineFixer[15] + NEXT_SECTION; - + if (equal(leftValue, "sound_hit3")) { if (!contain(rightValue, ".wav")) @@ -955,7 +938,7 @@ stock C_knife_syntaxRules() return -1 } } - + if (i == s_sound_hit4) { if (equal(leftValue, "sound_hit4")) @@ -970,11 +953,11 @@ stock C_knife_syntaxRules() return -1 } } - + if (i == lineFixer[16] + s_sound_hit4_next) { lineFixer[16] = lineFixer[16] + NEXT_SECTION; - + if (equal(leftValue, "sound_hit4")) { if (!contain(rightValue, ".wav")) @@ -987,7 +970,7 @@ stock C_knife_syntaxRules() return -1 } } - + if (i == s_sound_hitwall) { if (equal(leftValue, "sound_hitwall")) @@ -1002,11 +985,11 @@ stock C_knife_syntaxRules() return -1 } } - + if (i == lineFixer[17] + s_sound_hitwall_next) { lineFixer[17] = lineFixer[17] + NEXT_SECTION; - + if (equal(leftValue, "sound_hitwall")) { if (!contain(rightValue, ".wav")) @@ -1019,7 +1002,7 @@ stock C_knife_syntaxRules() return -1 } } - + if (i == s_sound_slash1) { if (equal(leftValue, "sound_slash1")) @@ -1034,11 +1017,11 @@ stock C_knife_syntaxRules() return -1 } } - + if (i == lineFixer[18] + s_sound_slash1_next) { lineFixer[18] = lineFixer[18] + NEXT_SECTION; - + if (equal(leftValue, "sound_slash1")) { if (!contain(rightValue, ".wav")) @@ -1051,7 +1034,7 @@ stock C_knife_syntaxRules() return -1 } } - + if (i == s_sound_slash2) { if (equal(leftValue, "sound_slash2")) @@ -1066,11 +1049,11 @@ stock C_knife_syntaxRules() return -1 } } - + if (i == lineFixer[19] + s_sound_slash2_next) { lineFixer[19] = lineFixer[19] + NEXT_SECTION; - + if (equal(leftValue, "sound_slash2")) { if (!contain(rightValue, ".wav")) @@ -1083,7 +1066,7 @@ stock C_knife_syntaxRules() return -1 } } - + if (i == s_sound_stab) { if (equal(leftValue, "sound_stab")) @@ -1098,11 +1081,11 @@ stock C_knife_syntaxRules() return -1 } } - + if (i == lineFixer[20] + s_sound_stab_next) { lineFixer[20] = lineFixer[20] + NEXT_SECTION; - + if (equal(leftValue, "sound_stab")) { if (!contain(rightValue, ".wav")) @@ -1115,7 +1098,7 @@ stock C_knife_syntaxRules() return -1 } } - + if (i == s_v_model) { if (equal(leftValue, "v_model")) @@ -1130,11 +1113,11 @@ stock C_knife_syntaxRules() return -1 } } - + if (i == lineFixer[21] + s_v_model_next) { lineFixer[21] = lineFixer[21] + NEXT_SECTION; - + if (equal(leftValue, "v_model")) { if (!contain(rightValue, ".mdl")) @@ -1147,7 +1130,7 @@ stock C_knife_syntaxRules() return -1 } } - + if (i == s_p_model) { if (equal(leftValue, "p_model")) @@ -1162,11 +1145,11 @@ stock C_knife_syntaxRules() return -1 } } - + if (i == lineFixer[22] + s_p_model_next) { lineFixer[22] = lineFixer[22] + NEXT_SECTION; - + if (equal(leftValue, "p_model")) { if (!contain(rightValue, ".mdl")) @@ -1179,7 +1162,7 @@ stock C_knife_syntaxRules() return -1 } } - + if (i == s_w_model) { if (equal(leftValue, "w_model")) @@ -1194,11 +1177,11 @@ stock C_knife_syntaxRules() return -1 } } - + if (i == lineFixer[23] + s_w_model_next) { lineFixer[23] = lineFixer[23] + NEXT_SECTION; - + if (equal(leftValue, "w_model")) { if (!contain(rightValue, ".mdl")) @@ -1211,14 +1194,14 @@ stock C_knife_syntaxRules() return -1 } } - + if (i == lineFixer[0] + END_SECTION) { lineFixer[0] = lineFixer[0] + NEXT_SECTION i++; } } - + return 0; } @@ -1229,43 +1212,41 @@ stock create_velocity_vector(victim, attacker, Float: velocity[3], Float: knockb { return 0; } - + if (!is_valid_ent(attacker)) { return 0; } - + new Float: victim_origin[3], Float: attacker_origin[3], Float: new_origin[3]; - + entity_get_vector(victim, EV_VEC_origin, victim_origin); entity_get_vector(attacker, EV_VEC_origin, attacker_origin); - + new_origin[0] = victim_origin[0] - attacker_origin[0]; new_origin[1] = victim_origin[1] - attacker_origin[1]; - + velocity[0] = (new_origin[0] *(knockback *900)) / get_entity_distance(victim, attacker); velocity[1] = (new_origin[1] *(knockback *900)) / get_entity_distance(victim, attacker); - + return 1; } stock set_weapon_timeidle(id, Float: TimeIdle) { - new CURRENT_WEAPON = HAS_WEAPON[id] - if (!is_user_alive(id)) { return } - + static entwpn; entwpn = fm_get_user_weapon_entity(id, CSW_KNIFE) - + if (!pev_valid(entwpn)) { return } - + set_pdata_float(entwpn, m_flNextPrimaryAttack, TimeIdle, 4) set_pdata_float(entwpn, m_flNextSecondaryAttack, TimeIdle, 4) set_pdata_float(entwpn, m_flTimeWeaponIdle, TimeIdle + 1.0, 4) @@ -1275,7 +1256,7 @@ stock set_player_nextattack(id, Float: nexttime) { if (!is_user_alive(id)) return - + set_pdata_float(id, 83, nexttime, 5) } @@ -1292,10 +1273,10 @@ public NST_Knife(client) new szTemp[64] new menu[512], menuxx new text[256], len = 0 - new administrator, wpn_id + new administrator formatex(menu, charsmax(menu), "%L", LANG_PLAYER, "MENU_TITLE") menuxx = menu_create(menu, "Get_NSTMelee") - + if (brokenConfig == 0 && commencing == 0) { for (new i = 1; i < ArraySize(Knife_Names); i++) @@ -1303,7 +1284,7 @@ public NST_Knife(client) administrator = str_to_num(C_parse_knife_config(i, "administrator")) new menuKey[64] ArrayGetString(Knife_Names, i, szTemp, charsmax(szTemp)) - + if (administrator == 0) { formatex(menu, charsmax(menu), "%s \r$%s", szTemp, C_parse_knife_config(i, "cost")) @@ -1322,15 +1303,15 @@ public NST_Knife(client) { C_check_knife_config() } - + formatex(text[len], charsmax(text) - len, "%L", LANG_PLAYER, "MENU_NEXT"); menu_setprop(menuxx, MPROP_NEXTNAME, text) - + formatex(text[len], charsmax(text) - len, "%L", LANG_PLAYER, "MENU_BACK"); menu_setprop(menuxx, MPROP_BACKNAME, text) - + menu_setprop(menuxx, MPROP_EXIT, "\r%L", LANG_PLAYER, "MENU_EXIT") - + //Show Menu if (is_user_alive(client)) { @@ -1340,7 +1321,7 @@ public NST_Knife(client) { client_print(client, print_chat, "[NST Weapons] %L", LANG_PLAYER, "USER_IS_DEAD") } - + return PLUGIN_HANDLED } @@ -1350,7 +1331,7 @@ public Get_NSTMelee(client, menu, item) new access, callback, data[6], name[64] menu_item_getinfo(menu, item, access, data, 5, name, 63, callback) new key = str_to_num(data) - + if (key != 0) { Buy_Weapon(client, key - 1) @@ -1363,9 +1344,9 @@ public Buy_Weapon(id, wpnid) { return } - + new buyzone = cs_get_user_buyzone(id) - + if ((get_cvar_num("nst_use_buyzone") ? buyzone : 1) == 0) { client_print(id, print_chat, "[NST Wpn] %L", LANG_PLAYER, "CANT_BUY_WEAPON") @@ -1375,7 +1356,7 @@ public Buy_Weapon(id, wpnid) new user_money = get_user_money(id) new wp_cost = cvar_cost[wpnid] new administrator = cvar_administrator[wpnid] - + if (!(get_user_flags(id) &ADMIN_KICK) && administrator == 1) { client_print(id, print_chat, "[NST Weapons] %L", LANG_PLAYER, "ACCESS_DENIED_BUY") @@ -1392,15 +1373,15 @@ public Buy_Weapon(id, wpnid) { new szTemp[256] ArrayGetString(Knife_Names, HAS_WEAPON[id], szTemp, charsmax(szTemp)) - + client_print(id, print_chat, "[NST Weapons] %L", LANG_PLAYER, "ALREADY_HAVE", szTemp) } - else if (get_cvar_num("nst_free") ? 1 : wp_cost <= get_user_money(id)) + else if (get_cvar_num("nst_free") ? 1 : wp_cost <= get_user_money(id)) { CURRENT_WEAPON[id] = wpnid HAS_WEAPON[id] = wpnid Current_Weapon(id) - + if (get_cvar_num("nst_free") == 0) { set_user_money(id, user_money + -wp_cost) @@ -1419,13 +1400,13 @@ public ReBuy_Knife(id) { return PLUGIN_HANDLED } - + new wpnid = CURRENT_WEAPON[id] if (wpnid > 0) { Buy_Weapon(id, wpnid) } - + return PLUGIN_HANDLED } @@ -1435,22 +1416,22 @@ public Current_Weapon(client) { return PLUGIN_HANDLED } - + new CURRENT_WEAPON = HAS_WEAPON[client] - + new clip, ammo new wpn_id = get_user_weapon(client, clip, ammo) - + if (wpn_id == CSW_KNIFE && HAS_WEAPON[client]) { - new v_model[999], p_model[999], sight_model[999] + new v_model[999], p_model[999] formatex(v_model, charsmax(v_model), "models/%s", C_parse_knife_config(CURRENT_WEAPON, "v_model")) formatex(p_model, charsmax(p_model), "models/%s", C_parse_knife_config(CURRENT_WEAPON, "p_model")) - + set_pev(client, pev_viewmodel2, v_model) set_pev(client, pev_weaponmodel2, p_model) } - + return PLUGIN_HANDLED } @@ -1460,23 +1441,22 @@ public Primary_Attack_Post(entity) { return PLUGIN_HANDLED } - + if (!is_valid_ent(entity)) { return HAM_IGNORED } - + new client = pev(entity, pev_owner) - new id = get_pdata_cbase(entity, 41, 4); - + new CURRENT_WEAPON = HAS_WEAPON[client] new wpn_id = get_user_weapon(client, _, _) - + if (wpn_id == CSW_KNIFE && HAS_WEAPON[client]) { set_pdata_float(entity, m_flNextPrimaryAttack, cvar_speed[CURRENT_WEAPON], 4) } - + return FMRES_SUPERCEDE } @@ -1486,23 +1466,20 @@ public Secondary_Attack_Post(entity) { return PLUGIN_HANDLED } - + if (!is_valid_ent(entity)) { return HAM_IGNORED } - + new client = pev(entity, pev_owner) - new id = get_pdata_cbase(entity, 41, 4); - new CURRENT_WEAPON = HAS_WEAPON[client] - new wpn_id = get_user_weapon(client, _, _) - + if (HAS_WEAPON[client]) { set_pdata_float(entity, m_flNextSecondaryAttack, cvar_speed2[CURRENT_WEAPON], 4) } - + return FMRES_SUPERCEDE } @@ -1512,28 +1489,27 @@ public Weapon_Deploy_Post(entity) { return PLUGIN_HANDLED } - + new id = get_pdata_cbase(entity, m_pPlayer, 4); new CURRENT_WEAPON = HAS_WEAPON[id] - new wpn_id = get_user_weapon(id, _, _) - + if (!pev_valid(entity)) { return HAM_IGNORED; } - + if (!is_user_alive(id)) { return HAM_IGNORED; } - + if (HAS_WEAPON[id]) { emit_sound(id, CHAN_WEAPON, format_knife_sound(CURRENT_WEAPON, "sound_deploy"), VOL_NORM, ATTN_NORM, 0, PITCH_NORM) set_weapon_timeidle(id, cvar_deploy[CURRENT_WEAPON]) set_player_nextattack(id, cvar_deploy[CURRENT_WEAPON]) } - + return HAM_IGNORED } @@ -1544,10 +1520,10 @@ public fw_EmitSound(entity, channel, sound[], Float: volume, Float: attenuation, { return FMRES_IGNORED } - + new CURRENT_WEAPON = HAS_WEAPON[entity] new wpn_id = get_user_weapon(entity, _, _) - + if (wpn_id == CSW_KNIFE && HAS_WEAPON[entity]) { if (equali(sound, "weapons/knife_hit1.wav")) @@ -1555,50 +1531,50 @@ public fw_EmitSound(entity, channel, sound[], Float: volume, Float: attenuation, emit_sound(entity, channel, format_knife_sound(CURRENT_WEAPON, "sound_hit1"), volume, attenuation, fFlags, pitch) return FMRES_SUPERCEDE } - + if (equali(sound, "weapons/knife_hit2.wav")) { emit_sound(entity, channel, format_knife_sound(CURRENT_WEAPON, "sound_hit2"), volume, attenuation, fFlags, pitch) return FMRES_SUPERCEDE } - + if (equali(sound, "weapons/knife_hit3.wav")) { emit_sound(entity, channel, format_knife_sound(CURRENT_WEAPON, "sound_hit3"), volume, attenuation, fFlags, pitch) return FMRES_SUPERCEDE } - + if (equali(sound, "weapons/knife_hit4.wav")) { emit_sound(entity, channel, format_knife_sound(CURRENT_WEAPON, "sound_hit4"), volume, attenuation, fFlags, pitch) return FMRES_SUPERCEDE } - + if (equali(sound, "weapons/knife_hitwall1.wav")) { emit_sound(entity, channel, format_knife_sound(CURRENT_WEAPON, "sound_hitwall"), volume, attenuation, fFlags, pitch) return FMRES_SUPERCEDE } - + if (equali(sound, "weapons/knife_slash1.wav")) { emit_sound(entity, channel, format_knife_sound(CURRENT_WEAPON, "sound_slash1"), volume, attenuation, fFlags, pitch) return FMRES_SUPERCEDE } - + if (equali(sound, "weapons/knife_slash2.wav")) { emit_sound(entity, channel, format_knife_sound(CURRENT_WEAPON, "sound_slash2"), volume, attenuation, fFlags, pitch) return FMRES_SUPERCEDE } - + if (equali(sound, "weapons/knife_stab.wav")) { emit_sound(entity, channel, format_knife_sound(CURRENT_WEAPON, "sound_stab"), volume, attenuation, fFlags, pitch) return FMRES_SUPERCEDE } } - + return FMRES_IGNORED } @@ -1608,37 +1584,37 @@ public fw_PlayerPreThink(client) { return FMRES_IGNORED } - + new CURRENT_WEAPON = HAS_WEAPON[client] new wpn_id = get_user_weapon(client, _, _) - + if (wpn_id == CSW_KNIFE && HAS_WEAPON[client]) { entity_set_float(client, EV_FL_maxspeed, 240.0 + cvar_fastrun[CURRENT_WEAPON]) - + if ((pev(client, pev_button) & IN_JUMP) && !(pev(client, pev_oldbuttons) & IN_JUMP)) { new flags = pev(client, pev_flags) new waterlvl = pev(client, pev_waterlevel) - + if (!(flags & FL_ONGROUND)) { return FMRES_IGNORED } - + if (flags & FL_WATERJUMP) { return FMRES_IGNORED } - + if (waterlvl > 1) { return FMRES_IGNORED } - + new Float:fVelocity[3] pev(client, pev_velocity, fVelocity) - + fVelocity[2] += cvar_jumppower[CURRENT_WEAPON] set_pev(client, pev_velocity, fVelocity) @@ -1647,10 +1623,10 @@ public fw_PlayerPreThink(client) Set_BitVar(IN_BITVAR_JUMP, client) } } - + if ((pev(client, pev_button) & IN_JUMP) && !(pev(client, pev_oldbuttons) & IN_JUMP)) { - + } else { @@ -1663,7 +1639,7 @@ public fw_PlayerPreThink(client) } } } - + return FMRES_IGNORED } @@ -1673,14 +1649,14 @@ public fw_TakeDamage(victim, inflictor, attacker, Float: damage) { return } - + if (!is_valid_ent(attacker)) { return } new CURRENT_WEAPON = HAS_WEAPON[attacker] new weapon = get_user_weapon(attacker) - + if (weapon == CSW_KNIFE && HAS_WEAPON[attacker]) { SetHamParamFloat(4, damage *cvar_dmgmultiplier[CURRENT_WEAPON]) @@ -1694,7 +1670,7 @@ public client_putinserver(id) { return } - + if (is_user_bot(id)) { set_task(0.1, "Do_RegisterHam_Bot", id) @@ -1705,16 +1681,15 @@ public client_putinserver(id) public event_commencing() { commencing = 1 - + new id = read_data(2) - new CURRENT_WEAPON = HAS_WEAPON[id] - + if (HAS_WEAPON[id]) { HAS_WEAPON[id] = 0 return PLUGIN_HANDLED } - + return PLUGIN_CONTINUE } @@ -1724,19 +1699,19 @@ public event_damage(client) { return PLUGIN_CONTINUE } - if (!is_valid_ent(client)) - { - return PLUGIN_CONTINUE - } + if (!is_valid_ent(client)) + { + return PLUGIN_CONTINUE + } new weapon, attacker = get_user_attacker(client, weapon) - + new CURRENT_WEAPON = HAS_WEAPON[attacker] - + if (!is_user_alive(attacker)) { return PLUGIN_CONTINUE } - + if (weapon == CSW_KNIFE && HAS_WEAPON[attacker]) { new Float: vector[3] @@ -1747,21 +1722,20 @@ public event_damage(client) vector[1] += old_velocity[1] set_user_velocity(client, vector) } - + return PLUGIN_CONTINUE; } public event_death() { new id = read_data(2) - new CURRENT_WEAPON = HAS_WEAPON[id] - + if (HAS_WEAPON[id]) { HAS_WEAPON[id] = 0 return PLUGIN_HANDLED } - + return PLUGIN_CONTINUE } @@ -1782,11 +1756,11 @@ public Do_RegisterHam_Bot(id) { return } - + if (!is_valid_ent(id)) { return } - + RegisterHamFromEntity(Ham_TakeDamage, id, "fw_TakeDamage") } \ No newline at end of file diff --git a/scripts/nst_weapons_primary.pwn b/scripts/nst_weapons_primary.pwn index e734e92..e32895f 100644 --- a/scripts/nst_weapons_primary.pwn +++ b/scripts/nst_weapons_primary.pwn @@ -12,11 +12,9 @@ #include #include -#pragma tabsize 0 - #define PLUGIN "NST Primary Weapons" -#define VERSION "1.0" -#define AUTHOR "Ҡruziikrel#6822" +#define VERSION "1.1" +#define AUTHOR "github.com/Kruziikrel1" /* Other Variables */ #if defined UL_COMPAT @@ -40,21 +38,15 @@ enum (+= 100) const XTRA_OFS_PLAYER = 5 const m_pPlayer = 41 const m_iId = 43 -const m_fKnown = 44 const m_flNextPrimaryAttack = 46 const m_flNextSecondaryAttack = 47 const m_flTimeWeaponIdle = 48 const m_iPrimaryAmmoType = 49 const m_iClip = 51 const m_fInReload = 54 -const m_fInSpecialReload = 55 -const m_flAccuracy = 62 -const m_fSilent = 74 -const m_flDecreaseShotsFired = 76 const m_flNextAttack = 83 const m_iFOV = 363 const m_rgAmmo_player_Slot0 = 376 -const m_pActiveItem = 373 /* Arrays */ new Array: Rifle_InfoText; @@ -112,12 +104,10 @@ const s_fire_sounds_next = 46 /* Integers */ const MAX_WPN = 5000 new commencing = 0 -new typecontrol = 0 new brokenConfig = 0 -new backup_client new HAS_WEAPON[33] new CURRENT_WEAPON[33] -new inTwoZoom[33], inThreeZoom[33], Disable_Type_Zoom[33] +new inZoom[33], inZoom2[33], disableZoom[33] /* Weapon Variables */ new class_weapons[MAX_WPN][32] @@ -131,9 +121,8 @@ new Float:cvar_fastrun[MAX_WPN] new Float:cvar_sightrecoil[MAX_WPN] new Float:Pushangle[33][3] -new Float:round_time +new Float:roundTime -new cvar_uclip[MAX_WPN] new cvar_zoom_type[MAX_WPN] new cvar_clip[MAX_WPN] new cvar_ammo[MAX_WPN] @@ -148,50 +137,12 @@ new SAVE_CLIP[33] new SAVED_CLIP[33] new IN_EMIT_ATTACK -/* Weapons Consts */ new const rifles[] = { 3, 5, 7, 8, 12, 13, 14, 15, 18, 19 , 20 , 21 , 22 , 23 , 24 , 27 , 28 , 30 } new const weapons_ammo_id[] = { -1, 9, -1, 2, 12, 5, 14, 6, 4, 13, 10, 7, 6, 4, 4, 4, 6, 10, 1, 10, 3, 5, 4, 10, 2, 11, 8, 4, 2, -1, 7} new const weapons_max_bp_ammo[] = { -1, 52, -1, 90, -1, 32, -1, 100, 90, -1, 120, 100, 100, 90, 90, 90, 100, 120, 30, 120, 200, 32, 90, 120, 90, -1, 35, 90, 90, -1, 100 } new const buy_AmmoCount[] = { -1 , 13, -1, 30, -1, 8, -1, 12, 30, -1, 30, 50, 12, 30, 30, 30, 12, 30, 10, 30, 30, 8, 30, 30, 30, -1, 30, 30, 30, -1, 50 } new const buy_AmmoCost[] = { -1 , 50, -1, 80, -1, 65, -1, 25, 60, -1, 20, 50, 25, 60, 60, 60, 25, 20, 125, 20, 60, 65, 60, 20, 80, -1, 80, 60, 80, -1, 50 } - -/* Old Weapon Variables */ new const weapons_old_w[][] = { "w_scout", "w_xm1014", "w_aug", "w_mac10", "w_ump45", "w_sg550", "w_galil", "w_famas", "w_awp", "w_mp5navy", "w_m249", "w_m3", "w_m4a1", "w_tmp", "w_g3sg1", "w_sg552", "w_ak47", "w_p90" } -new const weapons_old_sounds[][] = -{ - "weapons/ak47-1.wav", - "weapons/ak47-2.wav", - "weapons/aug-1.wav", - "weapons/awp1.wav", - "weapons/deagle-1.wav", - "weapons/deagle-2.wav", - "weapons/elite_fire.wav", - "weapons/famas-1.wav", - "weapons/famas-2.wav", - "weapons/fiveseven-1.wav", - "weapons/g3sg1-1.wav", - "weapons/galil-1.wav", - "weapons/galil-2.wav", - "weapons/glock18-1.wav", - "weapons/glock18-2.wav", - "weapons/m4a1-1.wav", - "weapons/m249-1.wav", - "weapons/m249-2.wav", - "weapons/mac10-1.wav", - "weapons/mp5-1.wav", - "weapons/mp5-2.wav", - "weapons/p90-1.wav", - "weapons/p228-1.wav", - "weapons/sg550-1.wav", - "weapons/sg552-1.wav", - "weapons/sg552-2.wav", - "weapons/tmp-1.wav", - "weapons/tmp-2.wav", - "weapons/ump45-1.wav", - "weapons/usp1.wav", - "weapons/usp2.wav", - "weapons/xm1014-1.wav" -} stock const weapons_max_clip[] = {-1, 13, -1, 10, 1, 7, 1, 30, 30, 1, 30, 20, 25, 30, 35, 25, 12, 20, 10, 30, 100, 8, 30, 30, 20, 2, 7, 30, 30, -1, 50} stock const Float:weapons_clip_delay[CSW_P90+1] = {0.00, 2.70, 0.00, 2.00, 0.00, 0.55, 0.00, 3.15, 3.30, 0.00, 4.50, 2.70, 3.50, 3.35, 2.45, 3.30, 2.70, 2.20, 2.50, 2.63, 4.70, 0.55, 3.05, 2.12, 3.50, 0.00, 2.20, 3.00, 2.45, 0.00, 3.40} @@ -407,7 +358,6 @@ public C_check_rifle_config() public C_read_rifle_config() { new buffer[128] - new right[128], left[128] new left_comment[128], right_comment[128], left_s_comment[128], right_s_comment[128] new fp_rifles = fopen("addons/amxmodx/configs/nst_weapons/nst_rifles.ini", "r") @@ -445,7 +395,7 @@ public C_read_rifle_config() stock C_parse_rifle_config(const strKey, const Property[]) { new parserLine[128] - new rightValue[128], leftValue[32], right_C[128], left_C[32] + new rightValue[128], leftValue[32] new PropertyNumber @@ -1047,7 +997,7 @@ stock C_rifle_syntaxRules() { if (equal(leftValue, "tracer")) { - new r_color[64], g_color[64], b_color[64], width[64], right[64], left[64] + new r_color[64], g_color[64], b_color[64], width[64], right[64] strtok(rightValue, r_color, 64, right, 64, ',') strtok(right, g_color, 64, right, 64, ',') strtok(right, b_color, 64, width, 64, ',') @@ -1075,7 +1025,7 @@ stock C_rifle_syntaxRules() if (equal(leftValue, "tracer")) { - new r_color[64], g_color[64], b_color[64], width[64], right[64], left[64] + new r_color[64], g_color[64], b_color[64], width[64], right[64] strtok(rightValue, r_color, 64, right, 64, ',') strtok(right, g_color, 64, right, 64, ',') strtok(right, b_color, 64, width, 64, ',') @@ -1636,7 +1586,6 @@ public NST_Shotguns(client) new menu[512] , menuxx new text[256], len = 0 new administrator, wpn_id - backup_client = client formatex(menu, charsmax(menu), "%L", LANG_PLAYER, "MENU_TITLE") menuxx = menu_create(menu, "Get_NSTWeapon") @@ -1699,7 +1648,6 @@ public NST_Submachine(client) new menu[512] , menuxx new text[256], len = 0 new administrator, wpn_id - backup_client = client formatex(menu, charsmax(menu), "%L", LANG_PLAYER, "MENU_TITLE") menuxx = menu_create(menu, "Get_NSTWeapon") @@ -1762,7 +1710,6 @@ public NST_Rifles(client) new menu[512] , menuxx new text[256], len = 0 new administrator, wpn_id - backup_client = client formatex(menu, charsmax(menu), "%L", LANG_PLAYER, "MENU_TITLE") menuxx = menu_create(menu, "Get_NSTWeapon") @@ -1825,7 +1772,6 @@ public NST_Snipers(client) new menu[512] , menuxx new text[256], len = 0 new administrator, wpn_id - backup_client = client formatex(menu, charsmax(menu), "%L", LANG_PLAYER, "MENU_TITLE") menuxx = menu_create(menu, "Get_NSTWeapon") @@ -1888,7 +1834,6 @@ public NST_Machine(client) new menu[512] , menuxx new text[256], len = 0 new administrator, wpn_id - backup_client = client formatex(menu, charsmax(menu), "%L", LANG_PLAYER, "MENU_TITLE") menuxx = menu_create(menu, "Get_NSTWeapon") @@ -1973,7 +1918,7 @@ public Buy_Weapon(id, wpnid) } else { - new plrClip, plrAmmo, user + new plrClip, plrAmmo get_user_weapon(id, plrClip , plrAmmo) new user_money = get_user_money(id) @@ -1990,7 +1935,7 @@ public Buy_Weapon(id, wpnid) { client_print(id, print_chat, "[NST Weapons] %L", LANG_PLAYER, "NOT_LIVE") } - else if (get_gametime() - round_time > get_cvar_num("nst_buy_time")) + else if (get_gametime() - roundTime > get_cvar_num("nst_buy_time")) { engclient_print(id, engprint_center, "%L", LANG_PLAYER, "BUY_TIME_END", get_cvar_num("nst_buy_time")); } @@ -2077,8 +2022,6 @@ public Primary_Attack_Post(entity) } new client = pev(entity, pev_owner) - new id = get_pdata_cbase(entity, 41, 4); - new CURRENT_WEAPON = HAS_WEAPON[client] new CHANGE_WEAPON = str_to_num(C_parse_rifle_config(CURRENT_WEAPON, "wpn_id")) new wpn_id = get_user_weapon(client, _, _) @@ -2108,7 +2051,7 @@ public Primary_Attack_Post(entity) pev(client,pev_punchangle,push) xs_vec_sub(push, Pushangle[client], push) - if (inThreeZoom[client]) + if (inZoom2[client]) { xs_vec_mul_scalar(push, cvar_sightrecoil[CURRENT_WEAPON], push) } @@ -2275,11 +2218,11 @@ public Item_PostFrame(entity) } } - Disable_Type_Zoom[client] = 1 + disableZoom[client] = 1 } else { - Disable_Type_Zoom[client] = 0 + disableZoom[client] = 0 } } } @@ -2306,7 +2249,7 @@ public Current_Weapon(client) formatex(p_model,charsmax(p_model), "models/%s", C_parse_rifle_config(CURRENT_WEAPON, "p_model")) formatex(sight_model,charsmax(sight_model), "models/%s", C_parse_rifle_config(CURRENT_WEAPON, "sight_model")) - if (!inThreeZoom[client]) + if (!inZoom2[client]) { set_pev(client, pev_viewmodel2, v_model) } @@ -2394,10 +2337,10 @@ public OnPlayerTouchWeaponBox(ent, id) public ClientCommand_buyammo1(client) { + new iAmmo, iWeapon, ammo_max, ammo_def + if (brokenConfig != 0) { - new iClip, iAmmo, iWeapon, clip_max, ammo_max, clip_def, ammo_def - for (new i = 0; i < sizeof(rifles); i++) { if (user_has_weapon(client, rifles[i])) @@ -2431,12 +2374,9 @@ public ClientCommand_buyammo1(client) { new buyzone = cs_get_user_buyzone(client) new CURRENT_WEAPON = HAS_WEAPON[client] - new CHANGE_WEAPON = str_to_num(C_parse_rifle_config(CURRENT_WEAPON, "wpn_id")) if ((get_cvar_num("nst_use_buyzone") ? buyzone : 1) && user_has_primary(client)) { - new iClip, iAmmo, iWeapon, clip_max, ammo_max, clip_def, ammo_def - for (new i = 0; i < sizeof(rifles); i++) { if (user_has_weapon(client, rifles[i])) @@ -2447,9 +2387,7 @@ public ClientCommand_buyammo1(client) if (iWeapon != 0) { - clip_def = weapons_max_clip[iWeapon] ammo_def = weapons_max_bp_ammo[iWeapon] - clip_max = cvar_clip[CURRENT_WEAPON] ammo_max = cvar_ammo[CURRENT_WEAPON] iAmmo = cs_get_user_bpammo(client, iWeapon); @@ -2542,11 +2480,11 @@ public fw_TraceAttack(entity, attacker, Float:flDamage, Float:fDir[3], ptr, iDam new const GUNSHOT_DECALS[] = { 41, 42, 43, 44, 45 } new clip,ammo - new wpn_id = get_user_weapon(attacker, clip, ammo) + wpn_id = get_user_weapon(attacker, clip, ammo) if (wpn_id == CHANGE_WEAPON && HAS_WEAPON[attacker]) { - new r_color[64], g_color[64], b_color[64], width[64], right[64], left[64] + new r_color[64], g_color[64], b_color[64], width[64], right[64] strtok(cvar_tracer[CURRENT_WEAPON], r_color, 64, right, 64, ',') strtok(right, g_color, 64, right, 64, ',') strtok(right, b_color, 64, width, 64, ',') @@ -2668,7 +2606,6 @@ public fw_WorldModel(entity, model[]) new Classname[32], w_model[252] new CURRENT_WEAPON = HAS_WEAPON[iOwner] - new CHANGE_WEAPON = str_to_num(C_parse_rifle_config(CURRENT_WEAPON, "wpn_id")) pev(entity, pev_classname, Classname, sizeof(Classname)) @@ -2736,14 +2673,14 @@ public fw_CmdStart(client, uc_handle, seed) formatex(v_model, charsmax(v_model), "models/%s", C_parse_rifle_config(CURRENT_WEAPON, "v_model")) set_pev(client, pev_viewmodel2, v_model) - inTwoZoom[client] = 0 - inThreeZoom[client] = 0 + inZoom[client] = 0 + inZoom2[client] = 0 } else { if ((NewButton & IN_ATTACK2) && !(OldButton & IN_ATTACK2)) { - if (cvar_zoom_type[CURRENT_WEAPON] == 1 && !Disable_Type_Zoom[client]) + if (cvar_zoom_type[CURRENT_WEAPON] == 1 && !disableZoom[client]) { set_weapon_timeidle(client, 0.3) set_pdata_float(client, m_flNextAttack, 0.3, 5) @@ -2766,15 +2703,15 @@ public fw_CmdStart(client, uc_handle, seed) } } } - else if (cvar_zoom_type[CURRENT_WEAPON] == 2 && !Disable_Type_Zoom[client]) + else if (cvar_zoom_type[CURRENT_WEAPON] == 2 && !disableZoom[client]) { set_weapon_timeidle(client, 0.3) set_pdata_float(client, m_flNextAttack, 0.3, 5) set_player_nextattack(client, 0.66) - if (!inTwoZoom[client]) + if (!inZoom[client]) { - inTwoZoom[client] = 1 + inZoom[client] = 1 set_pdata_int(client, m_iFOV, 35, 5); if (get_cvar_num("nst_zoom_spk")) { @@ -2783,7 +2720,7 @@ public fw_CmdStart(client, uc_handle, seed) } else { - inTwoZoom[client] = 0 + inZoom[client] = 0 set_pdata_int(client, m_iFOV, 90, 5); if (get_cvar_num("nst_zoom_spk")) { @@ -2791,14 +2728,14 @@ public fw_CmdStart(client, uc_handle, seed) } } } - else if (cvar_zoom_type[CURRENT_WEAPON] == 3 && !Disable_Type_Zoom[client]) + else if (cvar_zoom_type[CURRENT_WEAPON] == 3 && !disableZoom[client]) { set_weapon_timeidle(client, 0.3) set_pdata_float(client, m_flNextAttack, 0.3, 5) set_player_nextattack(client, 0.66) - if (!inThreeZoom[client]) + if (!inZoom2[client]) { - inThreeZoom[client] = 1 + inZoom2[client] = 1 new sight_model[999] formatex(sight_model, charsmax(sight_model), "models/%s", C_parse_rifle_config(CURRENT_WEAPON, "sight_model")) set_pev(client, pev_viewmodel2, sight_model) @@ -2811,7 +2748,7 @@ public fw_CmdStart(client, uc_handle, seed) } else { - inThreeZoom[client] = 0 + inZoom2[client] = 0 new v_model[999] formatex(v_model, charsmax(v_model), "models/%s", C_parse_rifle_config(CURRENT_WEAPON, "v_model")) set_pev(client, pev_viewmodel2, v_model) @@ -2846,8 +2783,8 @@ public fw_CmdStart(client, uc_handle, seed) formatex(v_model, charsmax(v_model), "models/%s", C_parse_rifle_config(CURRENT_WEAPON, "v_model")) set_pev(client, pev_viewmodel2, v_model) - inTwoZoom[client] = 0 - inThreeZoom[client] = 0 + inZoom[client] = 0 + inZoom2[client] = 0 } } if (cvar_zoom_type[CURRENT_WEAPON] == 2 && (wpn_id == CSW_SG550 || wpn_id == CSW_AWP || wpn_id == CSW_G3SG1 || wpn_id == CSW_SG552)) @@ -2871,8 +2808,8 @@ public fw_CmdStart(client, uc_handle, seed) } else { - inTwoZoom[client] = 0 - inThreeZoom[client] = 0 + inZoom[client] = 0 + inZoom2[client] = 0 } } @@ -2985,7 +2922,7 @@ public event_start_freezetime() public event_new_round() { - round_time = get_gametime() + roundTime = get_gametime() } public client_putinserver(id) diff --git a/scripts/nst_weapons_secondary.pwn b/scripts/nst_weapons_secondary.pwn index dc49d75..4311a6c 100644 --- a/scripts/nst_weapons_secondary.pwn +++ b/scripts/nst_weapons_secondary.pwn @@ -12,11 +12,9 @@ #include #include -#pragma tabsize 0 - #define PLUGIN "NST Secondary Weapons" -#define VERSION "1.0" -#define AUTHOR "Ҡruziikrel#6822" +#define VERSION "1.1" +#define AUTHOR "github.com/Kruziikrel1" /* Other Variables */ #if defined UL_COMPAT @@ -57,21 +55,16 @@ enum (+= 100) const XTRA_OFS_PLAYER = 5 const m_pPlayer = 41 const m_iId = 43 -const m_fKnown = 44 const m_flNextPrimaryAttack = 46 const m_flNextSecondaryAttack = 47 const m_flTimeWeaponIdle = 48 const m_iPrimaryAmmoType = 49 const m_iClip = 51 const m_fInReload = 54 -const m_fInSpecialReload = 55 -const m_flAccuracy = 62 -const m_fSilent = 74 -const m_flDecreaseShotsFired = 76 const m_flNextAttack = 83 const m_iFOV = 363 const m_rgAmmo_player_Slot0 = 376 -const m_pActiveItem = 373 + /* Arrays */ new Array: Pistol_InfoText; @@ -130,12 +123,10 @@ const s_fire_sounds_next = 46 const MAX_WPN = 5000 new commencing = 0 -new typecontrol = 0 new brokenConfig = 0 -new backup_client new HAS_WEAPON[33] new CURRENT_WEAPON[33] -new inTwoZoom[33], inThreeZoom[33], Disable_Type_Zoom[33] +new inZoom[33], inZoom2[33], disableZoom[33] /* Weapon Variables */ new class_weapons[MAX_WPN][32] @@ -148,7 +139,6 @@ new Float:cvar_knockback[MAX_WPN] new Float:cvar_fastrun[MAX_WPN] new Float:cvar_sightrecoil[MAX_WPN] -new cvar_uclip[MAX_WPN] new cvar_secondary_type[MAX_WPN] new cvar_clip[MAX_WPN] new cvar_ammo[MAX_WPN] @@ -175,18 +165,6 @@ new const buy_AmmoCost[] = { -1 , 50, -1, 80, -1, 65, -1, 25, 60, -1, 20, 50, 25 /* Old Weapon Variables */ new const weapons_old_w[][] = { "w_fiveseven", "w_elite", "w_usp", "w_p228", "w_deagle", "w_glock18" } -new const weapons_old_sounds[][] = -{ - "weapons/deagle-1.wav", - "weapons/deagle-2.wav", - "weapons/elite_fire.wav", - "weapons/fiveseven-1.wav", - "weapons/glock18-1.wav", - "weapons/glock18-2.wav", - "weapons/p228-1.wav", - "weapons/usp1.wav", - "weapons/usp2.wav", -} stock const weapons_max_clip[] = {-1, 13, -1, 10, 1, 7, 1, 30, 30, 1, 30, 20, 25, 30, 35, 25, 12, 20, 10, 30, 100, 8, 30, 30, 20, 2, 7, 30, 30, -1, 50} stock const Float:weapons_clip_delay[CSW_P90+1] = {0.00, 2.70, 0.00, 2.00, 0.00, 0.55, 0.00, 3.15, 3.30, 0.00, 4.50, 2.70, 3.50, 3.35, 2.45, 3.30, 2.70, 2.20, 2.50, 2.63, 4.70, 0.55, 3.05, 2.12, 3.50, 0.00, 2.20, 3.00, 2.45, 0.00, 3.40} @@ -335,21 +313,21 @@ public plugin_precache() public C_read_pistol_sections() { new sectionNumber = 0 - new szTemp[64] + new temp[64] for (new i = 0; i < ArraySize(Pistol_InfoText); i++) { if (i == 0) { - ArrayPushString(Pistol_Names, szTemp) + ArrayPushString(Pistol_Names, temp) ArrayPushCell(Pistol_Numbers, sectionNumber) i++; } - ArrayGetString(Pistol_InfoText, sectionNumber, szTemp, charsmax( szTemp ) ) - replace(szTemp, 999, "[", "") - replace(szTemp, 999, "]", "") - replace(szTemp, 999, "^n", "") - ArrayPushString(Pistol_Names, szTemp) + ArrayGetString(Pistol_InfoText, sectionNumber, temp, charsmax( temp ) ) + replace(temp, 999, "[", "") + replace(temp, 999, "]", "") + replace(temp, 999, "^n", "") + ArrayPushString(Pistol_Names, temp) ArrayPushCell(Pistol_Numbers, sectionNumber) if (ArraySize(Pistol_InfoText) > sectionNumber + NEXT_SECTION) @@ -388,7 +366,6 @@ public C_check_pistol_config() public C_read_pistol_config() { new buffer[128] - new right[128], left[128] new left_comment[128], right_comment[128], left_s_comment[128], right_s_comment[128] new fp_pistols = fopen("addons/amxmodx/configs/nst_weapons/nst_pistols.ini", "r") @@ -412,9 +389,9 @@ public C_read_pistol_config() for (new i = 0; i < ArraySize(Pistol_InfoText); i++) { - new szTemp[128] - ArrayGetString(Pistol_InfoText, i, szTemp, charsmax(szTemp)) - if (equali(szTemp, "_THIS_IS_COMMENT_LINE_")) + new temp[128] + ArrayGetString(Pistol_InfoText, i, temp, charsmax(temp)) + if (equali(temp, "_THIS_IS_COMMENT_LINE_")) { ArrayDeleteItem(Pistol_InfoText, i) } @@ -426,7 +403,7 @@ public C_read_pistol_config() stock C_parse_pistol_config(const strKey, const Property[]) { new parserLine[128] - new rightValue[128], leftValue[32], right_C[128], left_C[32] + new rightValue[128], leftValue[32] new PropertyNumber @@ -1034,7 +1011,7 @@ stock C_pistol_syntaxRules() { if (equal(leftValue, "tracer")) { - new r_color[64], g_color[64], b_color[64], width[64], right[64], left[64] + new r_color[64], g_color[64], b_color[64], width[64], right[64] strtok(rightValue, r_color, 64, right, 64, ',') strtok(right, g_color, 64, right, 64, ',') strtok(right, b_color, 64, width, 64, ',') @@ -1062,7 +1039,7 @@ stock C_pistol_syntaxRules() if (equal(leftValue, "tracer")) { - new r_color[64], g_color[64], b_color[64], width[64], right[64], left[64] + new r_color[64], g_color[64], b_color[64], width[64], right[64] strtok(rightValue, r_color, 64, right, 64, ',') strtok(right, g_color, 64, right, 64, ',') strtok(right, b_color, 64, width, 64, ',') @@ -1709,11 +1686,10 @@ ResetFov(id) /* Menu Function */ public NST_Pistols(client) { - new szTemp[64] + new temp[64] new menu[512] , menuxx new text[256], len = 0 new administrator, wpn_id - backup_client = client formatex(menu, charsmax(menu), "%L", LANG_PLAYER, "MENU_TITLE") menuxx = menu_create(menu, "Get_NSTWeapon") @@ -1724,19 +1700,19 @@ public NST_Pistols(client) administrator = str_to_num(C_parse_pistol_config(i, "administrator")) wpn_id = str_to_num(C_parse_pistol_config(i, "wpn_id")) new menuKey[64] - ArrayGetString(Pistol_Names, i, szTemp, charsmax(szTemp)) + ArrayGetString(Pistol_Names, i, temp, charsmax(temp)) if (wpn_id == 1 || wpn_id == 10 || wpn_id == 11 || wpn_id == 16 || wpn_id == 17 || wpn_id == 26) { if (administrator == 0) { - formatex(menu,charsmax(menu), "%s \r$%s", szTemp, C_parse_pistol_config(i, "cost")) + formatex(menu,charsmax(menu), "%s \r$%s", temp, C_parse_pistol_config(i, "cost")) num_to_str(i + 1, menuKey, 999) menu_additem(menuxx, menu, menuKey) } else { - formatex(menu,charsmax(menu), "\y%s \r$%s", szTemp, C_parse_pistol_config(i, "cost")) + formatex(menu,charsmax(menu), "\y%s \r$%s", temp, C_parse_pistol_config(i, "cost")) num_to_str(i + 1, menuKey, 999) menu_additem(menuxx, menu, menuKey) } @@ -1773,10 +1749,10 @@ public NST_Pistols(client) /* Weapon Registration */ public ClientCommand_buyammo2(client) { + new iAmmo, iWeapon, ammo_max, ammo_def + if (brokenConfig != 0) { - new iClip, iAmmo, iWeapon, clip_max, ammo_max, clip_def, ammo_def - for (new i = 0; i < sizeof(pistols); i++) { if (user_has_weapon(client, pistols[i])) @@ -1810,12 +1786,9 @@ public ClientCommand_buyammo2(client) { new buyzone = cs_get_user_buyzone(client) new CURRENT_WEAPON = HAS_WEAPON[client] - new CHANGE_WEAPON = str_to_num(C_parse_pistol_config(CURRENT_WEAPON, "wpn_id")) if ((get_cvar_num("nst_use_buyzone") ? buyzone : 1) && user_has_secondary(client)) { - new iClip, iAmmo, iWeapon, clip_max, ammo_max, clip_def, ammo_def - for (new i = 0; i < sizeof(pistols); i++) { if (user_has_weapon(client, pistols[i])) @@ -1826,9 +1799,7 @@ public ClientCommand_buyammo2(client) if (iWeapon != 0) { - clip_def = weapons_max_clip[iWeapon] ammo_def = weapons_max_bp_ammo[iWeapon] - clip_max = cvar_clip[CURRENT_WEAPON] ammo_max = cvar_ammo[CURRENT_WEAPON] iAmmo = cs_get_user_bpammo(client, iWeapon); @@ -1912,7 +1883,7 @@ public Buy_Weapon(id, wpnid) } else { - new plrClip, plrAmmo, user + new plrClip, plrAmmo get_user_weapon(id, plrClip , plrAmmo) new user_money = get_user_money(id) @@ -1935,10 +1906,10 @@ public Buy_Weapon(id, wpnid) } else if(HAS_WEAPON[id] == wpnid) { - new szTemp[256] - ArrayGetString(Pistol_Names, HAS_WEAPON[id], szTemp, charsmax(szTemp)) + new temp[256] + ArrayGetString(Pistol_Names, HAS_WEAPON[id], temp, charsmax(temp)) - client_print(id, print_chat, "[NST Weapons] %L", LANG_PLAYER, "ALREADY_HAVE", szTemp) + client_print(id, print_chat, "[NST Weapons] %L", LANG_PLAYER, "ALREADY_HAVE", temp) } else if (get_cvar_num("nst_free") ? 1 : wp_cost <= get_user_money(id)) { @@ -2065,11 +2036,11 @@ public Item_PostFrame(entity) } } - Disable_Type_Zoom[client] = 1 + disableZoom[client] = 1 } else { - Disable_Type_Zoom[client] = 0 + disableZoom[client] = 0 } } } @@ -2113,7 +2084,6 @@ public Primary_Attack_Post(entity) } new client = pev(entity, pev_owner) - new id = get_pdata_cbase(entity, 41, 4); new CURRENT_WEAPON = HAS_WEAPON[client] new CHANGE_WEAPON = str_to_num(C_parse_pistol_config(CURRENT_WEAPON, "wpn_id")) @@ -2144,7 +2114,7 @@ public Primary_Attack_Post(entity) pev(client,pev_punchangle,push) xs_vec_sub(push, Pushangle[client], push) - if (inThreeZoom[client]) + if (inZoom2[client]) { xs_vec_mul_scalar(push, cvar_sightrecoil[CURRENT_WEAPON], push) } @@ -2269,7 +2239,7 @@ public Current_Weapon(client) formatex(p_model,charsmax(p_model), "models/%s", C_parse_pistol_config(CURRENT_WEAPON, "p_model")) formatex(sight_model,charsmax(sight_model), "models/%s", C_parse_pistol_config(CURRENT_WEAPON, "sight_model")) - if (!inThreeZoom[client]) + if (!inZoom2[client]) { set_pev(client, pev_viewmodel2, v_model) } @@ -2372,7 +2342,7 @@ public fw_TraceAttack(entity, attacker, Float:flDamage, Float:fDir[3], ptr, iDam new const GUNSHOT_DECALS[] = { 41, 42, 43, 44, 45 } new clip,ammo - new wpn_id = get_user_weapon(attacker, clip, ammo) + wpn_id = get_user_weapon(attacker, clip, ammo) if (wpn_id == CHANGE_WEAPON && HAS_WEAPON[attacker]) { @@ -2387,7 +2357,7 @@ public fw_TraceAttack(entity, attacker, Float:flDamage, Float:fDir[3], ptr, iDam Make_BulletSmoke(attacker, ptr) } - new r_color[64], g_color[64], b_color[64], width[64], right[64], left[64] + new r_color[64], g_color[64], b_color[64], width[64], right[64] strtok(cvar_tracer[CURRENT_WEAPON], r_color, 64, right, 64, ',') strtok(right, g_color, 64, right, 64, ',') strtok(right, b_color, 64, width, 64, ',') @@ -2509,7 +2479,6 @@ public fw_WorldModel(entity, model[]) new Classname[32], w_model[252] new CURRENT_WEAPON = HAS_WEAPON[iOwner] - new CHANGE_WEAPON = str_to_num(C_parse_pistol_config(CURRENT_WEAPON, "wpn_id")) pev(entity, pev_classname, Classname, sizeof(Classname)) @@ -2577,14 +2546,14 @@ public fw_CmdStart(client, uc_handle, seed) formatex(v_model, charsmax(v_model), "models/%s", C_parse_pistol_config(CURRENT_WEAPON, "v_model")) set_pev(client, pev_viewmodel2, v_model) - inTwoZoom[client] = 0 - inThreeZoom[client] = 0 + inZoom[client] = 0 + inZoom2[client] = 0 } else { if ((NewButton & IN_ATTACK2) && !(OldButton & IN_ATTACK2)) { - if (cvar_secondary_type[CURRENT_WEAPON] == 1 && !Disable_Type_Zoom[client]) + if (cvar_secondary_type[CURRENT_WEAPON] == 1 && !disableZoom[client]) { set_weapon_timeidle(client, 0.3) set_pdata_float(client, m_flNextAttack, 0.3, 5) @@ -2607,15 +2576,15 @@ public fw_CmdStart(client, uc_handle, seed) } } } - else if (cvar_secondary_type[CURRENT_WEAPON] == 2 && !Disable_Type_Zoom[client]) + else if (cvar_secondary_type[CURRENT_WEAPON] == 2 && !disableZoom[client]) { set_weapon_timeidle(client, 0.3) set_pdata_float(client, m_flNextAttack, 0.3, 5) set_player_nextattack(client, 0.66) - if (!inTwoZoom[client]) + if (!inZoom[client]) { - inTwoZoom[client] = 1 + inZoom[client] = 1 set_pdata_int(client, m_iFOV, 35, 5); if (get_cvar_num("nst_zoom_spk")) { @@ -2624,7 +2593,7 @@ public fw_CmdStart(client, uc_handle, seed) } else { - inTwoZoom[client] = 0 + inZoom[client] = 0 set_pdata_int(client, m_iFOV, 90, 5); if (get_cvar_num("nst_zoom_spk")) { @@ -2632,14 +2601,14 @@ public fw_CmdStart(client, uc_handle, seed) } } } - else if (cvar_secondary_type[CURRENT_WEAPON] == 3 && !Disable_Type_Zoom[client]) + else if (cvar_secondary_type[CURRENT_WEAPON] == 3 && !disableZoom[client]) { set_weapon_timeidle(client, 0.3) set_pdata_float(client, m_flNextAttack, 0.3, 5) set_player_nextattack(client, 0.66) - if (!inThreeZoom[client]) + if (!inZoom2[client]) { - inThreeZoom[client] = 1 + inZoom2[client] = 1 new sight_model[999] formatex(sight_model, charsmax(sight_model), "models/%s", C_parse_pistol_config(CURRENT_WEAPON, "sight_model")) set_pev(client, pev_viewmodel2, sight_model) @@ -2652,7 +2621,7 @@ public fw_CmdStart(client, uc_handle, seed) } else { - inThreeZoom[client] = 0 + inZoom2[client] = 0 new v_model[999] formatex(v_model, charsmax(v_model), "models/%s", C_parse_pistol_config(CURRENT_WEAPON, "v_model")) set_pev(client, pev_viewmodel2, v_model) @@ -2687,8 +2656,8 @@ public fw_CmdStart(client, uc_handle, seed) formatex(v_model, charsmax(v_model), "models/%s", C_parse_pistol_config(CURRENT_WEAPON, "v_model")) set_pev(client, pev_viewmodel2, v_model) - inTwoZoom[client] = 0 - inThreeZoom[client] = 0 + inZoom[client] = 0 + inZoom2[client] = 0 } } if (cvar_secondary_type[CURRENT_WEAPON] == 2 && (wpn_id == CSW_SG550 || wpn_id == CSW_AWP || wpn_id == CSW_G3SG1 || wpn_id == CSW_SG552)) @@ -2703,8 +2672,8 @@ public fw_CmdStart(client, uc_handle, seed) } else { - inTwoZoom[client] = 0 - inThreeZoom[client] = 0 + inZoom[client] = 0 + inZoom2[client] = 0 } }