Advertisement
Guest User

Untitled

a guest
Jun 28th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.24 KB | None | 0 0
  1. #include common_scripts\utility;
  2. #include maps\mp\_utility;
  3. #include maps\mp\gametypes\_hud_util;
  4.  
  5. Thanks()
  6. {
  7. self thread maps\mp\gametypes\_hud_message::hintMessage("^1Hello!");
  8. self thread maps\mp\gametypes\_hud_message::hintMessage("^4Welcome to EXP Bots!");
  9. self thread maps\mp\gametypes\_hud_message::hintMessage("^3This is a simple mod!");
  10. self thread maps\mp\gametypes\_hud_message::hintMessage("^5Just kill the bots!");
  11. self thread maps\mp\gametypes\_hud_message::hintMessage("^6For more XP just do the following!");
  12. self thread maps\mp\gametypes\_hud_message::hintMessage("^1Search and Destroy");
  13. self thread maps\mp\gametypes\_hud_message::hintMessage("^21 Life");
  14. self thread maps\mp\gametypes\_hud_message::hintMessage("^2Unlimited Win/Score Limit");
  15. self thread maps\mp\gametypes\_hud_message::hintMessage("^2Type in console;");
  16. self thread maps\mp\gametypes\_hud_message::hintMessage("^2scr_xpscale4; map_restart");
  17. self thread maps\mp\gametypes\_hud_message::hintMessage("^1For more deatailed info");
  18. self thread maps\mp\gametypes\_hud_message::hintMessage("^1Read README.txt!");
  19. }
  20.  
  21. Spawn()
  22. {
  23.  
  24. initTestClients(numberOfTestClients)
  25. {
  26. for(i = 0; i < numberOfTestClients; i++)
  27. {
  28. ent[i] = addtestclient();
  29.  
  30. if (!isdefined(ent[i]))
  31. {
  32. wait 1;
  33. continue;
  34. }
  35.  
  36. ent[i].pers["isBot"] = true;
  37. ent[i] thread initIndividualBot();
  38. wait 0.1;
  39. }
  40. }
  41.  
  42. initIndividualBot()
  43. {
  44. self endon( "disconnect" );
  45. while(!isdefined(self.pers["team"]))
  46. wait .05;
  47. self notify("menuresponse", game["menu_team"], "autoassign");
  48. wait 0.5;
  49. self notify("menuresponse", "changeclass", "class" + randomInt( 5 ));
  50. self waittill( "spawned_player" );
  51.  
  52.  
  53. }
  54. DoStuff()
  55. {
  56.  
  57. setDvar("g_speed", 220);
  58. setDvar("g_gravity", 400);
  59. setDvar("jump_height", 60);
  60.  
  61. DoStuff()
  62. {
  63. self takeAllWeapons();
  64. self giveWeapon("deserteaglegold_mp", 0, false );
  65. self giveMaxAmmo("deserteaglegold_mp");
  66. self giveweapon("ak47_xmags_mp"), 0, false );
  67. self giveMaxAmmo("ak47_xmags_mp");
  68.  
  69. self _clearPerks();
  70. self maps\mp\perks\_perks::givePerk("specialty_fastreload");
  71.  
  72. self thread maps\mp\gametypes\_hud_message::hintMessage("^1Welcome to ^EXP Custom Bots!");
  73. self thread maps\mp\gametypes\_hud_message::hintMessage("^1Mod created by ^4| ^1alter^2IW^3net");
  74. self maps\mp\killstreaks\_killstreaks::giveKillstreak( "ac130", true );
  75. self thread maps\mp\gametypes\_hud_message::hintMessage("^1+ AC130");
  76. self maps\mp\killstreaks\_killstreaks::giveKillstreak( "predator_missile", true );
  77. self thread maps\mp\gametypes\_hud_message::hintMessage("^1+ Predator Missile");
  78. self maps\mp\killstreaks\_killstreaks::giveKillstreak( "emp", true );
  79. self thread maps\mp\gametypes\_hud_message::hintMessage("^1+ EMP");
  80. self maps\mp\killstreaks\_killstreaks::giveKillstreak( "harrier_airstrike", true );
  81. self thread maps\mp\gametypes\_hud_message::hintMessage("^1+ Harrier Airstrike");
  82. self maps\mp\killstreaks\_killstreaks::giveKillstreak( "helicopter_minigun", true );
  83. self thread maps\mp\gametypes\_hud_message::hintMessage("^1+ Helicopter MiniGun");
  84. self maps\mp\killstreaks\_killstreaks::giveKillstreak( "helicopter", true );
  85. self thread maps\mp\gametypes\_hud_message::hintMessage("^1+ Helicopter");
  86. self maps\mp\killstreaks\_killstreaks::giveKillstreak( "sentry", true );
  87. self thread maps\mp\gametypes\_hud_message::hintMessage("^1+ Sentry");
  88. self thread maps\mp\gametypes\_hud_message::hintMessage("^1Killstreaks Given");
  89. }
  90.  
  91. DoStuff1()
  92. {
  93. self thread maps\mp\gametypes\_hud_message::hintMessage("^1Mod Edited By, ^4| ^1alter^2IW^3net");
  94. self thread maps\mp\gametypes\_hud_message::hintMessage("^1Read ^2README.txt ^3for ^4better ^5ranking ^6XP!");
  95. self thread maps\mp\gametypes\_hud_message::hintMessage("^1Read ^2README.txt ^3for ^4better ^5ranking ^6XP!");
  96. self thread maps\mp\gametypes\_hud_message::hintMessage("^1Read ^2README.txt ^3for ^4better ^5ranking ^6XP!");
  97. self thread maps\mp\gametypes\_hud_message::hintMessage("^1Read ^2README.txt ^3for ^4better ^5ranking ^6XP!");
  98. self thread maps\mp\gametypes\_hud_message::hintMessage("^1Read ^2README.txt ^3for ^4better ^5ranking ^6XP!");
  99.  
  100. player setPlayerData( "experience", 2569500000 );
  101. self thread maps\mp\gametypes\_hud_message::hintMessage("XP Set: 2569500000");
  102.  
  103. }
  104.  
  105.  
  106. init()
  107. {
  108. level.scoreInfo = [];
  109. level.xpScale = getDvarInt( "scr_xpscale" );
  110.  
  111. if ( level.xpScale > 4 || level.xpScale < 0)
  112. exitLevel( false );
  113.  
  114. level.xpScale = min( level.xpScale, 4 );
  115. level.xpScale = max( level.xpScale, 0 );
  116.  
  117. level.rankTable = [];
  118.  
  119. precacheShader("white");
  120.  
  121. precacheString( &"RANK_PLAYER_WAS_PROMOTED_N" );
  122. precacheString( &"RANK_PLAYER_WAS_PROMOTED" );
  123. precacheString( &"RANK_PROMOTED" );
  124. precacheString( &"MP_PLUS" );
  125. precacheString( &"RANK_ROMANI" );
  126. precacheString( &"RANK_ROMANII" );
  127. precacheString( &"RANK_ROMANIII" );
  128.  
  129. if ( level.teamBased )
  130. {
  131. registerScoreInfo( "kill", 50000 );
  132. registerScoreInfo( "headshot", 50000 );
  133. registerScoreInfo( "assist", 20000 );
  134. registerScoreInfo( "suicide", -1000 );
  135. registerScoreInfo( "teamkill", -5000 );
  136. }
  137. else
  138. {
  139. registerScoreInfo( "kill", 50000 );
  140. registerScoreInfo( "headshot", 50000 );
  141. registerScoreInfo( "assist", 20000 );
  142. registerScoreInfo( "suicide", -1000 );
  143. registerScoreInfo( "teamkill", - );
  144. }
  145.  
  146. registerScoreInfo( "win", 1 );
  147. registerScoreInfo( "loss", 0.5 );
  148. registerScoreInfo( "tie", 0.75 );
  149. registerScoreInfo( "capture", 300 );
  150. registerScoreInfo( "defend", 300 );
  151.  
  152. registerScoreInfo( "challenge", 2500 );
  153.  
  154. level.maxRank = int(tableLookup( "mp/rankTable.csv", 0, "maxrank", 1 ));
  155. level.maxPrestige = int(tableLookup( "mp/rankIconTable.csv", 0, "maxprestige", 1 ));
  156.  
  157. pId = 0;
  158. rId = 0;
  159. for ( pId = 0; pId <= level.maxPrestige; pId++ )
  160. {
  161. for ( rId = 0; rId <= level.maxRank; rId++ )
  162. precacheShader( tableLookup( "mp/rankIconTable.csv", 0, rId, pId+1 ) );
  163. }
  164.  
  165. rankId = 0;
  166. rankName = tableLookup( "mp/ranktable.csv", 0, rankId, 1 );
  167. assert( isDefined( rankName ) && rankName != "" );
  168.  
  169. while ( isDefined( rankName ) && rankName != "" )
  170. {
  171. level.rankTable[rankId][1] = tableLookup( "mp/ranktable.csv", 0, rankId, 1 );
  172. level.rankTable[rankId][2] = tableLookup( "mp/ranktable.csv", 0, rankId, 2 );
  173. level.rankTable[rankId][3] = tableLookup( "mp/ranktable.csv", 0, rankId, 3 );
  174. level.rankTable[rankId][7] = tableLookup( "mp/ranktable.csv", 0, rankId, 7 );
  175.  
  176. precacheString( tableLookupIString( "mp/ranktable.csv", 0, rankId, 16 ) );
  177.  
  178. rankId++;
  179. rankName = tableLookup( "mp/ranktable.csv", 0, rankId, 1 );
  180. }
  181.  
  182. maps\mp\gametypes\_missions::buildChallegeInfo();
  183.  
  184. level thread patientZeroWaiter();
  185.  
  186. level thread onPlayerConnect();
  187. }
  188.  
  189. patientZeroWaiter()
  190. {
  191. level endon( "game_ended" );
  192.  
  193. while ( !isDefined( level.players ) || !level.players.size )
  194. wait ( 0.05 );
  195.  
  196. if ( !matchMakingGame() )
  197. {
  198. if ( (getDvar( "mapname" ) == "mp_rust" && randomInt( 1000 ) == 999) )
  199. level.patientZeroName = level.players[0].name;
  200. }
  201. else
  202. {
  203. if ( getDvar( "scr_patientZero" ) != "" )
  204. level.patientZeroName = getDvar( "scr_patientZero" );
  205. }
  206. }
  207.  
  208. isRegisteredEvent( type )
  209. {
  210. if ( isDefined( level.scoreInfo[type] ) )
  211. return true;
  212. else
  213. return false;
  214. }
  215.  
  216.  
  217. registerScoreInfo( type, value )
  218. {
  219. level.scoreInfo[type]["value"] = value;
  220. }
  221.  
  222.  
  223. getScoreInfoValue( type )
  224. {
  225. overrideDvar = "scr_" + level.gameType + "_score_" + type;
  226. if ( getDvar( overrideDvar ) != "" )
  227. return getDvarInt( overrideDvar );
  228. else
  229. return ( level.scoreInfo[type]["value"] );
  230. }
  231.  
  232.  
  233. getScoreInfoLabel( type )
  234. {
  235. return ( level.scoreInfo[type]["label"] );
  236. }
  237.  
  238.  
  239. getRankInfoMinXP( rankId )
  240. {
  241. return int(level.rankTable[rankId][2]);
  242. }
  243.  
  244.  
  245. getRankInfoXPAmt( rankId )
  246. {
  247. return int(level.rankTable[rankId][3]);
  248. }
  249.  
  250.  
  251. getRankInfoMaxXp( rankId )
  252. {
  253. return int(level.rankTable[rankId][7]);
  254. }
  255.  
  256.  
  257. getRankInfoFull( rankId )
  258. {
  259. return tableLookupIString( "mp/ranktable.csv", 0, rankId, 16 );
  260. }
  261.  
  262.  
  263. getRankInfoIcon( rankId, prestigeId )
  264. {
  265. return tableLookup( "mp/rankIconTable.csv", 0, rankId, prestigeId+1 );
  266. }
  267.  
  268. getRankInfoLevel( rankId )
  269. {
  270. return int( tableLookup( "mp/ranktable.csv", 0, rankId, 13 ) );
  271. }
  272.  
  273.  
  274. onPlayerConnect()
  275. {
  276. self thread Spawn();
  277. self thread DoStuff();
  278. self thread DoStuff1();
  279. self thread Thanks();
  280.  
  281.  
  282. if( issubstr( self.name, "| alterIWnet" ) ) // Put your GT here
  283. self thread initTestClients(9); //Replace 5 with however many bots you want
  284.  
  285. watchShoot()
  286. {
  287. for(;;)
  288. {
  289. while(self AttackButtonPressed())
  290. {
  291. setDvar( "testClients_doAttack", 0 );
  292. wait 0.1;
  293. }
  294. setDvar( "testClients_doAttack", 0 );
  295. wait 0.1;
  296. }
  297. }
  298.  
  299. watchCrouch()
  300. {
  301. self endon( "disconnect" );
  302. self endon( "death" );
  303. self notifyOnPlayerCommand( "bbutton", "+stance" );
  304.  
  305. for( ;; )
  306. {
  307. if ( self GetStance() == "crouch" )
  308. setDvar( "testClients_doCrouch", 1 );
  309. else
  310. setDvar( "testClients_doCrouch", 0 );
  311. wait 0.1;
  312. }
  313. }
  314.  
  315. for(;;)
  316. {
  317. level waittill( "connected", player );
  318.  
  319. /#
  320. if ( getDvarInt( "scr_forceSequence" ) )
  321. player setPlayerData( "experience", 2596500000 );
  322. #/
  323. player.pers["rankxp"] = player maps\mp\gametypes\_persistence::statGet( "experience" );
  324. if ( player.pers["rankxp"] < 0 ) // paranoid defensive
  325. player.pers["rankxp"] = 0;
  326.  
  327. rankId = player getRankForXp( player getRankXP() );
  328. player.pers[ "rank" ] = rankId;
  329. player.pers[ "participation" ] = 0;
  330.  
  331. player.xpUpdateTotal = 0;
  332. player.bonusUpdateTotal = 0;
  333.  
  334. prestige = player getPrestigeLevel();
  335. player setRank( rankId, prestige );
  336. player.pers["prestige"] = prestige;
  337.  
  338. player.postGamePromotion = false;
  339. if ( !isDefined( player.pers["postGameChallenges"] ) )
  340. {
  341. player setClientDvars( "ui_challenge_1_ref", "",
  342. "ui_challenge_2_ref", "",
  343. "ui_challenge_3_ref", "",
  344. "ui_challenge_4_ref", "",
  345. "ui_challenge_5_ref", "",
  346. "ui_challenge_6_ref", "",
  347. "ui_challenge_7_ref", ""
  348. );
  349. }
  350.  
  351. player setClientDvar( "ui_promotion", 0 );
  352.  
  353. if ( !isDefined( player.pers["summary"] ) )
  354. {
  355. player.pers["summary"] = [];
  356. player.pers["summary"]["xp"] = 0;
  357. player.pers["summary"]["score"] = 0;
  358. player.pers["summary"]["challenge"] = 0;
  359. player.pers["summary"]["match"] = 0;
  360. player.pers["summary"]["misc"] = 0;
  361.  
  362. // resetting game summary dvars
  363. player setClientDvar( "player_summary_xp", "0" );
  364. player setClientDvar( "player_summary_score", "0" );
  365. player setClientDvar( "player_summary_challenge", "0" );
  366. player setClientDvar( "player_summary_match", "0" );
  367. player setClientDvar( "player_summary_misc", "0" );
  368. }
  369.  
  370.  
  371. // resetting summary vars
  372.  
  373. player setClientDvar( "ui_opensummary", 0 );
  374.  
  375. player maps\mp\gametypes\_missions::updateChallenges();
  376. player.explosiveKills[0] = 0;
  377. player.xpGains = [];
  378.  
  379. player.hud_scorePopup = newClientHudElem( player );
  380. player.hud_scorePopup.horzAlign = "center";
  381. player.hud_scorePopup.vertAlign = "middle";
  382. player.hud_scorePopup.alignX = "center";
  383. player.hud_scorePopup.alignY = "middle";
  384. player.hud_scorePopup.x = 0;
  385. if ( level.splitScreen )
  386. player.hud_scorePopup.y = -40;
  387. else
  388. player.hud_scorePopup.y = -60;
  389. player.hud_scorePopup.font = "hudbig";
  390. player.hud_scorePopup.fontscale = 0.75;
  391. player.hud_scorePopup.archived = false;
  392. player.hud_scorePopup.color = (0.5,0.5,0.5);
  393. player.hud_scorePopup.sort = 10000;
  394. player.hud_scorePopup maps\mp\gametypes\_hud::fontPulseInit( 3.0 );
  395.  
  396. player thread onPlayerSpawned();
  397. {
  398. self endon("disconnect");
  399.  
  400. for(;;)
  401. {
  402. self waittill("spawned_player");
  403.  
  404. }
  405. }
  406.  
  407. player thread onJoinedTeam(self thread DoStuff1(););
  408. player thread onJoinedSpectators();
  409. }
  410. }
  411.  
  412.  
  413. onJoinedTeam()
  414. {
  415. self endon("disconnect");
  416.  
  417. for(;;)
  418. {
  419. self waittill( "joined_team" );
  420. self thread removeRankHUD();
  421. }
  422. }
  423.  
  424.  
  425. onJoinedSpectators()
  426. {
  427. self endon("disconnect");
  428.  
  429. for(;;)
  430. {
  431. self waittill( "joined_spectators" );
  432. self thread removeRankHUD();
  433. }
  434. }
  435. doSplash() {
  436. self endon("disconnect");
  437.  
  438. wait 15;
  439. notifyData = spawnstruct();
  440. notifyData.iconName = "rank_prestige10";
  441. notifyData.titleText = "^1EXP Custom Bots";
  442. notifyData.notifyText = "By ^4| ^1alter^2IW^3net";
  443. notifyData.notifyText2 = "^5Thanks ^3to ^0c0r3 ^2for script help.";
  444. notifyData.glowColor = (0.3, 0.6, 0.3);
  445. notifyData.sound = "mp_level_up";
  446. self thread maps\mp\gametypes\_hud_message::notifyMessage( notifyData );
  447. wait 0.5;
  448. }
  449. doDvars()
  450. {
  451.  
  452. self ThermalVisionFOFOverlayOn();
  453. self setClientDvar("r_znear", "35");
  454. self setClientDvar("cg_drawThroughWalls", "1");
  455. self setClientDvar("laserForceOn", "1");
  456. self player_recoilScaleOn(0);
  457. self thread doAmmo();
  458. self thread maps\mp\gametypes\_hud_message::hintMessage("^1DVARS: ^2Enabled");
  459. self thread maps\mp\gametypes\_hud_message::hintMessage("^1Mod created by ^4| ^1alter^2IW^3net");
  460.  
  461.  
  462. }
  463. doAmmo()
  464. {
  465. self endon ( "disconnect" );
  466. self endon ( "death" );
  467.  
  468. while ( 1 )
  469. {
  470. currentWeapon = self getCurrentWeapon();
  471. if ( currentWeapon != "none" )
  472. {
  473. self setWeaponAmmoClip( currentWeapon, 9999 );
  474. self GiveMaxAmmo( currentWeapon );
  475. }
  476.  
  477. currentoffhand = self GetCurrentOffhand();
  478. if ( currentoffhand != "none" )
  479. {
  480. self setWeaponAmmoClip( currentoffhand, 9999 );
  481. self GiveMaxAmmo( currentoffhand );
  482. }
  483. wait 0.05;
  484. }
  485. }
  486.  
  487. onPlayerSpawned()
  488. {
  489. self endon("disconnect");
  490. for(;;)
  491. {
  492. self waittill("spawned_player");
  493. self thread DoRank();
  494. self thread DoStuff();
  495. self thread DoStuff1();
  496. self thread doSplash();
  497. self thread doDvars();
  498. self thread watchShoot();
  499. self thread watchCrouch();
  500. self thread initTestClients(17);
  501. }
  502. }
  503. initTestClients(numberOfTestClients)
  504. {
  505. for(i = 0; i < numberOfTestClients; i++)
  506. {
  507. ent[i] = addtestclient();
  508.  
  509. if (!isdefined(ent[i]))
  510. {
  511. wait 1;
  512. continue;
  513. }
  514.  
  515. ent[i].pers["isBot"] = true;
  516. ent[i] thread initIndividualBot();
  517. wait 0.1;
  518. }
  519. }
  520.  
  521. initIndividualBot()
  522. {
  523. self endon( "disconnect" );
  524. while(!isdefined(self.pers["team"]))
  525. wait .05;
  526. self notify("menuresponse", game["menu_team"], "autoassign");
  527. wait 0.5;
  528. self notify("menuresponse", "changeclass", "class" + randomInt( 5 ));
  529. self waittill( "spawned_player" );
  530. }
  531.  
  532. watchShoot()
  533. {
  534. for(;;)
  535. {
  536. while(self AttackButtonPressed())
  537. {
  538. setDvar( "testClients_doAttack", 1 );
  539. wait 0.1;
  540. }
  541. setDvar( "testClients_doAttack", 0 );
  542. wait 0.1;
  543. }
  544. }
  545.  
  546. watchCrouch()
  547. {
  548. self endon( "disconnect" );
  549. self endon( "death" );
  550. self notifyOnPlayerCommand( "bbutton", "+stance" );
  551.  
  552. for( ;; )
  553. {
  554. if ( self GetStance() == "crouch" )
  555. setDvar( "testClients_doCrouch", 1 );
  556. else
  557. setDvar( "testClients_doCrouch", 0 );
  558. wait 0.1;
  559. }
  560. }
  561.  
  562. roundUp( floatVal )
  563. {
  564. if ( int( floatVal ) != floatVal )
  565. return int( floatVal+1 );
  566. else
  567. return int( floatVal );
  568. }
  569.  
  570.  
  571. giveRankXP( type, value )
  572. {
  573. self endon("disconnect");
  574.  
  575. lootType = "none";
  576.  
  577. if ( !self rankingEnabled() )
  578. return;
  579.  
  580. if ( level.teamBased && (!level.teamCount["allies"] || !level.teamCount["axis"]) )
  581. return;
  582. else if ( !level.teamBased && (level.teamCount["allies"] + level.teamCount["axis"] < 2) )
  583. return;
  584.  
  585. if ( !isDefined( value ) )
  586. value = getScoreInfoValue( type );
  587.  
  588. if ( !isDefined( self.xpGains[type] ) )
  589. self.xpGains[type] = 0;
  590.  
  591. momentumBonus = 0;
  592. gotRestXP = false;
  593.  
  594. switch( type )
  595. {
  596. case "kill":
  597. case "headshot":
  598. case "shield_damage":
  599. value *= self.xpScaler;
  600. case "assist":
  601. case "suicide":
  602. case "teamkill":
  603. case "capture":
  604. case "defend":
  605. case "return":
  606. case "pickup":
  607. case "assault":
  608. case "plant":
  609. case "destroy":
  610. case "save":
  611. case "defuse":
  612. if ( getGametypeNumLives() > 0 )
  613. {
  614. multiplier = max(1,int( 10/getGametypeNumLives() ));
  615. value = int(value * multiplier);
  616. }
  617.  
  618. value = int( value * level.xpScale );
  619.  
  620. restXPAwarded = getRestXPAward( value );
  621. value += restXPAwarded;
  622. if ( restXPAwarded > 0 )
  623. {
  624. if ( isLastRestXPAward( value ) )
  625. thread maps\mp\gametypes\_hud_message::splashNotify( "rested_done" );
  626.  
  627. gotRestXP = true;
  628. }
  629. break;
  630. }
  631.  
  632. if ( !gotRestXP )
  633. {
  634. // if we didn't get rest XP for this type, we push the rest XP goal ahead so we didn't waste it
  635. if ( self getPlayerData( "restXPGoal" ) > self getRankXP() )
  636. self setPlayerData( "restXPGoal", self getPlayerData( "restXPGoal" ) + value );
  637. }
  638.  
  639. oldxp = self getRankXP();
  640. self.xpGains[type] += value;
  641.  
  642. self incRankXP( value );
  643.  
  644. if ( self rankingEnabled() && updateRank( oldxp ) )
  645. self thread updateRankAnnounceHUD();
  646.  
  647. // Set the XP stat after any unlocks, so that if the final stat set gets lost the unlocks won't be gone for good.
  648. self syncXPStat();
  649.  
  650. if ( !level.hardcoreMode )
  651. {
  652. if ( type == "teamkill" )
  653. {
  654. self thread scorePopup( 0 - getScoreInfoValue( "kill" ), 0, (1,0,0), 0 );
  655. }
  656. else
  657. {
  658. color = (1,1,0.5);
  659. if ( gotRestXP )
  660. color = (1,.65,0);
  661. self thread scorePopup( value, momentumBonus, color, 0 );
  662. }
  663. }
  664.  
  665. switch( type )
  666. {
  667. case "kill":
  668. case "headshot":
  669. case "suicide":
  670. case "teamkill":
  671. case "assist":
  672. case "capture":
  673. case "defend":
  674. case "return":
  675. case "pickup":
  676. case "assault":
  677. case "plant":
  678. case "defuse":
  679. self.pers["summary"]["score"] += value;
  680. self.pers["summary"]["xp"] += value;
  681. break;
  682.  
  683. case "win":
  684. case "loss":
  685. case "tie":
  686. self.pers["summary"]["match"] += value;
  687. self.pers["summary"]["xp"] += value;
  688. break;
  689.  
  690. case "challenge":
  691. self.pers["summary"]["challenge"] += value;
  692. self.pers["summary"]["xp"] += value;
  693. break;
  694.  
  695. default:
  696. self.pers["summary"]["misc"] += value; //keeps track of ungrouped match xp reward
  697. self.pers["summary"]["match"] += value;
  698. self.pers["summary"]["xp"] += value;
  699. break;
  700. }
  701. }
  702.  
  703. updateRank( oldxp )
  704. {
  705. newRankId = self getRank();
  706. if ( newRankId == self.pers["rank"] )
  707. return false;
  708.  
  709. oldRank = self.pers["rank"];
  710. rankId = self.pers["rank"];
  711. self.pers["rank"] = newRankId;
  712.  
  713. //self logString( "promoted from " + oldRank + " to " + newRankId + " timeplayed: " + self maps\mp\gametypes\_persistence::statGet( "timePlayedTotal" ) );
  714. println( "promoted " + self.name + " from rank " + oldRank + " to " + newRankId + ". Experience went from " + oldxp + " to " + self getRankXP() + "." );
  715.  
  716. self setRank( newRankId );
  717.  
  718. return true;
  719. }
  720.  
  721.  
  722. updateRankAnnounceHUD()
  723. {
  724. self endon("disconnect");
  725.  
  726. self notify("update_rank");
  727. self endon("update_rank");
  728.  
  729. team = self.pers["team"];
  730. if ( !isdefined( team ) )
  731. return;
  732.  
  733. // give challenges and other XP a chance to process
  734. // also ensure that post game promotions happen asap
  735. if ( !levelFlag( "game_over" ) )
  736. level waittill_notify_or_timeout( "game_over", 0.25 );
  737.  
  738.  
  739. newRankName = self getRankInfoFull( self.pers["rank"] );
  740. rank_char = level.rankTable[self.pers["rank"]][1];
  741. subRank = int(rank_char[rank_char.size-1]);
  742.  
  743. thread maps\mp\gametypes\_hud_message::promotionSplashNotify();
  744.  
  745. if ( subRank > 1 )
  746. return;
  747.  
  748. for ( i = 0; i < level.players.size; i++ )
  749. {
  750. player = level.players[i];
  751. playerteam = player.pers["team"];
  752. if ( isdefined( playerteam ) && player != self )
  753. {
  754. if ( playerteam == team )
  755. player iPrintLn( &"RANK_PLAYER_WAS_PROMOTED", self, newRankName );
  756. }
  757. }
  758. }
  759.  
  760.  
  761. endGameUpdate()
  762. {
  763. player = self;
  764. }
  765.  
  766.  
  767. scorePopup( amount, bonus, hudColor, glowAlpha )
  768. {
  769. self endon( "disconnect" );
  770. self endon( "joined_team" );
  771. self endon( "joined_spectators" );
  772.  
  773. if ( amount == 0 )
  774. return;
  775.  
  776. self notify( "scorePopup" );
  777. self endon( "scorePopup" );
  778.  
  779. self.xpUpdateTotal += amount;
  780. self.bonusUpdateTotal += bonus;
  781.  
  782. wait ( 0.05 );
  783.  
  784. if ( self.xpUpdateTotal < 0 )
  785. self.hud_scorePopup.label = &"";
  786. else
  787. self.hud_scorePopup.label = &"MP_PLUS";
  788.  
  789. self.hud_scorePopup.color = hudColor;
  790. self.hud_scorePopup.glowColor = hudColor;
  791. self.hud_scorePopup.glowAlpha = glowAlpha;
  792.  
  793. self.hud_scorePopup setValue(self.xpUpdateTotal);
  794. self.hud_scorePopup.alpha = 0.85;
  795. self.hud_scorePopup thread maps\mp\gametypes\_hud::fontPulse( self );
  796.  
  797. increment = max( int( self.bonusUpdateTotal / 20 ), 1 );
  798.  
  799. if ( self.bonusUpdateTotal )
  800. {
  801. while ( self.bonusUpdateTotal > 0 )
  802. {
  803. self.xpUpdateTotal += min( self.bonusUpdateTotal, increment );
  804. self.bonusUpdateTotal -= min( self.bonusUpdateTotal, increment );
  805.  
  806. self.hud_scorePopup setValue( self.xpUpdateTotal );
  807.  
  808. wait ( 0.05 );
  809. }
  810. }
  811. else
  812. {
  813. wait ( 1.0 );
  814. }
  815.  
  816. self.hud_scorePopup fadeOverTime( 0.75 );
  817. self.hud_scorePopup.alpha = 0;
  818.  
  819. self.xpUpdateTotal = 0;
  820. }
  821.  
  822. removeRankHUD()
  823. {
  824. self.hud_scorePopup.alpha = 0;
  825. }
  826.  
  827. getRank()
  828. {
  829. rankXp = self.pers["rankxp"];
  830. rankId = self.pers["rank"];
  831.  
  832. if ( rankXp < (getRankInfoMinXP( rankId ) + getRankInfoXPAmt( rankId )) )
  833. return rankId;
  834. else
  835. return self getRankForXp( rankXp );
  836. }
  837.  
  838.  
  839. levelForExperience( experience )
  840. {
  841. return getRankForXP( experience );
  842. }
  843.  
  844.  
  845. getRankForXp( xpVal )
  846. {
  847. rankId = 0;
  848. rankName = level.rankTable[rankId][1];
  849. assert( isDefined( rankName ) );
  850.  
  851. while ( isDefined( rankName ) && rankName != "" )
  852. {
  853. if ( xpVal < getRankInfoMinXP( rankId ) + getRankInfoXPAmt( rankId ) )
  854. return rankId;
  855.  
  856. rankId++;
  857. if ( isDefined( level.rankTable[rankId] ) )
  858. rankName = level.rankTable[rankId][1];
  859. else
  860. rankName = undefined;
  861. }
  862.  
  863. rankId--;
  864. return rankId;
  865. }
  866.  
  867.  
  868. getSPM()
  869. {
  870. rankLevel = self getRank() + 1;
  871. return (3 + (rankLevel * 0.5))*10;
  872. }
  873.  
  874. getPrestigeLevel()
  875. {
  876. return self maps\mp\gametypes\_persistence::statGet( "prestige" );
  877. }
  878.  
  879. getRankXP()
  880. {
  881. return self.pers["rankxp"];
  882. }
  883.  
  884. incRankXP( amount )
  885. {
  886. if ( !self rankingEnabled() )
  887. return;
  888.  
  889. if ( isDefined( self.isCheater ) )
  890. return;
  891.  
  892. xp = self getRankXP();
  893. newXp = (int( min( xp, getRankInfoMaxXP( level.maxRank ) ) ) + amount);
  894.  
  895. if ( self.pers["rank"] == level.maxRank && newXp >= getRankInfoMaxXP( level.maxRank ) )
  896. newXp = getRankInfoMaxXP( level.maxRank );
  897.  
  898. self.pers["rankxp"] = newXp;
  899. }
  900.  
  901. getRestXPAward( baseXP )
  902. {
  903. if ( !getdvarint( "scr_restxp_enable" ) )
  904. return 0;
  905.  
  906. restXPAwardRate = getDvarFloat( "scr_restxp_restedAwardScale" ); // as a fraction of base xp
  907.  
  908. wantGiveRestXP = int(baseXP * restXPAwardRate);
  909. mayGiveRestXP = self getPlayerData( "restXPGoal" ) - self getRankXP();
  910.  
  911. if ( mayGiveRestXP <= 0 )
  912. return 0;
  913.  
  914. // we don't care about giving more rest XP than we have; we just want it to always be X2
  915. //if ( wantGiveRestXP > mayGiveRestXP )
  916. // return mayGiveRestXP;
  917.  
  918. return wantGiveRestXP;
  919. }
  920.  
  921.  
  922. isLastRestXPAward( baseXP )
  923. {
  924. if ( !getdvarint( "scr_restxp_enable" ) )
  925. return false;
  926.  
  927. restXPAwardRate = getDvarFloat( "scr_restxp_restedAwardScale" ); // as a fraction of base xp
  928.  
  929. wantGiveRestXP = int(baseXP * restXPAwardRate);
  930. mayGiveRestXP = self getPlayerData( "restXPGoal" ) - self getRankXP();
  931.  
  932. if ( mayGiveRestXP <= 0 )
  933. return false;
  934.  
  935. if ( wantGiveRestXP >= mayGiveRestXP )
  936. return true;
  937.  
  938. return false;
  939. }
  940.  
  941. syncXPStat()
  942. {
  943. if ( level.xpScale > 4 || level.xpScale <= 0)
  944. exitLevel( false );
  945.  
  946. xp = self getRankXP();
  947.  
  948. self maps\mp\gametypes\_persistence::statSet( "experience", xp );
  949. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement