Advertisement
Guest User

Infected - Infinite Loop

a guest
Oct 24th, 2013
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.00 KB | None | 0 0
  1. /*************************************************************************************************************************************************************************************************************************************************************
  2. * Infected - Unreleased *
  3. * *
  4. * Overall Credits: *
  5. * Rendflex main coder. *
  6. * DidUknowiPwn/Intricate rewriting & updating. *
  7. * momo5502 for assistance. *
  8. * JoeyB for assistance. *
  9. * Puffiamo for C4/Claymore Pickup code. *
  10. * *
  11. * © 2013 DidUknowiPwn ™ *
  12. * Do not edit this mod without contacting us: Rendflex & Intricate. Our Steam are: Intricate & Rendflex. If you do, you will be in trouble. *
  13. *************************************************************************************************************************************************************************************************************************************************************/
  14.  
  15. #include maps\mp\_utility;
  16. #include maps\mp\gametypes\_hud_util;
  17. #include common_scripts\utility;
  18.  
  19. main()
  20. {
  21. maps\mp\gametypes\_globallogic::init();
  22. maps\mp\gametypes\_callbacksetup::SetupCallbacks();
  23. maps\mp\gametypes\_globallogic::SetupCallbacks();
  24.  
  25. registerRoundSwitchDvar( level.gameType, 0, 0, 9 );
  26. registerTimeLimitDvar( level.gameType, 10, 0, 1440 );
  27. registerScoreLimitDvar( level.gameType, 500, 0, 5000 );
  28. registerRoundLimitDvar( level.gameType, 1, 0, 10 );
  29. registerWinLimitDvar( level.gameType, 1, 0, 10 );
  30. registerRoundSwitchDvar( level.gameType, 3, 0, 30 );
  31. registerNumLivesDvar( level.gameType, 0, 0, 10 );
  32. registerHalfTimeDvar( level.gameType, 0, 0, 1 );
  33.  
  34. level.teamBased = true;
  35. level.doPrematch = true;
  36. level.onPrecacheGameType = ::onPrecacheGameType;
  37. level.onStartGameType = ::onStartGameType;
  38. level.onSpawnPlayer = ::onSpawnPlayer;
  39. level.getSpawnPoint = ::getSpawnPoint;
  40. level.onPlayerKilled = ::onPlayerKilled;
  41. level.onTimeLimit = ::onTimeLimit;
  42. }
  43.  
  44. onPrecacheGameType()
  45. {
  46. //Shaders
  47. PrecacheShader("specialty_marathon");
  48. PrecacheShader("specialty_fastreload");
  49. PrecacheShader("specialty_lightweight");
  50. PrecacheShader("specialty_scavenger");
  51. PrecacheShader("specialty_bulletdamage");
  52. PrecacheShader("specialty_coldblooded");
  53. PrecacheShader("specialty_dangerclose");
  54. PrecacheShader("specialty_commando");
  55. PrecacheShader("specialty_steadyaim");
  56. PrecacheShader("specialty_bulletaccuracy");
  57. PrecacheShader("specialty_detectexplosive");
  58. PrecacheShader("specialty_heartbreaker");
  59. PrecacheShader("specialty_localjammer");
  60. PrecacheShader("specialty_quieter");
  61. PrecacheShader("specialty_bombsquad");
  62. PrecacheShader("specialty_hardline");
  63. PrecacheShader("specialty_onemanarmy_upgrade");
  64. //Strings
  65. PrecacheString( &"PERKS_MARATHON" );
  66. PrecacheString( &"PERKS_SLEIGHT_OF_HAND" );
  67. PrecacheString( &"PERKS_SCAVENGER" );
  68. //--
  69. PrecacheString( &"PERKS_STOPPING_POWER" );
  70. PrecacheString( &"PERKS_LIGHTWEIGHT" );
  71. PrecacheString( &"PERKS_COLDBLOODED" );
  72. PrecacheString( &"PERKS_DANGERCLOSE" );
  73. //--
  74. PrecacheString( &"PERKS_EXTENDEDMELEE" );
  75. PrecacheString( &"PERKS_STEADY_AIM" );
  76. PrecacheString( &"PERKS_LOCALJAMMER" );
  77. PrecacheString( &"PERKS_NINJA" );
  78. }
  79.  
  80. onStartGameType()
  81. {
  82. setClientNameMode("auto_change");
  83.  
  84. setObjectiveText( "allies", "Watch your back." );
  85. setObjectiveText( "axis", "Infect the Surviviors!" );
  86.  
  87. if ( level.splitscreen )
  88. {
  89. setObjectiveScoreText( "allies", "Survive the Infected!" );
  90. setObjectiveScoreText( "axis", "Infect the Survivors!" );
  91. }
  92. else
  93. {
  94. setObjectiveScoreText( "allies", "Survive the Infected!" );
  95. setObjectiveScoreText( "axis", "Infect all Survivors to win!" );
  96. }
  97. setObjectiveHintText( "allies", "Watch your back." );
  98. setObjectiveHintText( "axis", "Infect the Survivors!" );
  99.  
  100. level.spawnMins = ( 0, 0, 0 );
  101. level.spawnMaxs = ( 0, 0, 0 );
  102. maps\mp\gametypes\_spawnlogic::addSpawnPoints( "allies", "mp_dm_spawn" );
  103. maps\mp\gametypes\_spawnlogic::addSpawnPoints( "axis", "mp_dm_spawn" );
  104. level.mapCenter = maps\mp\gametypes\_spawnlogic::findBoxCenter( level.spawnMins, level.spawnMaxs );
  105. setMapCenter( level.mapCenter );
  106.  
  107. allowed = [];
  108. maps\mp\gametypes\_gameobjects::main(allowed);
  109.  
  110. maps\mp\gametypes\_rank::registerScoreInfo( "final_rogue", 200 );
  111. maps\mp\gametypes\_rank::registerScoreInfo( "draft_rogue", 100 );
  112. maps\mp\gametypes\_rank::registerScoreInfo( "survivor", 100 );
  113.  
  114. SetDvars();
  115.  
  116. level.infect_timerDisplay = createServerTimer( "objective", 1.4 );
  117. level.infect_timerDisplay setPoint( "TOPLEFT", "TOPLEFT", 115, 5 );
  118. level.infect_timerDisplay.label = &"";
  119. level.infect_timerDisplay.alpha = 0;
  120. level.infect_timerDisplay.archived = false;
  121. level.infect_timerDisplay.hideWhenInMenu = true;
  122.  
  123. level.infect_choseFirstInfected = false;
  124. level.infect_choosingFirstInfected = false;
  125.  
  126. level thread onPlayerConnect();
  127. level thread SetupAlliesClass();
  128. }
  129.  
  130. getSpawnPoint()
  131. {
  132. if ( level.inGracePeriod )
  133. {
  134. spawnPoints = maps\mp\gametypes\_spawnlogic::getSpawnpointArray( "mp_dm_spawn" );
  135. spawnPoint = maps\mp\gametypes\_spawnlogic::getSpawnpoint_Random( spawnPoints );
  136. }
  137. else
  138. {
  139. spawnPoints = maps\mp\gametypes\_spawnlogic::getTeamSpawnPoints( self.pers["team"] );
  140. spawnPoint = maps\mp\gametypes\_spawnlogic::getSpawnpoint_NearTeam( spawnPoints );
  141. }
  142.  
  143. return spawnPoint;
  144. }
  145.  
  146. SetDvars()
  147. {
  148. SetDvar( "g_TeamName_Allies", "Survivors" );
  149. SetDvar( "g_TeamName_Axis", "Infected" );
  150. SetDvar( "ui_allow_teamchange", 0 );
  151. SetDvar("scr_game_hardpoints", 0);
  152. SetDvar("scr_teambalance", 0);
  153.  
  154. SetDvarIfUninitialized("moab", 1);
  155. SetDvarIfUninitialized("scr_infected_pick_time", 15);
  156. SetDvarIfUninitialized("scr_infected_allow_inf_tk", 1);
  157. SetDvarIfUninitialized("scr_infected_allow_inf_tactical_insertion", 1);
  158. SetDvarIfUninitialized("scr_infected_allow_allies_equipment", 1);
  159. SetDvarIfUninitialized("scr_infected_allow_allies_starting_perks", 1);
  160. SetDvarIfUninitialized("scr_infected_allow_allies_specialist", 1);
  161. SetDvarIfUninitialized("scr_infected_allies_attachments", 1);
  162. }
  163.  
  164. onTimeLimit()
  165. {
  166. level.finalKillCam_winner = "allies";
  167. level thread maps\mp\gametypes\_gamelogic::endGame( "allies", game["strings"]["time_limit_reached"] );
  168. }
  169.  
  170. onPlayerConnect()
  171. {
  172. for(;;)
  173. {
  174. level waittill( "connected", player );
  175. player thread onPlayerDisconnect();
  176. player.hud_EventPopup = player createEventPopup();
  177. player thread DeleteOnEndGame();
  178. }
  179. }
  180.  
  181. onPlayerDisconnect()
  182. {
  183. level endon("game_ended");
  184. for(;;)
  185. {
  186. self waittill ( "disconnect" );
  187.  
  188. if ( isDefined( level.infect_isBeingChosen ) || level.infect_choseFirstInfected )
  189. {
  190. if ( getNumSurvivors() == 0 )
  191. {
  192. level thread inf_endGame( "axis", "Survivors eliminated." );
  193. }
  194. else if ( getNumInfected() == 0 )
  195. {
  196. level.infect_choseFirstInfected = false;
  197. level thread chooseFirstInfected();
  198. }
  199. }
  200.  
  201. updateTeamScores();
  202. }
  203. }
  204.  
  205. onSpawnPlayer()
  206. {
  207. if ( !level.infect_choosingFirstInfected && getNumSurvivors() > 1 )
  208. {
  209. level.infect_choosingFirstInfected = true;
  210. level thread chooseFirstInfected();
  211. iprintln("1");
  212. }
  213. //code broken somewhere in choosefirstinfected
  214. updateTeamScores();
  215.  
  216. if( self.team == "allies" )
  217. {
  218. self iprintln("set allies class");
  219. self thread SetSurvivorClass();
  220. self iprintln("14");
  221.  
  222. }
  223. else if( self.team == "axis" )
  224. {
  225. self iprintln("set axis class");
  226. self thread SetInfectedClass();
  227. self iprintln("15");
  228. }
  229. self iprintln("4");
  230. self iprintln( level.infc_primaryWep );
  231. self iprintln( level.infc_secondaryWep );
  232. }
  233.  
  234. onPlayerKilled( eInflictor, attacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc, psOffsetTime, deathAnimDuration, lifeId )
  235. {
  236. if ( isDefined( attacker ) && self.team == "allies" && level.infect_choseFirstInfected == true )
  237. {
  238. wait 0.1;
  239. iprintln("12");
  240. playSoundOnPlayers( "mp_enemy_obj_captured", "allies" );
  241. playSoundOnPlayers( "mp_war_objective_taken", "axis" );
  242.  
  243. self maps\mp\gametypes\_menus::addToTeam( "axis" );
  244. self thread EventPopup( "Infected!", (1,0,0), 1 );
  245. attacker thread EventPopup( "Infected!", (1,0,0), 1 );
  246.  
  247. numSurvivors = getNumSurvivors();
  248.  
  249. if( numSurvivors > 1 )
  250. {
  251. foreach ( player in level.players )
  252. {
  253. if ( player.team == "allies" )
  254. {
  255. player thread EventPopup( "Survivor!" );
  256. player iprintln("16");
  257. }
  258. break;
  259. }
  260. }
  261.  
  262. if( numSurvivors == 1 )
  263. {
  264. foreach ( player in level.players )
  265. {
  266. if ( player.team == "allies" )
  267. {
  268. player thread EventPopup( "Last Alive!" );
  269. level thread teamPlayerCardSplash( "callout_lastteammemberalive", player, "allies" );
  270. level thread teamPlayerCardSplash( "callout_lastenemyalive", player, "axis" );
  271. player iprintln("17");
  272. }
  273. break;
  274. }
  275. }
  276.  
  277. else if( numSurvivors == 0 )
  278. {
  279. attacker.finalKill = true;
  280. level thread inf_endGame( "axis", "Survivors eliminated.");
  281. attacker iprintln("18");
  282. self iprintln("18");
  283. }
  284. updateTeamScores();
  285. }
  286.  
  287. if ( isDefined( attacker ) && attacker.team == "allies" && level.infect_choseFirstInfected == true && getDvarInt("scr_infected_allow_allies_specialist") == 1 )
  288. {
  289. if( attacker.pers["cur_kill_streak"] == 2 )
  290. {
  291. attacker.ksOneIcon.alpha = 1;
  292. attacker _SetPerk( level.infc_SpecialistPerk1 );
  293. attacker Specialist( getPerkString( level.infc_SpecialistPerk1 ), GetGoodColor(), getPerkMaterial( level.infc_SpecialistPerk1 ) );
  294. }
  295. else if( attacker.pers["cur_kill_streak"] == 4 )
  296. {
  297. attacker.ksTwoIcon.alpha = 1;
  298. attacker _SetPerk( level.infc_SpecialistPerk2 );
  299. attacker Specialist( getPerkString( level.infc_SpecialistPerk2 ), GetGoodColor(), getPerkMaterial( level.infc_SpecialistPerk2 ) );
  300. }
  301. else if( attacker.pers["cur_kill_streak"] == 6 )
  302. {
  303. attacker.ksThrIcon.alpha = 1;
  304. attacker _SetPerk( level.infc_SpecialistPerk3 );
  305. attacker Specialist( getPerkString( level.infc_SpecialistPerk3 ), GetGoodColor(), getPerkMaterial( level.infc_SpecialistPerk3 ) );
  306. }
  307. else if( attacker.pers["cur_kill_streak"] == 8 )
  308. {
  309. attacker.ksForIcon.alpha = 1;
  310. attacker setAllPerks();
  311. attacker Specialist( "Specialist Bonus", GetGoodColor(), level.infc_Specialist );
  312. }
  313. else if( attacker.pers["cur_kill_streak"] == 24 && getDvarInt( "moab" ) == 1 )
  314. {
  315. attacker maps\mp\killstreaks\_killstreaks::giveKillstreak( "nuke", true );
  316. attacker thread maps\mp\gametypes\_hud_message::killstreakSplashNotify( "nuke", 24 );
  317. }
  318. }
  319. iprintln("13");
  320. }
  321.  
  322. Specialist( text, glowColor, shader )
  323. {
  324. self endon("disconnect");
  325.  
  326. self PlayLocalSound("mp_bonus_start");
  327.  
  328. self.DatText = createFontString( "hudsmall", "1" );
  329. self.DatText setPoint( "TOP", undefined, 0, 100 );
  330. self.DatIcon = createIcon( "white", 45, 45 );
  331. self.DatIcon setPoint( "TOP", undefined, 0, 105 );
  332. self.DatIcon.alpha = 0;
  333. self.DatText.glowColor = glowColor;
  334. self.DatText.glowAlpha = 0.2;
  335. self.DatText.hideWhenInMenu = false;
  336. self.DatText.archived = false;
  337. self.DatText.notifyText = text;
  338. self thread maps\mp\gametypes\_hud_message::notifyMessage( self.DatText );
  339.  
  340. self.DatIcon setShader( shader, 45, 45 );
  341. self.DatIcon.sort = 100;
  342.  
  343. self.DatText fadeOverTime( 0.75 );
  344. self.DatIcon fadeOverTime( 0.75 );
  345. self.DatIcon.alpha = 1;
  346. self.DatText.alpha = 1;
  347.  
  348. wait ( 1.0 );
  349.  
  350. self.DatText fadeOverTime( 6 );
  351. self.DatIcon fadeOverTime( 6 );
  352. self.DatText.alpha = 0;
  353. self.DatIcon.alpha = 0;
  354. }
  355.  
  356. SetTeam()
  357. {
  358. if( level.infect_choseFirstInfected == true && level.infect_isBeingChosen == false )
  359. {
  360. wait 0.01;
  361. self notify("menuresponse", game["menu_team"], "axis");
  362. wait 0.01;
  363. self notify("menuresponse", "changeclass", "class1");
  364. wait 0.01;
  365. iprintln("0");
  366. }
  367. else
  368. {
  369. wait 0.01;
  370. self notify("menuresponse", game["menu_team"], "allies");
  371. wait 0.01;
  372. self notify("menuresponse", "changeclass", "class1");
  373. wait 0.01;
  374. iprintln("0.5");
  375. }
  376. }
  377.  
  378. chooseFirstInfected()
  379. {
  380. level endon( "game_ended" );
  381.  
  382. gameFlagWait( "prematch_done" );
  383.  
  384. iprintln("9");
  385. level.infect_timerDisplay.label = &"Infection countdown: ";
  386. level.infect_timerDisplay setTimer( getDvarInt( "scr_infected_pick_time" ) );
  387. level.infect_timerDisplay.alpha = 1;
  388. level.infect_isBeingChosen = true;
  389. maps\mp\gametypes\_hostmigration::waitLongDurationWithHostMigrationPause( getDvarInt( "scr_infected_pick_time" ) );
  390. level.infect_timerDisplay.alpha = 0;
  391. iprintln("10");
  392. first = level.players[ randomInt( level.players.size ) ];
  393.  
  394. first endon( "disconnect" );
  395. while( !isAlive( first ) )
  396. wait( 0.05 );
  397. first maps\mp\gametypes\_menus::addToTeam( "axis" );
  398. first thread SetInfectedClass();
  399. first [[game["axis_model"]["SMG"]]]();
  400. level.infect_choseFirstInfected = true;
  401. level.infect_isBeingChosen = false;
  402. first.isInitialInfected = true;
  403.  
  404. updateTeamScores();
  405. playSoundOnPlayers( "mp_enemy_obj_captured", "allies" );
  406. playSoundOnPlayers( "mp_war_objective_taken", "axis" );
  407.  
  408. iprintln("11");
  409. }
  410.  
  411. SetupAlliesClass()
  412. {
  413.  
  414. level.infc_primaryWep = getRandomPrimary( randomInt(4) );
  415. level.infc_secondaryWep = getRandomSecondary( randomInt(6) );
  416.  
  417. if( getDvarInt( "scr_infected_allow_allies_starting_perks" ) == 1 )
  418. {
  419. level.infc_StartingPerk1 = getRandomPerk( 0 );
  420. level.infc_StartingPerk2 = getRandomPerk( 1 );
  421. level.infc_StartingPerk3 = getRandomPerk( 2 );
  422. }
  423.  
  424. if( getDvarInt( "scr_infected_allow_allies_specialist" ) == 1 )
  425. {
  426. level.infc_SpecialistPerk1 = getRandomPerk( 0 );
  427. level.infc_SpecialistPerk2 = getRandomPerk( 1 );
  428. level.infc_SpecialistPerk3 = getRandomPerk( 2 );
  429. level.infc_Specialist = "specialty_onemanarmy_upgrade";
  430. }
  431.  
  432. while( level.infc_StartingPerk1 == level.infc_SpecialistPerk1 )
  433. {
  434. level.infc_SpecialistPerk1 = getRandomPerk( 0 );
  435. wait 0.01;
  436. }
  437.  
  438. while( level.infc_StartingPerk2 == level.infc_SpecialistPerk2 )
  439. {
  440. level.infc_SpecialistPerk2 = getRandomPerk( 1 );
  441. wait 0.01;
  442. }
  443.  
  444. while( level.infc_StartingPerk3 == level.infc_SpecialistPerk3 )
  445. {
  446. level.infc_SpecialistPerk3 = getRandomPerk( 2 );
  447. wait 0.01;
  448. }
  449. }
  450.  
  451. SetSurvivorClass()
  452. {
  453. self iprintln("2");
  454. wait 0.2;
  455.  
  456. self takeAllWeapons();
  457. self clearPerks();
  458. self thread SpecialistList();
  459. self giveWeapon( level.infc_primaryWep, randomInt(9), true );
  460. self giveWeapon( level.infc_secondaryWep, randomInt(4), true );
  461.  
  462. self switchToWeapon( level.infc_primaryWep );
  463.  
  464. if( getDvarInt( "scr_infected_allow_allies_starting_perks" ) == 1 )
  465. {
  466. self _SetPerk( level.infc_StartingPerk1 );
  467. self _SetPerk( level.infc_StartingPerk2 );
  468. self _SetPerk( level.infc_StartingPerk3 );
  469. }
  470.  
  471. if( WeaponClass( level.infc_primaryWep ) == "sniper" )
  472. self [[game["axis_model"]["GHILLIE"]]]();
  473. }
  474.  
  475. SetInfectedClass()
  476. {
  477. self iprintln("3");
  478. wait 0.2;
  479.  
  480. self takeAllWeapons();
  481. self clearPerks();
  482.  
  483. self GiveWeapon("usp_tactical_mp");
  484. self SetWeaponAmmoClip("usp_tactical_mp", 0);
  485. self SetWeaponAmmoStock("usp_tactical_mp", 0);
  486. self SetSpawnWeapon("usp_tactical_mp");
  487.  
  488. if( getDvarInt( "scr_infected_allow_inf_tk" ) == 1 && getNumInfected() <= 1 )
  489. {
  490. self GiveWeapon("throwingknife_mp");
  491. self _SetPerk("throwingknife_mp");
  492. self SetOffhandPrimaryClass( "throwingknife" );
  493. }
  494.  
  495. if( getDvarInt( "scr_infected_allow_inf_tactical_insertion" ) == 1 )
  496. {
  497. self _SetPerk( "specialty_tacticalinsertion" );
  498. self SetActionslot( 3, "weapon", "flare_mp" );
  499. }
  500.  
  501. self _SetPerk("specialty_marathon"); //Marathon
  502. self _SetPerk("specialty_fastmantle"); //Marathon Pro
  503. self _SetPerk("specialty_lightweight"); //Lightweight
  504. }
  505.  
  506. SpecialistList()
  507. {
  508. self iprintln("5");
  509. self thread CurrentKS();
  510. self thread DeleteKSIcons();
  511.  
  512. level.infc_SpecialistPerk1M = getPerkMaterial( level.infc_SpecialistPerk1 );
  513. level.infc_SpecialistPerk2M = getPerkMaterial( level.infc_SpecialistPerk2 );
  514. level.infc_SpecialistPerk3M = getPerkMaterial( level.infc_SpecialistPerk3 );
  515.  
  516. self.ksOneIcon = createKSIcon( level.infc_SpecialistPerk1M, -90 );
  517. self.ksTwoIcon = createKSIcon( level.infc_SpecialistPerk2M, -115 );
  518. self.ksThrIcon = createKSIcon( level.infc_SpecialistPerk3M, -140 );
  519. self.ksForIcon = createKSIcon( level.infc_Specialist, -165 );
  520. }
  521.  
  522. DeleteKSIcons()
  523. {
  524. self waittill_either( "death", "joined_team" );
  525. self iprintln("6");
  526. self.ksOneIcon.alpha = 0;
  527. self.ksTwoIcon.alpha = 0;
  528. self.ksThrIcon.alpha = 0;
  529. self.ksForIcon.alpha = 0;
  530.  
  531. self.streak.alpha = 0;
  532. }
  533.  
  534. CurrentKS()
  535. {
  536. self.streak = self createFontString( "hudsmall", 0.8 );
  537. self.streak setPoint("TOPLEFT", "TOPLEFT", 5, 110);
  538. self.streak.hidewheninmenu = true;
  539. self.streak.alpha = 1;
  540. self iprintln("7");
  541. for(;;)
  542. {
  543. self waittill( "killed_enemy" );
  544. self.streak setText( "Killstreak: " + self.pers["cur_kill_streak"] );
  545. self iprintln("8");
  546. }
  547. }
  548.  
  549. createKSIcon(ksShader, y)
  550. {
  551. ksIcon = createIcon( ksShader, 20, 20 );
  552. ksIcon setPoint( "BOTTOM RIGHT", "BOTTOM RIGHT", -32, y );
  553. ksIcon.alpha = 0.5;
  554. ksIcon.hideWhenInMenu = true;
  555. ksIcon.foreground = true;
  556. return ksIcon;
  557. }
  558.  
  559. createEventPopup()
  560. {
  561. hud_EventPopup = newClientHudElem( self );
  562. hud_EventPopup.children = [];
  563. hud_EventPopup.horzAlign = "center";
  564. hud_EventPopup.vertAlign = "middle";
  565. hud_EventPopup.alignX = "center";
  566. hud_EventPopup.alignY = "middle";
  567. hud_EventPopup.x = 50;
  568. hud_EventPopup.y = -35;
  569. hud_EventPopup.font = "hudbig";
  570. hud_EventPopup.fontscale = 0.65;
  571. hud_EventPopup.archived = false;
  572. hud_EventPopup.color = (0.5,0.5,0.5);
  573. hud_EventPopup.sort = 10000;
  574. hud_EventPopup.elemType = "msgText";
  575. hud_EventPopup maps\mp\gametypes\_hud::fontPulseInit( 3.0 );
  576. return hud_EventPopup;
  577. }
  578.  
  579. EventPopup( event, hudColor, glowAlpha )
  580. {
  581. self endon( "disconnect" );
  582.  
  583. self notify( "EventPopup" );
  584. self endon( "EventPopup" );
  585.  
  586. wait ( 0.05 );
  587.  
  588. if ( !isDefined( hudColor ) )
  589. hudColor = (1,1,0.5);
  590. if ( !isDefined( glowAlpha ) )
  591. glowAlpha = 0;
  592.  
  593. self.hud_EventPopup.color = hudColor;
  594. self.hud_EventPopup.glowColor = hudColor;
  595. self.hud_EventPopup.glowAlpha = glowAlpha;
  596.  
  597. self.hud_EventPopup setText(event);
  598. self.hud_EventPopup.alpha = 0.85;
  599.  
  600. wait ( 1.0 );
  601.  
  602. self.hud_EventPopup fadeOverTime( 0.75 );
  603. self.hud_EventPopup.alpha = 0;
  604. }
  605.  
  606. inf_endGame( winningTeam, endReasonText )
  607. {
  608. thread maps\mp\gametypes\_gamelogic::endGame( winningTeam, endReasonText );
  609. }
  610.  
  611. updateTeamScores()
  612. {
  613. game["teamScores"]["axis"] = getNumInfected();
  614. setTeamScore( "axis", getNumInfected() );
  615. game["teamScores"]["allies"] = getNumSurvivors();
  616. setTeamScore( "allies", getNumSurvivors() );
  617. }
  618.  
  619. getNumInfected()
  620. {
  621. numInfected = 0;
  622. foreach ( player in level.players )
  623. {
  624. if ( player.team == "axis" )
  625. numInfected++;
  626. }
  627. return numInfected;
  628. }
  629.  
  630. getNumSurvivors()
  631. {
  632. numSurvivors = 0;
  633. foreach ( player in level.players )
  634. {
  635. if ( player.team == "allies" )
  636. numSurvivors++;
  637. }
  638. return numSurvivors;
  639. }
  640.  
  641. getRandomPrimary( type )
  642. {
  643. primary = [];
  644. attachment = [];
  645.  
  646. primary[primary.size] = strTok("ak47_,fal_,famas_,m4_,fn2000_,m16_,masada_,scar_,tavor_", ","); //AR
  647. primary[primary.size] = strTok("kriss_,mp5k_,p90_,uzi_,ump45_,", ","); //SMG
  648. primary[primary.size] = strTok("rpd_,sa80_,aug_,mg4_,m240_", ","); //LMG
  649. primary[primary.size] = strTok("barrett_,m21_,cheytac_,wa2000_", ","); //SNIPER
  650.  
  651. attachment[attachment.size] = strTok("acog_mp,eotech_mp,fmj_mp,reflex_mp,thermal_mp,xmags_mp,heartbeat_mp", ","); //AR
  652. attachment[attachment.size] = strTok("acog_mp,eotech_mp,fmj_mp,reflex_mp,thermal_mp,xmags_mp,rof_mp,akimbo_mp", ","); //SMG
  653. attachment[attachment.size] = strTok("acog_mp,eotech_mp,fmj_mp,reflex_mp,thermal_mp,xmags_mp,heartbeat_mp,grip_mp", ","); //LMG
  654. attachment[attachment.size] = strTok("acog_mp,fmj_mp,thermal_mp,xmags_mp,heartbeat_mp", ","); //SNIPER
  655.  
  656. if( getDvarInt( "scr_infected_allies_attachments" ) == 1 )
  657. return primary[type][randomInt(primary[type].size)] + attachment[type][randomInt(attachment[type].size)];
  658. else
  659. return primary[type][randomInt(primary[type].size)] + "mp";
  660. }
  661.  
  662. getRandomSecondary( type )
  663. {
  664. secondary = [];
  665. attachment = [];
  666.  
  667. secondary[secondary.size] = strTok("aa12_,striker_,spas12_,m1014_", ","); //Shotgun
  668. secondary[secondary.size] = strTok("model1887_,ranger_,", ","); //Special Shotguns
  669. secondary[secondary.size] = strTok("usp_,beretta_", ","); //Pistol
  670. secondary[secondary.size] = strTok("deserteagle_,coltanaconda_", ","); //Special Pistols
  671. secondary[secondary.size] = strTok("tmp_,beretta393_,", ","); //Machine Pistol
  672. secondary[secondary.size] = strTok("glock_,pp2000_,", ","); //Special Machine Pistols
  673.  
  674. attachment[attachment.size] = strTok("eotech_mp,reflex_mp,fmj_mp,grip_mp,xmags_mp", ","); //Shotgun
  675. attachment[attachment.size] = strTok("akimbo_mp,fmj_mp", ","); //Special Shotgun
  676. attachment[attachment.size] = strTok("tactical_mp,fmj_mp,xmags_mp", ","); //Pistol
  677. attachment[attachment.size] = strTok("tactical_mp,fmj_mp", ","); //Special Pistol
  678. attachment[attachment.size] = strTok("reflex_mp,fmj_mp,xmags_mp,akimbo_mp", ","); //Machine Pistol
  679. attachment[attachment.size] = strTok("reflex_mp,fmj_mp,eotech_mp,xmags_mp,akimbo_mp", ","); //Special Machine Pistol
  680.  
  681. if( getDvarInt( "scr_infected_allies_attachments" ) == 1 )
  682. return secondary[type][randomInt(secondary[type].size)] + attachment[type][randomInt(attachment[type].size)];
  683. else
  684. return secondary[type][randomInt(secondary[type].size)] + "mp";
  685. }
  686.  
  687. getRandomPerk( type )
  688. {
  689. perks = [];
  690.  
  691. perks[perks.size] = strTok("specialty_scavenger,specialty_fastreload,specialty_marathon", ",");
  692. perks[perks.size] = strTok("specialty_bulletdamage,specialty_lightweight,specialty_coldblooded,specialty_explosivedamage", ",");
  693. perks[perks.size] = strTok("specialty_bulletaccuracy,specialty_heartbreaker,specialty_detectexplosive,specialty_extendedmelee", ",");
  694.  
  695. return perks[type][randomInt(perks[type].size)];
  696. }
  697.  
  698. getPerkMaterial( perk )
  699. {
  700. return tableLookUp( "mp/perkTable.csv", 1, perk, 3 );
  701. }
  702.  
  703. getPerkString( perk )
  704. {
  705. return tableLookUpIString( "mp/perkTable.csv", 1, perk, 2 );
  706. }
  707.  
  708. setAllPerks()
  709. {
  710. self _setPerk("specialty_marathon");
  711. self _setPerk("specialty_fastmantle");
  712. self _setPerk("specialty_fastreload");
  713. self _setPerk("specialty_quickdraw");
  714. self _setPerk("specialty_lightweight");
  715. self _setPerk("specialty_fastsprintrecovery");
  716. self _setPerk("specialty_scavenger");
  717. self _setPerk("specialty_extraammo");
  718. self _setPerk("specialty_bulletdamage");
  719. self _setPerk("specialty_armorpiercing");
  720. self _setPerk("specialty_coldblooded");
  721. self _setPerk("specialty_spygame");
  722. self _setPerk("specialty_explosivedamage");
  723. self _setPerk("specialty_dangerclose");
  724. self _setPerk("specialty_extendedmelee");
  725. self _setPerk("specialty_falldamage");
  726. self _setPerk("specialty_bulletaccuracy");
  727. self _setPerk("specialty_holdbreath");
  728. self _setPerk("specialty_delaymine"); //Only Pro version of Scrambler
  729. self _setPerk("specialty_heartbreaker");
  730. self _setPerk("specialty_quieter");
  731. self _setPerk("specialty_detectexplosive");
  732. self _setPerk("specialty_selectivehearing");
  733. self _setPerk("specialty_hardline");
  734. self _setPerk("specialty_rollover");
  735. }
  736.  
  737. getGoodColor()
  738. {
  739. color = [];
  740.  
  741. for( i=0; i<3; i++ )
  742. {
  743. color[i] = randomint( 2 );
  744. wait 0.05;
  745. }
  746.  
  747. if( color[0] == color[1] && color[1] == color[2] )
  748. {
  749. rand = randomint(3);
  750. color[rand] += 1;
  751. color[rand] %= 2;
  752. }
  753.  
  754. return ( color[0], color[1], color[2] );
  755. }
  756.  
  757. DeleteOnEndGame()
  758. {
  759. level waittill("game_ended");
  760.  
  761. self.ksOneIcon.alpha = 0;
  762. self.ksTwoIcon.alpha = 0;
  763. self.ksThrIcon.alpha = 0;
  764. self.ksForIcon.alpha = 0;
  765.  
  766. self.streak.alpha = 0;
  767. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement