From 899431bed2d473cc0be4bf335f16a1831c42bd32 Mon Sep 17 00:00:00 2001 From: Resxt <55228336+Resxt@users.noreply.github.com> Date: Wed, 9 Mar 2022 11:40:22 +0100 Subject: [PATCH] launchers_weapons_rewards 1.0.1 - Add WeaponIsValid to only start the reward loop if the spawn weapon is a launcher - Update README --- custom_killstreaks_rewards/README.md | 1 + .../launchers_weapons_rewards.gsc | 50 +++++++++++++------ 2 files changed, 36 insertions(+), 15 deletions(-) diff --git a/custom_killstreaks_rewards/README.md b/custom_killstreaks_rewards/README.md index 83e3be7..5e33a7f 100644 --- a/custom_killstreaks_rewards/README.md +++ b/custom_killstreaks_rewards/README.md @@ -5,6 +5,7 @@ Scripts that give the players different weapons or perks depending on their curr ## launchers_weapons_rewards.gsc Gives the player a new weapon every time he reaches a new tier. +`WeaponIsValid()` ensures that the rewards are only given if the player's spawn weapon is a launcher. If the player reaches the last tier the loop restarts allowing players to get tiers several time per life if they ever get enough kills. For example with this script if you get 50 kills in a row you would get the AC130 105mm two times. This is how the script is configured diff --git a/custom_killstreaks_rewards/launchers_weapons_rewards.gsc b/custom_killstreaks_rewards/launchers_weapons_rewards.gsc index cda476f..e29b667 100644 --- a/custom_killstreaks_rewards/launchers_weapons_rewards.gsc +++ b/custom_killstreaks_rewards/launchers_weapons_rewards.gsc @@ -34,8 +34,6 @@ OnPlayerSpawned() { self waittill("spawned_player"); - print(self.name); - if (isDefined(self.pers["isBot"])) { if (self.pers["isBot"]) @@ -48,15 +46,6 @@ OnPlayerSpawned() } } -ReplaceWeapon(new_weapon) -{ - self TakeAllWeapons(); - self GiveWeapon(new_weapon); - self GiveWeapon("semtex_mp"); // Found in dsr files - self GiveWeapon("flare_mp"); // Tactical insertion - found in common_mp.ff - self SetSpawnWeapon(new_weapon); // This gives the weapon without playing the animation -} - WeaponReward() { self endon ("disconnect"); @@ -64,11 +53,14 @@ WeaponReward() spawn_weapon = self GetCurrentWeapon(); - while(true) + if (WeaponIsValid(spawn_weapon)) { - weapon_rewards = [[5, "m320_mp"], [10, "rpg_mp"], [15, "ac130_40mm_mp"], [25, "ac130_105mm_mp"], [35, spawn_weapon]]; // [kills_required, weapon_reward] - CheckWeaponReward(weapon_rewards); - wait 0.01; + while(true) + { + weapon_rewards = [[5, "m320_mp"], [10, "rpg_mp"], [15, "ac130_40mm_mp"], [25, "ac130_105mm_mp"], [35, spawn_weapon]]; // [kills_required, weapon_reward] + CheckWeaponReward(weapon_rewards); + wait 0.01; + } } } @@ -95,6 +87,34 @@ CheckWeaponReward(weapon_rewards) } } +ReplaceWeapon(new_weapon) +{ + self TakeAllWeapons(); + self GiveWeapon(new_weapon); + self GiveWeapon("semtex_mp"); // Found in dsr files + self GiveWeapon("flare_mp"); // Tactical insertion - found in common_mp.ff + self SetSpawnWeapon(new_weapon); // This gives the weapon without playing the animation +} + +WeaponIsValid(weapon) +{ + switch (weapon) + { + case "iw5_smaw_mp": + return true; + case "rpg_mp": + return true; + case "m320_mp": + return true; + case "xm25_mp": + return true; + case "javelin_mp": + return true; + default: + return false; + } +} + // Allow the AC-130 kills to be counted in player.pers["cur_kill_streak"] WhitelistKillstreaksInKillsCount( weapon ) {