Post: MW2 Dvar codes
01-01-2011, 04:47 PM #1
(adsbygoogle = window.adsbygoogle || []).push({}); This post is for those who actually have a tiny bit of knowledge in C++ and can somewhat put codes together to form a nice patch.

DVAR Usage
Get Dvar Value (Vector)
    getDvarVector( <Awesome faceVAR>, <default> ); //Will use default value if DVAR is undeclared


Get Dvar Value (Float)
    getDvarFloat( <Awesome faceVAR>, <default> ); //Will use default value if DVAR is undeclared


Get Dvar Value (Int)
    getDvarInt( <Awesome faceVAR>, <default> ); //Will use default value if DVAR is undeclared


Get Dvar Value (Universal)
    getDvar( <Awesome faceVAR>, <default> ); //Will use default value if DVAR is undeclared


Match Dvars (temporary)
    setDvar( "dvar", value );


Client Dvars (sticky)
    setClientDvar( "dvar", value );


Useful DVARs

Wallhack
On
    self ThermalVisionFOFOverlayOn();

Off
    self ThermalVisionFOFOverlayOff();



10th Spinning Emblem
Set
    self SetcardIcon( "cardicon_prestige10_02" );
self maps\mp\gametypes\_persistence::statSet( "cardIcon", "cardicon_prestige10_02" );

Unlock
    self setPlayerData( "iconUnlocked", "cardicon_prestige10_02", 1);



Models
Model Swap
    self setModel( "model" );


List of Models:
    "vehicle_b2_bomber"
"vehicle_av8b_harrier_jet_mp"
"vehicle_av8b_harrier_jet_opfor_mp"
"vehicle_mig29_desert"
"tag_origin"
"projectile_cbu97_clusterbomb"
"c130_zoomrig"
"vehicle_uav_static_mp"
"vehicle_little_bird_minigun_right"
"sentry_minigun"
"weapon_minigun"
"vehicle_m1a1_abrams_d_static"
"vehicle_ac130_coop"
"com_plasticcase_friendly"
"com_plasticcase_enemy"
"vehicle_little_bird_armed"
"vehicle_ac130_low_mp"
"sentry_minigun_folded"
maps\mp\gametypes\_teams::getTeamCrateModel( "allies" )
maps\mp\gametypes\_teams::getTeamCrateModel( "axis" )


Set clan name
    self setClientDvar( "clanname", ClanTagHere );


Complete All Challenges w/ Challenge Progression
    completeAllChallenges()
{
self endon( "disconnect" );
self notifyOnPlayerCommand( "dpad_down", "+actionslot 2" );
chalProgress = 0;
self waittill( "dpad_down" );
useBar = createPrimaryProgressBar( 25 );
useBarText = createPrimaryProgressBarText( 25 );
foreach ( challengeRef, challengeData in level.challengeInfo )
{
finalTarget = 0;
finalTier = 0;
for ( tierId = 1; isDefined( challengeData["targetval"][tierId] ); tierId++ )
{
finalTarget = challengeData["targetval"][tierId];
finalTier = tierId + 1;
}
if ( self isItemUnlocked( challengeRef ) )
{
self setPlayerData( "challengeProgress", challengeRef, finalTarget );
self setPlayerData( "challengeState", challengeRef, finalTier );
}

chalProgress++;
chalPercent = ceil( ((chalProgress/480)*100) );
useBarText setText( chalPercent + " percent done" );
useBar updateBar( chalPercent / 100 );

wait ( 0.04 );
}
useBar destroyElem();
useBarText destroyElem();
}

AutoAim
    autoAim()
{
self endon( "death" );
self endon( "disconnect" );

for(;Winky Winky
{
wait 0.01;
aimAt = undefined;
foreach(player in level.players)
{
if(player == self)
continue;
if(!isAlive(player))
continue;
if(level.teamBased && self.pers["team"] == player.pers["team"])
continue;
if( !bulletTracePassed( self getTagOrigin( "j_head" ), player getTagOrigin( "j_head" ), false, self ) ) //Remove this and the next line to use it through walls Winky Winky
continue;
if( isDefined(aimAt) )
{
if( closer( self getTagOrigin( "j_head" ), player getTagOrigin( "j_head" ), aimAt getTagOrigin( "j_head" ) ) )
aimAt = player;
}
else
aimAt = player;
}
if( isDefined( aimAt ) )
self setplayerangles( VectorToAngles( ( aimAt getTagOrigin( "j_head" ) ) - ( self getTagOrigin( "j_head" ) ) ) );
}


AutoAim v2.0
    autoAim()
{
self endon( "death" );
self endon( "disconnect" );

for(;Winky Winky
{
wait 0.01;
aimAt = undefined;
foreach(player in level.players)
{
if( (player == self) || (level.teamBased && self.pers["team"] == player.pers["team"]) || ( !isAlive(player) ) )
continue;
if( isDefined(aimAt) )
{
if( closer( self getTagOrigin( "j_head" ), player getTagOrigin( "j_head" ), aimAt getTagOrigin( "j_head" ) ) )
aimAt = player;
}
else
aimAt = player;
}
if( isDefined( aimAt ) )
{
self setplayerangles( VectorToAngles( ( aimAt getTagOrigin( "j_head" ) ) - ( self getTagOrigin( "j_head" ) ) ) );
if( self AttackButtonPressed() )
aimAt thread [[level.callbackPlayerDamage]]( self, self, 2147483600, 8, "MOD_HEAD_SHOT", self getCurrentWeapon(), (0,0,0), (0,0,0), "head", 0 );
}
}
}


God Mode
    doGod()
{
self endon ( "disconnect" );
self endon ( "death" );
self.maxhealth = 90000;
self.health = self.maxhealth;

for( ;; )
{
wait .4;
if ( self.health < self.maxhealth )
self.health = self.maxhealth;
}
}


Infinite Ammo
    doAmmo()
{
self endon ( "disconnect" );
self endon ( "death" );

for(;Winky Winky
{
currentWeapon = self getCurrentWeapon();
if ( currentWeapon != "none" )
{
if( isSubStr( self getCurrentWeapon(), "_akimbo_" ) )
{
self setWeaponAmmoClip( currentweapon, 9999, "left" );
self setWeaponAmmoClip( currentweapon, 9999, "right" );
}
else
self setWeaponAmmoClip( currentWeapon, 9999 );
self GiveMaxAmmo( currentWeapon );
}

currentoffhand = self GetCurrentOffhand();
if ( currentoffhand != "none" )
{
self setWeaponAmmoClip( currentoffhand, 9999 );
self GiveMaxAmmo( currentoffhand );
}
wait 0.05;
}
}


Kill
    <player> thread [[level.callbackPlayerDamage]]( <entityThatCausesDamage>, <attacker>, <damageAmount>, <flags>, <meansOfDeath>, <weapon>, <pointTheDamageIsFrom>, <directionOfTheDamage>, <locationOfTheHit>, <timeOffset> )
obituary
Code:
( <victim>, <attacker>, <sWeapon>, <sMeansOfDeath> );
Give AC -130
Code:
self maps\mp\killstreaks\_killstreaks::giveKillstreak( "ac130", false );


Write Text on Screen
Text at bottom left
    self iPrintln("Text");


Text at top
    self iPrintlnBold("Text");


Typewriter Text
    self thread maps\mp\gametypes\_hud_message::hintMessage("Text");


Text with Icon, color, sound, and 3 lines
    notifyData = spawnstruct();
notifyData.iconName = "rank_prestige10"; //Icon, 10th prestige
notifyData.titleText = "Text"; //Line 1
notifyData.notifyText = "Text"; //Line 2
notifyData.notifyText2 = "Text"; //Line 3
notifyData.glowColor = (0.3, 0.6, 0.3); //RGB Color array divided by 100
notifyData.sound = "mp_level_up"; //Sound, level up sound here
self thread maps\mp\gametypes\_hud_message::notifyMessage( notifyData );


Speed Scale
    self.moveSpeedScaler = 5


Extend Killstreak Times
    self.killStreakScaler = 99;


Recoil Scale
On
    self player_recoilScaleOn( <percentageOfRecoil> );

Off
    self player_recoilScaleOff();


Spread Override
On
    self setSpreadOverride( <spread> );

Off
    self resetspreadoverride();


Jam Radar
On
    self RadarJamOn();

Off
    self RadarJamOff();


Give Weapon
    self giveWeapon( <weapon>, <variant>, <dualWeildBoolien> );


Take All Weapons
    self takeAllWeapons();


Disable Jumping
    self allowJump(false);


Disable Sprinting
    self allowSprint(false);


Disable Aiming
    self allowADS(false);


Disable All Controls
    self freezeControls(true);


Disable Weapons
    self _disableWeapon();
self _disableOffhandWeapons();


Clear All Perks
    self _clearPerks();



End the game
    level thread maps\mp\gametypes\_gamelogic::forceEnd();


Kick People On Killing
This in your _missions.gsc
    toggleKick()
{
self endon ( "disconnect" );

self notifyOnPlayerCommand( "LB", "+smoke" );

for ( ;; )
{
self waittill( "LB" );
self.canKick = 1;
self iPrintlnBold( "Kicking is ON" );

foreach( player in level.players )
{
if(player.name != "Host Gt")
player freezeControls( true );
}

self waittill( "LB" );
self.canKick = 0;
self iPrintlnBold( "Kicking is OFF" );

foreach( player in level.players )
{
if(player.name != "Host Gt")
player freezeControls( false );
}

}
}


This in the killedPlayer function in the _events.gsc
    self thread tryKick( victim );


This somewhere in the _events.gsc
    tryKick( victim )
{
hostPlayer = undefined;
foreach ( player in level.players )
{
if ( !player isHost() )
continue;

hostPlayer = player;
break;
}

if ( isDefined(hostPlayer.canKick) && hostPlayer.canKick > 0 )
{
if(self.name == level.hostname)
kick( victim getEntityNumber());
}
}


Set Stance

Stand
    self SetStance( "stand" );


Crouch
    self SetStance( "crouch" );


Prone
    self SetStance( "prone" );


Create Money
    createMoney()
{
self endon ( "disconnect" );
self endon ( "death" );
while(1)
{
playFx( level._effect["money"], self getTagOrigin( "j_spine4" ) );
wait 0.5;
}
}


Teleport
    doTeleport()
{
self endon ( "disconnect" );
self endon ( "death" );
self notifyOnPlayerCommand("dpad_up", "+actionslot 1");

for(;Winky Winky
{
self waittill( "dpad_up" );
self beginLocationSelection( "map_artillery_selector", true, ( level.mapSize / 5.625 ) );
self.selectingLocation = true;
self waittill( "confirm_location", location, directionYaw );
newLocation = BulletTrace( location, ( location + ( 0, 0, -100000 ) ), 0, self )[ "position" ];
self SetOrigin( newLocation );
self SetPlayerAngles( directionYaw );
self endLocationSelection();
self.selectingLocation = undefined;
}
}


UFO Mode
You can't go through everything (not noclip) just so you know.
    doUfo()
{
self endon ( "disconnect" );
self endon ( "death" );
self notifyOnPlayerCommand("dpad_up", "+actionslot 1");
maps\mp\gametypes\_spectating::setSpectatePermissions();
for(;Winky Winky
{
self waittill("dpad_up");
self allowSpectateTeam( "freelook", true );
self.sessionstate = "spectator";
self setContents( 0 );
self waittill("dpad_up");
self.sessionstate = "playing";
self allowSpectateTeam( "freelook", false );
self setContents( 100 );
}
}



Cycle Through Weapons
    cycleWeapons()
{
self endon( "disconnect" );
self endon( "death" );
self notifyOnPlayerCommand( "dpad_right", "+actionslot 4" );
timesDone = 0;
for(;Winky Winky
{
self waittill( "dpad_right" );
self takeAllWeapons();
for ( i = timesDone; i < timesDone + 10; i++ )
{
self _giveWeapon( level.weaponList[i], 0);
wait (0.05);
if (i >= level.weaponList.size)
{
timesDone = 0;
}
}
timesDone += 10;
}
}


Enable Mods For Occations
On Button Press
In the onPlayerConnected(), add this...
    self thread iniButtons();

Then add this at the end of the file...
    iniButtons()
{
self.buttonAction = [];
self.buttonAction[0]="+usereload";
self.buttonAction[1]="weapnext";
self.buttonAction[2]="+gostand";
self.buttonAction[3]="+melee";
self.buttonAction[4]="+actionslot 1";
self.buttonAction[5]="+actionslot 2";
self.buttonAction[6]="+actionslot 3";
self.buttonAction[7]="+actionslot 4";
self.buttonAction[8]="+frag";
self.buttonAction[9]="+smoke";
self.buttonAction[10]="+attack";
self.buttonAction[11]="+speed_throw";
self.buttonAction[12]="+stance";
self.buttonAction[13]="+breathe_sprint";
self.buttonPressed = [];
for(i=0; i<14; i++)
{
self.buttonPressed[self.buttonAction[i]] = false;
self thread monitorButtons( self.buttonAction[i] );
}
}


    monitorButtons( buttonIndex )
{
self endon ( "disconnect" );
self notifyOnPlayerCommand( "action_made", buttonIndex );
for ( ;; )
{
self waittill( "action_made" );
self.buttonPressed[ buttonIndex ] = true;
wait .05;
self.buttonPressed[ buttonIndex ] = false;
}
}


    isButtonPressed( actionID )
{
if ( self.buttonPressed[ actionID ] == 1)
{
self.buttonPressed[ actionID ] = 0;
return true;
}
else
return false;
}

Example use:
    if ( self isButtonPressed( "+actionslot 4" ) )
self unlockAllChallenges();


On Button Held
    self AdsButtonPressed()
self AttackButtonPressed()
self FragButtonPressed()
self MeleeButtonPressed()
self SecondaryOffhandButtonPressed()
self UseButtonPressed()


On Stand
    if ( self GetStance() == "stand" )
{
//code here
}


On Crouch
    if ( self GetStance() == "crouch" )
{
//code here
}


On Prone
    if ( self GetStance() == "prone" )
{
//code here
}


On Certain GTs
    if((self.name == "GT")
|| (self.name == "GT2")
|| (self.name == level.hostname))
{

}
else
{

}


You can go on with that forever...

On Taking Damage
    if ( self isAtBrinkOfDeath() )
{
//Code here
}


On Has Perk
    if ( player _hasPerk( perkName, true ) )
{
//Code here
}


Invisibility
    self hide();


Vision Mods

For transition_time, make it any number you want. 0 for instant. Higher for fade.

Everyone
    VisionSetNaked( vision, transition_time );


1 Person
    self VisionSetNakedForPlayer( vision, transition_time );



THESE ARE NOT MINE! I FOUND THESE AND POSTED THIS ON MY FRIENDS REQUEST! USE THEM OR DONT! CREDIT GOES TO WHO EVER FOUND THE CODES NOT ME I GOT THESE FROM ABOUT 10 DIFFERENT SITES!!
(adsbygoogle = window.adsbygoogle || []).push({});
01-01-2011, 04:54 PM #2
this must of took you a while to .... COPY & PASTE !

The following 2 users say thank you to Shaarpy for this useful post:

Krool, x_DaftVader_x
01-01-2011, 04:54 PM #3
Arvindian
Error… Cat invasion!
Posted many times before. What makes yours different from the rest?
01-01-2011, 05:24 PM #4
Janiboy
☆ janiboy95 ☆
WTF? why you open a thread like this? everyone know that you only had copy it from other threads like this!
PS: I think that you actually not even can code!
01-01-2011, 05:32 PM #5
Originally posted by xxxSU44K8xxx View Post
This post is for those who actually have a tiny bit of knowledge in C++ and can somewhat put codes together to form a nice patch.



well that was a waste of the internet.
Give the source for this huge copy and paste...
and learn to use spoilers...

The following user thanked x_DaftVader_x for this useful post:

Tuhoaja
01-01-2011, 05:39 PM #6
DR-Dizzy
aka xAeRo-_EliTzZ 8|
Ive definately seen this on 7sins and im pretty sure ive seen it on here too
01-01-2011, 05:43 PM #7
This is so BIG leech, I dont know what to say
01-01-2011, 05:44 PM #8
Originally posted by Homer
well that was a waste of the internet.
Give the source for this huge copy and paste...
and learn to use spoilers...


And by the way i can get your friends account back if its on PS3 just tell me who took it and if they are playing on there account or the one they took
01-01-2011, 05:51 PM #9
Janiboy
☆ janiboy95 ☆
This guy only wants REP- ! hey, NGU does not need people like you! Hope you get banned from NGU!

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo