Advertisement
BaSs_HaXoR

BO2 GSC

Sep 14th, 2014
2,807
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 15.18 KB | None | 0 0
  1. //SOURCES: http://www.nextgenupdate.com/forums/call-duty-black-ops-2-mods-cheats-guides/764127-tutorial-basic-gsc-scripting.html
  2. // https://www.dropbox.com/sh/6uzfd87ctahizd5/AACbDCvUgv5ABW4ueOwzc7O4a?dl=0
  3. //
  4.  
  5. AI
  6. Animation
  7. BadPlaces
  8. Clans
  9. Client
  10. Control
  11. Damage
  12. Debug
  13. Dvars
  14. Effects
  15. Entity
  16. File
  17. HUD
  18. Level
  19. Math
  20. Menus
  21. Missile
  22. Motion
  23. Objective
  24. Physics
  25. Player
  26. Precache
  27. Rumble
  28. Save
  29. Sentient
  30. Sound
  31. Spawn
  32. String
  33. System
  34. Teams
  35. Trace
  36. Triggers
  37. Turret
  38. Variables
  39. Vector
  40. Vehicles
  41. Weapons
  42.  
  43. ======================================================================================================================
  44.  
  45.  
  46.  
  47.     Button Monitoring
  48.    
  49.     if(self sprintbuttonpressed()) self iprintln("SPRINT");
  50.     if(self inventorybuttonpressed()) self iprintln("INVENTORY");
  51.     if(self secondaryoffhandbuttonpressed()) self iprintln("SECONDARY OFFHAND");
  52.     if(self fragbuttonpressed()) self iprintln("FRAG");
  53.     if(self stancebuttonpressed()) self iprintln("STANCE");
  54.     if(self jumpbuttonpressed()) self iprintln("JUMP");
  55.     if(self meleebuttonpressed()) self iprintln("MELEE");
  56.     if(self throwbuttonpressed()) self iprintln("THROW");
  57.     if(self adsbuttonpressed()) self iprintln("ADS");
  58.     if(self actionslotfourbuttonpressed()) self iprintln("ACTION SLOT FOUR");
  59.     if(self actionslotthreebuttonpressed()) self iprintln("ACTION SLOT THREE");
  60.     if(self actionslottwobuttonpressed()) self iprintln("ACTION SLOT TWO");
  61.     if(self actionslotonebuttonpressed()) self iprintln("ACTION SLOT ONE");
  62.     if(self attackbuttonpressed()) self iprintln("ATTACK");
  63.     if(self changeseatbuttonpressed()) self iprintln("CHANGE SEAT");
  64.     if(self usebuttonpressed()) self iprintln("USE");
  65.    
  66.     Stat Functions
  67.    
  68.     Use the previously released stats structure to get stat names.
  69.     Stats do have some limits. On Xbox 360, last I checked, the limits are as follows:
  70.     plevel and stats_version can't change
  71.    rankxp can't increase by 65536 or decrease by 1
  72.     kills and assists can't increase by 300 or decrease by 1
  73.    deaths can't decrease
  74.     headshots can't increase by 200 or decrease
  75.    revives can't increase by 100 or decrease
  76.     time played, wins and ties can't decrease
  77.    hits and misses can't increase by 2500 or decrease
  78.     total shots can't increase by 5000 or decrease
  79.    rank can't increase by 20
  80.  
  81.     The following all take 1 to 8 arguments
  82.    
  83.     player getdstat();
  84.     player setdstat();
  85.     player adddstat();
  86.     player addweaponstat();
  87.     player addbonuscardstat();
  88.     player addplayerstat();
  89.     player addplayerstatwithgametype();
  90.     player addgametypestat();
  91.    
  92.    
  93.     Infinite Ammo
  94.     Needs to be threaded!
  95.     Code (Text):
  96.     //Call like
  97.     //self thread unlimited_ammo();
  98.  
  99.     unlimited_ammo(  )
  100.     {
  101.         self endon( "disconnect" );
  102.         self endon( "death" );
  103.  
  104.         for(;;)
  105.         {
  106.             wait 0.1;
  107.  
  108.             currentWeapon = self getcurrentweapon();
  109.             if ( currentWeapon != "none" )
  110.             {
  111.                 self setweaponammoclip( currentWeapon, weaponclipsize(currentWeapon) );
  112.                 self givemaxammo( currentWeapon );
  113.             }
  114.  
  115.             currentoffhand = self getcurrentoffhand();
  116.             if ( currentoffhand != "none" )
  117.                 self givemaxammo( currentoffhand );
  118.         }
  119.     }
  120.    
  121.    
  122.     God Mode
  123.     Code (Text):
  124.     self enableInvulnerability();     // On
  125.     self disableInvulnerability();     // Off
  126.    
  127.    
  128.     String Table Asset Functions
  129.     tablelookupfindcoreasset(stringTableName); //For the following functions, stringTable can either be a string of the assets name, or the string table's index. This function looks up the string table's index. Note that this is faster than finding it every time, so this should be used for multiple table lookups.
  130.     tablelookup(stringTable, searchIndex, searchString, outputIndex); //This would search stringTable for the searchString in the column searchColumnIndex, and print the item in column outputColumnIndex in that row. Also note that this function takes a maximum of 8 arguments.
  131.     tablelookupistring(stringTable, searchColumnIndex, searchString, outputColumnIndex); //Same as above, except it returns the value as an istring as opposed to a string. An istring would be defined as &"", used for denoting localized strings. Max of 4 arguments.
  132.     tablelookuprownum(stringTable, searchColumnIndex, searchString); //Similar to the above except it returns the row number the searchString is found on (in the column searchColumnIndex of course).
  133.     tablelookupcolumnforrow(stringTable, rowIndex, columnIndex); //Standard(x,y) lookup.
  134.     Weapon Asset Functions
  135.     Code (Text):
  136.     weaponfiretime(weapon);
  137.     weaponreloadtime(weapon);
  138.     isweaponcliponly(weapon);
  139.     isweapondetonationtimed(weapon);
  140.     weaponclipsize(weapon);
  141.     weaponfuellife(weapon);
  142.     weaponissemiauto(weapon);
  143.     weaponisboltaction(weapon);
  144.     weaponisgasweapon(weapon);
  145.     weapontype(weapon);
  146.     weaponclass(weapon);
  147.     weaponmoutable(weapon);
  148.     weaponinventorytype(weapon);
  149.     weaponstartammo(weapon);
  150.     weaponmaxammo(weapon);
  151.     weaponaltweaponname(weapon);
  152.     weaponduelwieldweaponname(weapon);
  153.     weaponisduelwield(weapon);
  154.     getweaponmindamagerange(weapon);
  155.     getweaponmaxdamagerange(weapon);
  156.     getweaponmindamage(weapon);
  157.     getweaponmaxdamage(weapon);
  158.     getweaponfusetime(weapon);
  159.     getweaponexplosionradius(weapon);
  160.     getweaponprojexplosionsound(weapon);
  161.     isweaponspecificuse(weapon);
  162.     isweapondisallowedatmatchstart(weapon);
  163.     isweaponscopeoverlay(weapon);
  164.     isweaponequipment(weapon);
  165.     isweaponprimary(weapon);
  166.     getweaponfiresound(weapon_index);
  167.     getweaponfiresoundplayer(weapon_index);
  168.     getweaponpickupsoundplayer(weapon_index);
  169.     getweaponpickupsound(weapon_index);
  170.     getweaponindexfromname(weapon);
  171.     getweapondisplayname(weapon);
  172.  
  173.    
  174.     Spawn Weapon Projectiles
  175.     <rocket_entity> = MagicBullet( <weaponBulletToSpawn>, <startOrigin>, <endOrigin>, <owner> );
  176.     If a rocket is returned, its owner can be determined by
  177.     getmissileowner(<rocket_entity>);
  178.    
  179.    
  180.     Location Selection
  181.    
  182.     These all take either 1 or 2 arguments. Only 2 selector_textures are ever used, map_mortar_selector and compass_objpoint_helicopter.
  183.     Code (Text):
  184.     <client> beginLocationSelection( <selector_texture>, <optional_selector_radius> );
  185.     <client> beginLocationAirstrikeSelection( <selector_texture>, <optional_selector_radius> );
  186.     <client> beginLocationMortarSelection( <selector_texture>, <optional_selector_radius> );
  187.     <client> beginLocationArtillerySelection( <selector_texture>, <optional_selector_radius> );
  188.     <client> beginLocationComlinkSelection( <selector_texture>, <optional_selector_radius> );
  189.     <client> beginLocationNapalmSelection( <selector_texture>, <optional_selector_radius> );
  190.     After running any of these, then run the following.
  191.     <client>.selectingLocation = 1;
  192.     <client> waittill( "confirm_location", location );
  193.     Now the code will pause execution and wait for the player to select a location. Once this is done, the variable "location" contains the XYZ offset of the selection. Do what you want with it, but first to clear the location selector from the screen perform the following:
  194.     <client> endLocationSelection();
  195.     <client>.selectingLocation = undefined;
  196.    
  197.    
  198.     Random Numbers
  199.    
  200.     randomint(max);
  201.     randomfloat(max);
  202.     randomintrange(min,max);
  203.     randomfloatrange(min,max);
  204.    
  205.     Type Identifiers
  206.    
  207.     isstring(obj);
  208.     isint(obj);
  209.     isfloat(obj);
  210.     isvec(obj);
  211.     isarray(obj);
  212.     isalive(obj);
  213.     isspawner(obj);
  214.     isplayer(obj);
  215.     isai(obj);
  216.     issentient(obj);
  217.     isvehicle(obj);
  218.    
  219.     String Operations
  220.    
  221.     issubstr(originalString, subStrToFind);
  222.     getSubStr(string, startOffset, ...);
  223.     toLower(string);
  224.     toUpper(string);
  225.     strtok(string, token); //Splits a string into an array at the token points
  226.  
  227.     System Detection
  228.  
  229.     is_ps3();
  230.     is_xenon();
  231.     is_pc();
  232.     is_wiiu();
  233.    
  234.    
  235.     Session Info
  236.  
  237.     sessionmodeisonlinegame();
  238.     sessionmodeisprivateonlinegame();
  239.     sessionmodeisprivate();
  240.     sessionmodeissystemlink();
  241.     sessionmodeiszombiesgame();
  242.     gamemodeismode(gamemode);
  243.     gamemodeisusingxp();
  244.     gamemodeisusingstats();
  245.     getgametypesetting(setting);
  246.     setgametypesetting(setting, value)
  247.     The gametype setting structure can be found here. You can either track down the structure in memory, or simply use the setting names with the gsc functions. uk6 is an unknown type of time. bit 0 is 15 seconds, bit 1 is 30 seconds. So the smallest time limit one can get down to is only 15 seconds.
  248.  
  249.    
  250.     Profile Settings
  251.  
  252.     self setclientprofilevar("var", value);
  253.     setlocalprofilevar("var", value);
  254.     setlocalprofilearrayvar("var", arrayIndex, value);
  255.     getlocalprofileint("var");
  256.     getlocalprofilearrayint("var", arrayIndex);
  257.     getlocalprofilefloat("var");
  258.     getlocalprofilestring("var");
  259.     The profile settings structure can be found here.
  260.  
  261.    
  262.     Math Functions
  263.  
  264.     sin(theta);
  265.     cos(theta);
  266.     tan(theta);
  267.     asin(theta);
  268.     acos(theta);
  269.     atan(theta);
  270.     int(value);// ToInt
  271.     float(value);// ToFloat
  272.     istring(value); //ToString
  273.     min(val1, val2);
  274.     max(val1, val2);
  275.     floor(value);//Round down
  276.     ceil(value); //Round up
  277.     sqrt(value);
  278.     pow(value, exp);
  279.     distance(start, end);
  280.     distance2D(start, end);
  281.     distanceSquared(start, end); //Comparing a^2 to b is much faster than a to sqrt(b)
  282.     distance2DSquared(start, end);
  283.     length(vector);
  284.     lengthSquared(vector);
  285.     closer(start, trueIfCloser, falseIfCloser);
  286.     vectordot(vec1, vec2);
  287.     vectorcross(vec1, vec2);
  288.     vectornormalize(vector);
  289.    
  290.    
  291.     Map Functions
  292.    
  293.     Change Map
  294.     map( <mapName>, <boolKeepCurrentSettings> );
  295.     Restart Map
  296.     map_restart( <boolKeepCurrentSettings> );
  297.     Map Exists Check
  298.     mapexists( <mapName> );
  299.    
  300.    
  301.     Write Text To Screen
  302.    
  303.     Print to obituary
  304.     self iprintln("Text");
  305.     Leave out the self part to print to all players
  306.  
  307.     Print to center screen
  308.  
  309.     self iprintlnbold("Text");
  310.     Leave out the self part to print to all players
  311.    
  312.     Typewriter Text
  313.    
  314.     self thread maps\mp\gametypes\_hud_message::hintMessage("Text", floatDuration);
  315.     Leave out the self part to print to all players
  316.  
  317.    
  318.     Client Functions
  319.  
  320.     self isthrowinggrenade();
  321.     self forcegrenadethrow();
  322.     self isfiring();
  323.     self ismeleeing();
  324.     self isswitchingweapons();
  325.     self isreloading();
  326.     self takeallweapons();
  327.     self getcurrentweapon();
  328.     self getcurrentweaponaltweapon();
  329.     self isweaponoverheating(<bool_heat>, <weapon_name>);//Both Optional Arguments
  330.     self setweaponoverheating(heatValue, overheatValue, <optional_weapon_name>);
  331.     self getcurrentoffhand();
  332.     self isusingoffhand();
  333.     self hasweapon("weapon_name");
  334.    
  335.    
  336.     Unlock Achievements
  337.    
  338.     Don't forget to thread this, it works on all clients too.
  339.    Code (Text):
  340.    unlockAllCheevos()
  341.    {
  342.       cheevoList = strtok("SP_COMPLETE_ANGOLA,SP_COMPLETE_MONSOON,SP_COMPLETE_AFGHANISTAN,SP_COMPLETE_NICARAGUA,SP_COMPLETE_PAKISTAN,SP_COMPLETE_KARMA,SP_COMPLETE_PANAMA,SP_COMPLETE_YEMEN,SP_COMPLETE_BLACKOUT,SP_COMPLETE_LA,SP_COMPLETE_HAITI,SP_VETERAN_PAST,SP_VETERAN_FUTURE,SP_ONE_CHALLENGE,SP_ALL_CHALLENGES_IN_LEVEL,SP_ALL_CHALLENGES_IN_GAME,SP_RTS_DOCKSIDE,SP_RTS_AFGHANISTAN,SP_RTS_DRONE,SP_RTS_CARRIER,SP_RTS_PAKISTAN,SP_RTS_SOCOTRA,SP_STORY_MASON_LIVES,SP_STORY_HARPER_FACE,SP_STORY_FARID_DUEL,SP_STORY_OBAMA_SURVIVES,SP_STORY_LINK_CIA,SP_STORY_HAR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FROM_BELOW,ZM_DLC3_IM_YOUR_HUCKLEBERRY,ZM_DLC3_ECTOPLASMIC_RESIDUE,ZM_DLC3_BURIED_SIDEQUEST", ",");
  343.       foreach(cheevo in cheevoList) {
  344.         self giveachievement(cheevo);
  345.         wait 0.25;
  346.       }
  347.    }
  348.    
  349.    
  350.    Multi-Jump
  351.    
  352.    Thread onPlayerMultiJump. Change self.numOfMultijumps to allow for triple, quadruple, etc.
  353.    Code (Text):
  354.    landsOnGround()
  355.    {
  356.       self endon( "disconnect" );
  357.       loopResult = true;
  358.       for(;;)
  359.       {
  360.         wait 0.05;
  361.         newResult = self isOnGround();
  362.         if(newResult != loopResult)
  363.         {
  364.           if(!loopResult && newResult)
  365.             self notify( "landedOnGround" );
  366.           loopResult = newResult;
  367.         }
  368.       }
  369.    }
  370.  
  371.    onPlayerMultijump()
  372.    {
  373.       self endon( "disconnect" );
  374.       self thread landsOnGround();
  375.  
  376.       if(!isDefined(self.numOfMultijumps))
  377.         self.numOfMultijumps = 2;
  378.  
  379.       for(;;)
  380.       {
  381.         currentNum = 0;
  382.  
  383.         while(!self jumpbuttonpressed()) wait 0.05;
  384.         while(self jumpbuttonpressed()) wait 0.05;
  385.  
  386.         if(getDvarInt("jump_height") > 250)
  387.           continue;
  388.  
  389.         if ( !isAlive( self ) )
  390.         {
  391.           self waittill("spawned_player");
  392.           continue;
  393.         }
  394.  
  395.         if ( !self isOnGround() )
  396.         {
  397.           while( !self isOnGround() && isAlive( self ) && currentNum < self.numOfMultijumps)
  398.           {
  399.             waittillResult = self waittill_any_timeout( 0.11, "landedOnGround", "disconnect", "death" );
  400.             while(waittillResult == "timeout")
  401.             {
  402.               if(self jumpbuttonpressed())
  403.               {
  404.                 waittillResult = "jump";
  405.                 break;
  406.               }
  407.  
  408.               waittillResult = self waittill_any_timeout( 0.05, "landedOnGround", "disconnect", "death" );
  409.             }
  410.  
  411.             if(waittillResult == "jump" && !self isOnGround() && isAlive( self ))
  412.             {
  413.               playerAngles = self getplayerangles();
  414.               playerVelocity = self getVelocity();
  415.               self setvelocity( (playerVelocity[0], playerVelocity[1], playerVelocity[2]/2 ) + anglestoforward( (270, playerAngles[1], playerAngles[2]) ) * getDvarInt( "jump_height" ) * ( ( (-1/39) * getDvarInt( "jump_height" ) ) + (17/2) ) );
  416.  
  417.               currentNum++;
  418.               while(self jumpbuttonpressed()) wait 0.05;
  419.             }
  420.             else
  421.               break;
  422.           }
  423.  
  424.           while(!self isOnGround())
  425.             wait 0.05;
  426.         }
  427.       }
  428.    }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement