Advertisement
Guest User

Untitled

a guest
Aug 21st, 2014
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.71 KB | None | 0 0
  1. void CBasePlayer::CheatImpulseCommands( int iImpulse )
  2. {
  3. #if !defined( HLDEMO_BUILD )
  4. if ( !sv_cheats->GetBool() )
  5. {
  6. return;
  7. }
  8.  
  9. CBaseEntity *pEntity;
  10. trace_t tr;
  11.  
  12. switch ( iImpulse )
  13. {
  14. case 76:
  15. {
  16. if (!giPrecacheGrunt)
  17. {
  18. giPrecacheGrunt = 1;
  19. Msg( "You must now restart to use Grunt-o-matic.\n");
  20. }
  21. else
  22. {
  23. Vector forward = UTIL_YawToVector( EyeAngles().y );
  24. Create("NPC_human_grunt", GetLocalOrigin() + forward * 128, GetLocalAngles());
  25. }
  26. break;
  27. }
  28.  
  29. case 81:
  30.  
  31. GiveNamedItem( "weapon_cubemap" );
  32. break;
  33.  
  34. case 82:
  35. // Cheat to create a jeep in front of the player
  36. CreateJeep( this );
  37. break;
  38.  
  39. case 83:
  40. // Cheat to create a airboat in front of the player
  41. CreateAirboat( this );
  42. break;
  43.  
  44. case 101:
  45. gEvilImpulse101 = true;
  46.  
  47. EquipSuit();
  48.  
  49. // Give the player everything!
  50. GiveAmmo( 255, "Pistol");
  51. GiveAmmo( 255, "AR2");
  52. GiveAmmo( 5, "AR2AltFire");
  53. GiveAmmo( 255, "SMG1");
  54. GiveAmmo( 255, "Buckshot");
  55. GiveAmmo( 3, "smg1_grenade");
  56. GiveAmmo( 3, "rpg_round");
  57. GiveAmmo( 5, "grenade");
  58. GiveAmmo( 32, "357" );
  59. GiveAmmo( 16, "XBowBolt" );
  60. #ifdef HL2_EPISODIC
  61. GiveAmmo( 5, "Hopwire" );
  62. #endif
  63. GiveNamedItem( "weapon_smg1" );
  64. GiveNamedItem( "weapon_frag" );
  65. GiveNamedItem( "weapon_crowbar" );
  66. GiveNamedItem( "weapon_pistol" );
  67. GiveNamedItem( "weapon_ar2" );
  68. GiveNamedItem( "weapon_shotgun" );
  69. GiveNamedItem( "weapon_physcannon" );
  70. GiveNamedItem( "weapon_bugbait" );
  71. GiveNamedItem( "weapon_rpg" );
  72. GiveNamedItem( "weapon_357" );
  73. GiveNamedItem( "weapon_crossbow" );
  74. #ifdef HL2_EPISODIC
  75. // GiveNamedItem( "weapon_magnade" );
  76. #endif
  77. if ( GetHealth() < 100 )
  78. {
  79. TakeHealth( 25, DMG_GENERIC );
  80. }
  81.  
  82. gEvilImpulse101 = false;
  83.  
  84. break;
  85.  
  86. case 102:
  87. // Gibbage!!!
  88. CGib::SpawnRandomGibs( this, 1, GIB_HUMAN );
  89. break;
  90.  
  91. case 103:
  92. // What the hell are you doing?
  93. pEntity = FindEntityForward( this, true );
  94. if ( pEntity )
  95. {
  96. CAI_BaseNPC *pNPC = pEntity->MyNPCPointer();
  97. if ( pNPC )
  98. pNPC->ReportAIState();
  99. }
  100. break;
  101.  
  102. case 106:
  103. // Give me the classname and targetname of this entity.
  104. pEntity = FindEntityForward( this, true );
  105. if ( pEntity )
  106. {
  107. Msg( "Classname: %s", pEntity->GetClassname() );
  108.  
  109. if ( pEntity->GetEntityName() != NULL_STRING )
  110. {
  111. Msg( " - Name: %s\n", STRING( pEntity->GetEntityName() ) );
  112. }
  113. else
  114. {
  115. Msg( " - Name: No Targetname\n" );
  116. }
  117.  
  118. if ( pEntity->m_iParent != NULL_STRING )
  119. Msg( "Parent: %s\n", STRING(pEntity->m_iParent) );
  120.  
  121. Msg( "Model: %s\n", STRING( pEntity->GetModelName() ) );
  122. if ( pEntity->m_iGlobalname != NULL_STRING )
  123. Msg( "Globalname: %s\n", STRING(pEntity->m_iGlobalname) );
  124. }
  125. break;
  126.  
  127. case 107:
  128. {
  129. trace_t tr;
  130.  
  131. edict_t *pWorld = engine->PEntityOfEntIndex( 0 );
  132.  
  133. Vector start = EyePosition();
  134. Vector forward;
  135. EyeVectors( &forward );
  136. Vector end = start + forward * 1024;
  137. UTIL_TraceLine( start, end, MASK_SOLID_BRUSHONLY, this, COLLISION_GROUP_NONE, &tr );
  138. if ( tr.m_pEnt )
  139. pWorld = tr.m_pEnt->edict();
  140.  
  141. const char *pTextureName = tr.surface.name;
  142.  
  143. if ( pTextureName )
  144. Msg( "Texture: %s\n", pTextureName );
  145. }
  146. break;
  147.  
  148. //
  149. // Sets the debug NPC to be the NPC under the crosshair.
  150. //
  151. case 108:
  152. {
  153. pEntity = FindEntityForward( this, true );
  154. if ( pEntity )
  155. {
  156. CAI_BaseNPC *pNPC = pEntity->MyNPCPointer();
  157. if ( pNPC != NULL )
  158. {
  159. Msg( "Debugging %s (0x%x)\n", pNPC->GetClassname(), pNPC );
  160. CAI_BaseNPC::SetDebugNPC( pNPC );
  161. }
  162. }
  163. break;
  164. }
  165.  
  166. case 195:// show shortest paths for entire level to nearest node
  167. {
  168. Create("node_viewer_fly", GetLocalOrigin(), GetLocalAngles());
  169. }
  170. break;
  171. case 196:// show shortest paths for entire level to nearest node
  172. {
  173. Create("node_viewer_large", GetLocalOrigin(), GetLocalAngles());
  174. }
  175. break;
  176. case 197:// show shortest paths for entire level to nearest node
  177. {
  178. Create("node_viewer_human", GetLocalOrigin(), GetLocalAngles());
  179. }
  180. break;
  181. case 202:// Random blood splatter
  182. {
  183. Vector forward;
  184. EyeVectors( &forward );
  185. UTIL_TraceLine ( EyePosition(),
  186. EyePosition() + forward * 128,
  187. MASK_SOLID_BRUSHONLY, this, COLLISION_GROUP_NONE, & tr);
  188.  
  189. if ( tr.fraction != 1.0 )
  190. {// line hit something, so paint a decal
  191. CBloodSplat *pBlood = CREATE_UNSAVED_ENTITY( CBloodSplat, "bloodsplat" );
  192. pBlood->Spawn( this );
  193. }
  194. }
  195. break;
  196. case 203:// remove creature.
  197. pEntity = FindEntityForward( this, true );
  198. if ( pEntity )
  199. {
  200. UTIL_Remove( pEntity );
  201. // if ( pEntity->m_takedamage )
  202. // pEntity->SetThink(SUB_Remove);
  203. }
  204. break;
  205. }
  206. #endif // HLDEMO_BUILD
  207. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement