TheHiddenHour said in Removing MMS & Target Finder Attachments [Bo2]:
@Vexbane
Put level.givecustomloadout = ::givecustomloadout;
in your init()
function.
Then paste this function somewhere in your script:
givecustomloadout() {
weap = self getCurrentWeapon(); // Get the player's current weapon
if(weaponHasAttachment(weap, "mms") || weaponHasAttachment(weap, "rangefinder")) { // Weapon has mms or target finder
repl_weap = ""; // Ready a replacement weapon string
tokens = strTok(weap, "+"); // Tokenize the current weapon string
for(i = 0; i < tokens.size; i++) { // Iterate over every token
token = tokens[i];
if(i == 0) { // The first token should always be the weapon name
repl_weap += token; // Add weapon name to replacement string
}
else { // Current token is not the weapon name
if(token != "mms" && token != "rangefinder") { // Token is not the mms or rangefinder attachment
repl_weap += "+" + token; // Add attachment to replacement string
}
}
}
self takeWeapon(weap); // Take weapon with restricted attachment
self giveWeapon(repl_weap); // Give replacement weapon
if(weap == self.primaryLoadoutWeapon) { // If the weapon taken was the player's primary
self switchToWeapon(repl_weap); // Switch to the replacement weapon
}
}
}
I tested it very quickly and it seemed to work well. Let me know if you have any issues with it.
ok.. I think i figured out the this tutorial: https://forum.plutonium.pw/topic/10/tutorial-loading-custom-gsc-scripts?_=1587647081531
I actually didnt think when it said "drag and drop your file onto compiler.exe it really meant to drop it on top of it. I had never seen anything like that b4 and thought I was just meant to double click on it.
so after following another suggestion to get "black ops 2 - gsc studio" I started a new project in "offline mode" and it auto created this below,
- where you said "Put level.givecustomloadout = ::givecustomloadout; in your init() function." am i supposed to add that on the next line below what is already there or replace what is there?
- where u said "paste this function somewhere in ur script:" - am i supposed to put it anywhere or in a specific place? Does it matter if it is at the very end of this script that was auto created?
- do I need all that info that was auto created or is just the standard code that is required to function / make anything happen then we add what we want to do somewhere in it?
trying to make the code / script or whatever the simplest possible. literally all i want to do is remove (or replace them with something) the mms and target finder
thx for the help
/*
- Black Ops 2 - GSC Studio by iMCSx
- Creator : V3X
- Project : no mms, no target finder
- Mode : Multiplayer
- Date : 2020/04/24 - 10:03:00
*/
#include maps\mp_utility;
#include common_scripts\utility;
#include maps\mp\gametypes_hud_util;
#include maps\mp\gametypes_hud_message;
init()
{
level thread onPlayerConnect();
}
onPlayerConnect()
{
for(;;)
{
level waittill("connected", player);
player thread onPlayerSpawned();
}
}
onPlayerSpawned()
{
self endon("disconnect");
level endon("game_ended");
for(;;)
{
self waittill("spawned_player");
// Will appear each time when the player spawn, that's just an exemple.
self iprintln("Black Ops 2 - GSC Studio | Project : ^2no mms, no target finder");
}
}