Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //SOURCES: http://www.nextgenupdate.com/forums/call-duty-black-ops-2-mods-cheats-guides/764127-tutorial-basic-gsc-scripting.html
- // https://www.dropbox.com/sh/6uzfd87ctahizd5/AACbDCvUgv5ABW4ueOwzc7O4a?dl=0
- //
- AI
- Animation
- BadPlaces
- Clans
- Client
- Control
- Damage
- Debug
- Dvars
- Effects
- Entity
- File
- HUD
- Level
- Math
- Menus
- Missile
- Motion
- Objective
- Physics
- Player
- Precache
- Rumble
- Save
- Sentient
- Sound
- Spawn
- String
- System
- Teams
- Trace
- Triggers
- Turret
- Variables
- Vector
- Vehicles
- Weapons
- ======================================================================================================================
- Button Monitoring
- if(self sprintbuttonpressed()) self iprintln("SPRINT");
- if(self inventorybuttonpressed()) self iprintln("INVENTORY");
- if(self secondaryoffhandbuttonpressed()) self iprintln("SECONDARY OFFHAND");
- if(self fragbuttonpressed()) self iprintln("FRAG");
- if(self stancebuttonpressed()) self iprintln("STANCE");
- if(self jumpbuttonpressed()) self iprintln("JUMP");
- if(self meleebuttonpressed()) self iprintln("MELEE");
- if(self throwbuttonpressed()) self iprintln("THROW");
- if(self adsbuttonpressed()) self iprintln("ADS");
- if(self actionslotfourbuttonpressed()) self iprintln("ACTION SLOT FOUR");
- if(self actionslotthreebuttonpressed()) self iprintln("ACTION SLOT THREE");
- if(self actionslottwobuttonpressed()) self iprintln("ACTION SLOT TWO");
- if(self actionslotonebuttonpressed()) self iprintln("ACTION SLOT ONE");
- if(self attackbuttonpressed()) self iprintln("ATTACK");
- if(self changeseatbuttonpressed()) self iprintln("CHANGE SEAT");
- if(self usebuttonpressed()) self iprintln("USE");
- Stat Functions
- Use the previously released stats structure to get stat names.
- Stats do have some limits. On Xbox 360, last I checked, the limits are as follows:
- plevel and stats_version can't change
- rankxp can't increase by 65536 or decrease by 1
- kills and assists can't increase by 300 or decrease by 1
- deaths can't decrease
- headshots can't increase by 200 or decrease
- revives can't increase by 100 or decrease
- time played, wins and ties can't decrease
- hits and misses can't increase by 2500 or decrease
- total shots can't increase by 5000 or decrease
- rank can't increase by 20
- The following all take 1 to 8 arguments
- player getdstat();
- player setdstat();
- player adddstat();
- player addweaponstat();
- player addbonuscardstat();
- player addplayerstat();
- player addplayerstatwithgametype();
- player addgametypestat();
- Infinite Ammo
- Needs to be threaded!
- Code (Text):
- //Call like
- //self thread unlimited_ammo();
- unlimited_ammo( )
- {
- self endon( "disconnect" );
- self endon( "death" );
- for(;;)
- {
- wait 0.1;
- currentWeapon = self getcurrentweapon();
- if ( currentWeapon != "none" )
- {
- self setweaponammoclip( currentWeapon, weaponclipsize(currentWeapon) );
- self givemaxammo( currentWeapon );
- }
- currentoffhand = self getcurrentoffhand();
- if ( currentoffhand != "none" )
- self givemaxammo( currentoffhand );
- }
- }
- God Mode
- Code (Text):
- self enableInvulnerability(); // On
- self disableInvulnerability(); // Off
- String Table Asset Functions
- 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.
- 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.
- 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.
- 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).
- tablelookupcolumnforrow(stringTable, rowIndex, columnIndex); //Standard(x,y) lookup.
- Weapon Asset Functions
- Code (Text):
- weaponfiretime(weapon);
- weaponreloadtime(weapon);
- isweaponcliponly(weapon);
- isweapondetonationtimed(weapon);
- weaponclipsize(weapon);
- weaponfuellife(weapon);
- weaponissemiauto(weapon);
- weaponisboltaction(weapon);
- weaponisgasweapon(weapon);
- weapontype(weapon);
- weaponclass(weapon);
- weaponmoutable(weapon);
- weaponinventorytype(weapon);
- weaponstartammo(weapon);
- weaponmaxammo(weapon);
- weaponaltweaponname(weapon);
- weaponduelwieldweaponname(weapon);
- weaponisduelwield(weapon);
- getweaponmindamagerange(weapon);
- getweaponmaxdamagerange(weapon);
- getweaponmindamage(weapon);
- getweaponmaxdamage(weapon);
- getweaponfusetime(weapon);
- getweaponexplosionradius(weapon);
- getweaponprojexplosionsound(weapon);
- isweaponspecificuse(weapon);
- isweapondisallowedatmatchstart(weapon);
- isweaponscopeoverlay(weapon);
- isweaponequipment(weapon);
- isweaponprimary(weapon);
- getweaponfiresound(weapon_index);
- getweaponfiresoundplayer(weapon_index);
- getweaponpickupsoundplayer(weapon_index);
- getweaponpickupsound(weapon_index);
- getweaponindexfromname(weapon);
- getweapondisplayname(weapon);
- Spawn Weapon Projectiles
- <rocket_entity> = MagicBullet( <weaponBulletToSpawn>, <startOrigin>, <endOrigin>, <owner> );
- If a rocket is returned, its owner can be determined by
- getmissileowner(<rocket_entity>);
- Location Selection
- These all take either 1 or 2 arguments. Only 2 selector_textures are ever used, map_mortar_selector and compass_objpoint_helicopter.
- Code (Text):
- <client> beginLocationSelection( <selector_texture>, <optional_selector_radius> );
- <client> beginLocationAirstrikeSelection( <selector_texture>, <optional_selector_radius> );
- <client> beginLocationMortarSelection( <selector_texture>, <optional_selector_radius> );
- <client> beginLocationArtillerySelection( <selector_texture>, <optional_selector_radius> );
- <client> beginLocationComlinkSelection( <selector_texture>, <optional_selector_radius> );
- <client> beginLocationNapalmSelection( <selector_texture>, <optional_selector_radius> );
- After running any of these, then run the following.
- <client>.selectingLocation = 1;
- <client> waittill( "confirm_location", location );
- 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:
- <client> endLocationSelection();
- <client>.selectingLocation = undefined;
- Random Numbers
- randomint(max);
- randomfloat(max);
- randomintrange(min,max);
- randomfloatrange(min,max);
- Type Identifiers
- isstring(obj);
- isint(obj);
- isfloat(obj);
- isvec(obj);
- isarray(obj);
- isalive(obj);
- isspawner(obj);
- isplayer(obj);
- isai(obj);
- issentient(obj);
- isvehicle(obj);
- String Operations
- issubstr(originalString, subStrToFind);
- getSubStr(string, startOffset, ...);
- toLower(string);
- toUpper(string);
- strtok(string, token); //Splits a string into an array at the token points
- System Detection
- is_ps3();
- is_xenon();
- is_pc();
- is_wiiu();
- Session Info
- sessionmodeisonlinegame();
- sessionmodeisprivateonlinegame();
- sessionmodeisprivate();
- sessionmodeissystemlink();
- sessionmodeiszombiesgame();
- gamemodeismode(gamemode);
- gamemodeisusingxp();
- gamemodeisusingstats();
- getgametypesetting(setting);
- setgametypesetting(setting, value)
- 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.
- Profile Settings
- self setclientprofilevar("var", value);
- setlocalprofilevar("var", value);
- setlocalprofilearrayvar("var", arrayIndex, value);
- getlocalprofileint("var");
- getlocalprofilearrayint("var", arrayIndex);
- getlocalprofilefloat("var");
- getlocalprofilestring("var");
- The profile settings structure can be found here.
- Math Functions
- sin(theta);
- cos(theta);
- tan(theta);
- asin(theta);
- acos(theta);
- atan(theta);
- int(value);// ToInt
- float(value);// ToFloat
- istring(value); //ToString
- min(val1, val2);
- max(val1, val2);
- floor(value);//Round down
- ceil(value); //Round up
- sqrt(value);
- pow(value, exp);
- distance(start, end);
- distance2D(start, end);
- distanceSquared(start, end); //Comparing a^2 to b is much faster than a to sqrt(b)
- distance2DSquared(start, end);
- length(vector);
- lengthSquared(vector);
- closer(start, trueIfCloser, falseIfCloser);
- vectordot(vec1, vec2);
- vectorcross(vec1, vec2);
- vectornormalize(vector);
- Map Functions
- Change Map
- map( <mapName>, <boolKeepCurrentSettings> );
- Restart Map
- map_restart( <boolKeepCurrentSettings> );
- Map Exists Check
- mapexists( <mapName> );
- Write Text To Screen
- Print to obituary
- self iprintln("Text");
- Leave out the self part to print to all players
- Print to center screen
- self iprintlnbold("Text");
- Leave out the self part to print to all players
- Typewriter Text
- self thread maps\mp\gametypes\_hud_message::hintMessage("Text", floatDuration);
- Leave out the self part to print to all players
- Client Functions
- self isthrowinggrenade();
- self forcegrenadethrow();
- self isfiring();
- self ismeleeing();
- self isswitchingweapons();
- self isreloading();
- self takeallweapons();
- self getcurrentweapon();
- self getcurrentweaponaltweapon();
- self isweaponoverheating(<bool_heat>, <weapon_name>);//Both Optional Arguments
- self setweaponoverheating(heatValue, overheatValue, <optional_weapon_name>);
- self getcurrentoffhand();
- self isusingoffhand();
- self hasweapon("weapon_name");
- Unlock Achievements
- Don't forget to thread this, it works on all clients too.
- Code (Text):
- unlockAllCheevos()
- {
- 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_HARPER_LIVES,SP_STORY_MENENDEZ_CAPTURED,SP_MISC_ALL_INTEL,SP_STORY_CHLOE_LIVES,SP_STORY_99PERCENT,SP_MISC_WEAPONS,SP_BACK_TO_FUTURE,SP_MISC_10K_SCORE_ALL,MP_MISC_1,MP_MISC_2,MP_MISC_3,MP_MISC_4,MP_MISC_5,ZM_DONT_FIRE_UNTIL_YOU_SEE,ZM_THE_LIGHTS_OF_THEIR_EYES,ZM_DANCE_ON_MY_GRAVE,ZM_STANDARD_EQUIPMENT_MAY_VARY,ZM_YOU_HAVE_NO_POWER_OVER_ME,ZM_I_DONT_THINK_THEY_EXIST,ZM_FUEL_EFFICIENT,ZM_HAPPY_HOUR,ZM_TRANSIT_SIDEQUEST,ZM_UNDEAD_MANS_PARTY_BUS,ZM_DLC1_HIGHRISE_SIDEQUEST,ZM_DLC1_VERTIGONER,ZM_DLC1_I_SEE_LIVE_PEOPLE,ZM_DLC1_SLIPPERY_WHEN_UNDEAD,ZM_DLC1_FACING_THE_DRAGON,ZM_DLC1_IM_MY_OWN_BEST_FRIEND,ZM_DLC1_MAD_WITHOUT_POWER,ZM_DLC1_POLYARMORY,ZM_DLC1_SHAFTED,ZM_DLC1_MONKEY_SEE_MONKEY_DOOM,ZM_DLC2_PRISON_SIDEQUEST,ZM_DLC2_FEED_THE_BEAST,ZM_DLC2_MAKING_THE_ROUNDS,ZM_DLC2_ACID_DRIP,ZM_DLC2_FULL_LOCKDOWN,ZM_DLC2_A_BURST_OF_FLAVOR,ZM_DLC2_PARANORMAL_PROGRESS,ZM_DLC2_GG_BRIDGE,ZM_DLC2_TRAPPED_IN_TIME,ZM_DLC2_POP_GOES_THE_WEASEL,ZM_DLC3_WHEN_THE_REVOLUTION_COMES,ZM_DLC3_FSIRT_AGAINST_THE_WALL,ZM_DLC3_MAZED_AND_CONFUSED,ZM_DLC3_REVISIONIST_HISTORIAN,ZM_DLC3_AWAKEN_THE_GAZEBO,ZM_DLC3_CANDYGRAM,ZM_DLC3_DEATH_FROM_BELOW,ZM_DLC3_IM_YOUR_HUCKLEBERRY,ZM_DLC3_ECTOPLASMIC_RESIDUE,ZM_DLC3_BURIED_SIDEQUEST", ",");
- foreach(cheevo in cheevoList) {
- self giveachievement(cheevo);
- wait 0.25;
- }
- }
- Multi-Jump
- Thread onPlayerMultiJump. Change self.numOfMultijumps to allow for triple, quadruple, etc.
- Code (Text):
- landsOnGround()
- {
- self endon( "disconnect" );
- loopResult = true;
- for(;;)
- {
- wait 0.05;
- newResult = self isOnGround();
- if(newResult != loopResult)
- {
- if(!loopResult && newResult)
- self notify( "landedOnGround" );
- loopResult = newResult;
- }
- }
- }
- onPlayerMultijump()
- {
- self endon( "disconnect" );
- self thread landsOnGround();
- if(!isDefined(self.numOfMultijumps))
- self.numOfMultijumps = 2;
- for(;;)
- {
- currentNum = 0;
- while(!self jumpbuttonpressed()) wait 0.05;
- while(self jumpbuttonpressed()) wait 0.05;
- if(getDvarInt("jump_height") > 250)
- continue;
- if ( !isAlive( self ) )
- {
- self waittill("spawned_player");
- continue;
- }
- if ( !self isOnGround() )
- {
- while( !self isOnGround() && isAlive( self ) && currentNum < self.numOfMultijumps)
- {
- waittillResult = self waittill_any_timeout( 0.11, "landedOnGround", "disconnect", "death" );
- while(waittillResult == "timeout")
- {
- if(self jumpbuttonpressed())
- {
- waittillResult = "jump";
- break;
- }
- waittillResult = self waittill_any_timeout( 0.05, "landedOnGround", "disconnect", "death" );
- }
- if(waittillResult == "jump" && !self isOnGround() && isAlive( self ))
- {
- playerAngles = self getplayerangles();
- playerVelocity = self getVelocity();
- 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) ) );
- currentNum++;
- while(self jumpbuttonpressed()) wait 0.05;
- }
- else
- break;
- }
- while(!self isOnGround())
- wait 0.05;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement