From 1d8dbaf7328f18b5bf9ac6d82744a88e9d1bb8bf Mon Sep 17 00:00:00 2001 From: Resxt <55228336+Resxt@users.noreply.github.com> Date: Mon, 21 Feb 2022 19:35:49 +0100 Subject: [PATCH] Added replace_weapon_on_spawn --- replace_weapon_on_spawn/README.md | 10 +++ .../replace_rsass_with_intervention.gsc | 65 +++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 replace_weapon_on_spawn/README.md create mode 100644 replace_weapon_on_spawn/replace_rsass_with_intervention.gsc diff --git a/replace_weapon_on_spawn/README.md b/replace_weapon_on_spawn/README.md new file mode 100644 index 0000000..57e24e1 --- /dev/null +++ b/replace_weapon_on_spawn/README.md @@ -0,0 +1,10 @@ +# Replace Weapon On Spawn + +A script to replace players weapon when they spawn. +This can easily be modified to always give a certain weapon or only give it when the player has a certain weapon etc. +This is useful to add ported weapons like the Intervention to your default classes until Plutonium adds the possibility to do it directly in dsr files. + +## replace_rsass_with_intervention.gsc +Replace the RSASS with an Intervention (ACOG sight) +Replace the RSASS silencer with an Intervention (ACOG sight + silencer) +Gives a throwing knife and a tactical insertion in both cases \ No newline at end of file diff --git a/replace_weapon_on_spawn/replace_rsass_with_intervention.gsc b/replace_weapon_on_spawn/replace_rsass_with_intervention.gsc new file mode 100644 index 0000000..6a09513 --- /dev/null +++ b/replace_weapon_on_spawn/replace_rsass_with_intervention.gsc @@ -0,0 +1,65 @@ +Init() +{ + level thread OnPlayerConnect(); +} + +OnPlayerConnect() +{ + for(;;) + { + level waittill("connected", player); + player thread OnPlayerSpawned(); + } +} + +OnPlayerSpawned() +{ + self endon("disconnect"); + for(;;) + { + self waittill("spawned_player"); + current_weapon = self GetCurrentWeapon(); + self thread DoWeaponCheck(current_weapon); + } +} + +DoWeaponCheck(current_weapon) +{ + self endon("death"); + self endon("disconnect"); + level endon("game_ended"); + + //Debug(current_weapon); + + if (current_weapon == "iw5_rsass_mp_rsassscope") + { + ReplaceWeapon("iw5_cheytac_mp_acog"); + GiveLethalAndTactical(); + + } + else if (current_weapon == "iw5_rsass_mp_rsassscope_silencer03") + { + ReplaceWeapon("iw5_cheytac_mp_acog_silencer03"); + GiveLethalAndTactical(); + } +} + +ReplaceWeapon(new_weapon) +{ + self TakeAllWeapons(); + self GiveWeapon(new_weapon); + self SetSpawnWeapon(new_weapon); // This gives the weapon without playing the animation +} + +// TakeAllWeapons() removes lethal and tactical as well so we give default items after calling it +GiveLethalAndTactical() +{ + self GiveWeapon("throwingknife_mp"); // Found in dsr files + self GiveWeapon("flare_mp"); // Tactical insertion - found in common_mp.ff +} + +// Prints text in the bootstrapper +Debug(text) +{ + Print(text); +} \ No newline at end of file