CSHARP 200
Dm.gsc Guest on 18th April 2021 07:33:35 PM
  1. #include maps\mp\_utility;
  2. #include maps\mp\gametypes\_hud_util;
  3. /*
  4.     Deathmatch
  5.     Objective:  Score points by eliminating other players
  6.     Map ends:   When one player reaches the score limit, or time limit is reached
  7.     Respawning: No wait / Away from other players
  8.  
  9.     Level requirements
  10.     ------------------
  11.         Spawnpoints:
  12.             classname       mp_dm_spawn
  13.             All players spawn from these. The spawnpoint chosen is dependent on the current locations of enemies at the time of spawn.
  14.             Players generally spawn away from enemies.
  15.  
  16.         Spectator Spawnpoints:
  17.             classname       mp_global_intermission
  18.             Spectators spawn from these and intermission is viewed from these positions.
  19.             Atleast one is required, any more and they are randomly chosen between.
  20.  
  21.     Level script requirements
  22.     -------------------------
  23.         Team Definitions:
  24.             game["allies"] = "marines";
  25.             game["axis"] = "opfor";
  26.             Because Deathmatch doesn't have teams with regard to gameplay or scoring, this effectively sets the available weapons.
  27.  
  28.         If using minefields or exploders:
  29.             maps\mp\_load::main();
  30.  
  31.     Optional level script settings
  32.     ------------------------------
  33.         Soldier Type and Variation:
  34.             game["american_soldiertype"] = "normandy";
  35.             game["german_soldiertype"] = "normandy";
  36.             This sets what character models are used for each nationality on a particular map.
  37.  
  38.             Valid settings:
  39.                 american_soldiertype    normandy
  40.                 british_soldiertype     normandy, africa
  41.                 russian_soldiertype     coats, padded
  42.                 german_soldiertype      normandy, africa, winterlight, winterdark
  43. */
  44.  
  45. /*QUAKED mp_dm_spawn (1.0 0.5 0.0) (-16 -16 0) (16 16 72)
  46. Players spawn away from enemies at one of these positions.*/
  47.  
  48. main()
  49. {
  50.     maps\mp\gametypes\_globallogic::init();
  51.     maps\mp\gametypes\_callbacksetup::SetupCallbacks();
  52.     maps\mp\gametypes\_globallogic::SetupCallbacks();
  53.     if(level.ex_blackscreen) maps\mp\gametypes\_blackscreen::init();
  54.  
  55.     maps\mp\gametypes\_globallogic::registerTimeLimitDvar( level.gameType, 10, 0, 1440 );
  56.     maps\mp\gametypes\_globallogic::registerScoreLimitDvar( level.gameType, 1000, 0, 5000 );
  57.     maps\mp\gametypes\_globallogic::registerRoundLimitDvar( level.gameType, 1, 0, 10 );
  58.     maps\mp\gametypes\_globallogic::registerNumLivesDvar( level.gameType, 0, 0, 10 );
  59.  
  60.     level.onStartGameType = ::onStartGameType;
  61.     level.onSpawnPlayer = ::onSpawnPlayer;
  62.  
  63.     game["dialog"]["gametype"] = "freeforall";
  64. }
  65.  
  66.  
  67. onStartGameType()
  68. {
  69.     setClientNameMode("auto_change");
  70.  
  71.     maps\mp\gametypes\_globallogic::setObjectiveText( "allies", &"OBJECTIVES_DM" );
  72.     maps\mp\gametypes\_globallogic::setObjectiveText( "axis", &"OBJECTIVES_DM" );
  73.  
  74.     if ( level.splitscreen )
  75.     {
  76.         maps\mp\gametypes\_globallogic::setObjectiveScoreText( "allies", &"OBJECTIVES_DM" );
  77.         maps\mp\gametypes\_globallogic::setObjectiveScoreText( "axis", &"OBJECTIVES_DM" );
  78.     }
  79.     else
  80.     {
  81.         maps\mp\gametypes\_globallogic::setObjectiveScoreText( "allies", &"OBJECTIVES_DM_SCORE" );
  82.         maps\mp\gametypes\_globallogic::setObjectiveScoreText( "axis", &"OBJECTIVES_DM_SCORE" );
  83.     }
  84.     maps\mp\gametypes\_globallogic::setObjectiveHintText( "allies", &"OBJECTIVES_DM_HINT" );
  85.     maps\mp\gametypes\_globallogic::setObjectiveHintText( "axis", &"OBJECTIVES_DM_HINT" );
  86.  
  87.     level.spawnMins = ( 0, 0, 0 );
  88.     level.spawnMaxs = ( 0, 0, 0 );
  89.     maps\mp\gametypes\_spawnlogic::addSpawnPoints( "allies", "mp_dm_spawn" );
  90.     maps\mp\gametypes\_spawnlogic::addSpawnPoints( "axis", "mp_dm_spawn" );
  91.     level.mapCenter = maps\mp\gametypes\_spawnlogic::findBoxCenter( level.spawnMins, level.spawnMaxs );
  92.     setMapCenter( level.mapCenter );
  93.    
  94.     allowed[0] = "dm";
  95.     maps\mp\gametypes\_gameobjects::main(allowed);
  96.  
  97.     maps\mp\gametypes\_rank::registerScoreInfo( "kill", 5 );
  98.     maps\mp\gametypes\_rank::registerScoreInfo( "headshot", 5 );
  99.     maps\mp\gametypes\_rank::registerScoreInfo( "assist", 1 );
  100.     maps\mp\gametypes\_rank::registerScoreInfo( "suicide", 0 );
  101.     maps\mp\gametypes\_rank::registerScoreInfo( "teamkill", 0 );
  102.    
  103.     level.displayRoundEndText = false;
  104.     level.QuickMessageToAll = true;
  105.  
  106.     // elimination style
  107.     if ( level.roundLimit != 1 && level.numLives )
  108.     {
  109.         level.overridePlayerScore = true;
  110.         level.displayRoundEndText = true;
  111.         level.onEndGame = ::onEndGame;
  112.     }
  113. }
  114.  
  115.  
  116. onSpawnPlayer()
  117. {
  118.     spawnPoints = maps\mp\gametypes\_spawnlogic::getTeamSpawnPoints( self.pers["team"] );
  119.     spawnPoint = maps\mp\gametypes\_spawnlogic::getSpawnpoint_DM( spawnPoints );
  120.  
  121.     self spawn( spawnPoint.origin, spawnPoint.angles );
  122. }
  123.  
  124.  
  125. onEndGame( winningPlayer )
  126. {
  127.     if ( isDefined( winningPlayer ) )
  128.         [[level._setPlayerScore]]( winningPlayer, winningPlayer [[level._getPlayerScore]]() + 1 ); 
  129. }

Paste-bin is for source code and general debugging text.

Login or Register to edit, delete and keep track of your pastes and more.

Raw Paste

Login or Register to edit or fork this paste. It's free.