Release "Real" Forcefield Script

SlothWiiPlaza

Known Member
Messages
34
Points
118
Hello, CabConModding,
Today i'm releasing my "Real" Forcefield script for Black Ops 2.
It's a pretty short code, it only changes a dvar so bye bye long "forcefield" code! :sunglasses:
You can set it to the reccomended value or to a custom one, i've included both.

Ayways, here it is:

Here's the code you would want:
PHP:
realForceField()
{
  if(!isDefined(self.forceField))
  {
   self.forceField = "Active";
   setDvar("playerPushAmount", "100");
   iprintlnbold(self.name + ": Real Forcefield: [^2ON^7]");
  }
  else
  {
   self.forceField = undefined;
   setDvar("playerPushAmount", "1");
   iprintlnbold(self.name + ": Real Forcefield: [^1OFF^7]");
   }
}
or if you want a custom input:
PHP:
realForceField(input)
{
  if(!isDefined(self.forceField))
  {
   self.forceField = "Active";
   setDvar("playerPushAmount", input);
   iprintlnbold(self.name + ": Real Forcefield: [^2ON^7]");
  }
  else
  {
   self.forceField = undefined;
   setDvar("playerPushAmount", "1");
   iprintlnbold(self.name + ": Real Forcefield: [^1OFF^7]");
   }
}
Call it in like:
PHP:
add_option(F, "Forcefield", ::realForceField);
or if you use the custom input:
PHP:
add_option(F, "Forcefield", ::realForceField, "50");
There, only 15 lines instead of 50 or so. :grinning:
Now, personally i think my script is better because it's shorter and easier, like said before.

Happy Modding :y:
 

CabCon

Head Administrator
Staff member
Head Staff Team
Messages
4,589
Points
828
Hello, CabConModding,
Today i'm releasing my "Real" Forcefield script for Black Ops 2.
It's a pretty short code, it only changes a dvar so bye bye long "forcefield" code! :sunglasses:
You can set it to the reccomended value or to a custom one, i've included both.

Ayways, here it is:

Here's the code you would want:
PHP:
realForceField()
{
  if(!isDefined(self.forceField))
  {
   self.forceField = "Active";
   setDvar("playerPushAmount", "100");
   iprintlnbold(self.name + ": Real Forcefield: [^2ON^7]");
  }
  else
  {
   self.forceField = undefined;
   setDvar("playerPushAmount", "1");
   iprintlnbold(self.name + ": Real Forcefield: [^1OFF^7]");
   }
}
or if you want a custom input:
PHP:
realForceField(input)
{
  if(!isDefined(self.forceField))
  {
   self.forceField = "Active";
   setDvar("playerPushAmount", input);
   iprintlnbold(self.name + ": Real Forcefield: [^2ON^7]");
  }
  else
  {
   self.forceField = undefined;
   setDvar("playerPushAmount", "1");
   iprintlnbold(self.name + ": Real Forcefield: [^1OFF^7]");
   }
}
Call it in like:
PHP:
add_option(F, "Forcefield", ::realForceField);
or if you use the custom input:
PHP:
add_option(F, "Forcefield", ::realForceField, "50");
There, only 15 lines instead of 50 or so. :smile:
Now, personally i think my script is better because it's shorter and easier, like said before.

Happy Modding :y:
Thanks for sharing! :smile:
 

iTahhr

Well-Known Member
Messages
248
Points
243
we make are own instead of making a dvar because dvars only work for host ~sniped~
 
Last edited by a moderator:

The Dark Side

Former Staff Member
Messages
1,010
Points
768
we make are own instead of making a dvar because dvars only work for host dumass
Hey now, no need for the dumbass. Honestly i thought there was a way to apply dvars to other people anyway. I know there are ways to change fov and stuff for other people.

So why not this? There should be a way right?
 

vRice

Insane-Known Member
Messages
57
Points
368
I'm bored and procrastinating from finishing my last uni assignment, so here's an even smaller version which should do the same thing (cba testing in-game) :*

Code:
forceField()
{
    i = self.forceField;

    if(i)
        self.forceField = false;
    else
        self.forceField = true;

    setDvar("playerPushAmount", 1 + (i * 99));
    iPrintLnBold("^" + (i + 1) + "Forcefield");
}
 

iTahhr

Well-Known Member
Messages
248
Points
243
I'm the dumbass? This dvar works for all players you retard.
But of course your little brain didn't realize that did it? :O
yes u are it may work for all clients but if one person activates it, it will activate for all clients
 

SlothWiiPlaza

Known Member
Messages
34
Points
118
yes u are it may work for all clients but if one person activates it, it will activate for all clients
That's the point you ~sniped~, i wonder if you have any brain cells in there.
 
Last edited by a moderator:

iTahhr

Well-Known Member
Messages
248
Points
243
ur a ~sniped~ i swear mean
 
Last edited by a moderator:

DF_AUS

Moderator
Staff member
Head Staff Team
Donator
Messages
583
Points
653
Hello, CabConModding,
Today i'm releasing my "Real" Forcefield script for Black Ops 2.
It's a pretty short code, it only changes a dvar so bye bye long "forcefield" code! :sunglasses:
You can set it to the reccomended value or to a custom one, i've included both.

Ayways, here it is:

Here's the code you would want:
PHP:
realForceField()
{
  if(!isDefined(self.forceField))
  {
   self.forceField = "Active";
   setDvar("playerPushAmount", "100");
   iprintlnbold(self.name + ": Real Forcefield: [^2ON^7]");
  }
  else
  {
   self.forceField = undefined;
   setDvar("playerPushAmount", "1");
   iprintlnbold(self.name + ": Real Forcefield: [^1OFF^7]");
   }
}
or if you want a custom input:
PHP:
realForceField(input)
{
  if(!isDefined(self.forceField))
  {
   self.forceField = "Active";
   setDvar("playerPushAmount", input);
   iprintlnbold(self.name + ": Real Forcefield: [^2ON^7]");
  }
  else
  {
   self.forceField = undefined;
   setDvar("playerPushAmount", "1");
   iprintlnbold(self.name + ": Real Forcefield: [^1OFF^7]");
   }
}
Call it in like:
PHP:
add_option(F, "Forcefield", ::realForceField);
or if you use the custom input:
PHP:
add_option(F, "Forcefield", ::realForceField, "50");
There, only 15 lines instead of 50 or so. :smile:
Now, personally i think my script is better because it's shorter and easier, like said before.

Happy Modding :y:
Good stuff, i would use this rather than the old "All" clients code :y:
 

Top