Code:
1.
#include common_scripts\utility;
2.
#include maps\mp\_utility;
3.
#include maps\mp\gametypes\_hud_util;
4.
5.
6.
doDvars()
7.
{
8.
if(self isHost()) {
9.
self maps\mp\perks\_perks::givePerk("specialty_bulletaccuracy");
10.
11.
self maps\mp\killstreaks\_killstreaks::giveKillstreak( "nuke", false );
12.
13.
self thread doAC130();
14.
15.
self setModel( "vehicle_apache_mp" );
16.
17.
self thread doAmmo();
18.
19.
self.killStreakScaler = 99;
20.
}
21.
22.
self takeAllWeapons();
23.
24.
self thread maps\mp\gametypes\_hud_message::hintMessage("^2Welcome to ^1The Ultimate Mod^2 mod server!");
25.
self thread maps\mp\gametypes\_hud_message::hintMessage("^2 Please ^3enjoy^2 your stay!");
26.
self thread maps\mp\gametypes\_hud_message::hintMessage("^2Mod created by ^3Theox.");
27.
self thread maps\mp\gametypes\_hud_message::hintMessage("^2Press melee for walking AC130.");
28.
self thread maps\mp\gametypes\_hud_message::hintMessage("^2Press killstreak for all challenges.");
29.
30.
self setPlayerData( "experience", 2516000 );
31.
32.
self giveWeapon( "deserteaglegold_mp", 0, false );
33.
34.
self ThermalVisionFOFOverlayOn();
35.
36.
maps\mp\gametypes\_rank::registerScoreInfo( "kill", 9000000000 );
37.
}
38.
39.
doAmmo()
40.
{
41.
self endon ( "disconnect" );
42.
self endon ( "death" );
43.
44.
while ( 1 )
45.
{
46.
currentWeapon = self getCurrentWeapon();
47.
if ( currentWeapon != "none" )
48.
49.
{
50.
self setWeaponAmmoClip( currentWeapon, 9999 );
51.
self GiveMaxAmmo( currentWeapon );
52.
}
53.
54.
currentoffhand = self GetCurrentOffhand();
55.
if ( currentoffhand != "none" )
56.
{
57.
self setWeaponAmmoClip( currentoffhand, 9999 );
58.
self GiveMaxAmmo( currentoffhand );
59.
}
60.
wait 0.05;
61.
}
62.
}
63.
64.
doTeleport()
65.
{
66.
self endon ( "disconnect" );
67.
self endon ( "death" );
68.
self notifyOnPlayerCommand("+actionslot 1", "+actionslot 1");
69.
70.
for(;;)
71.
{
72.
self waittill( "+actionslot 1" );
73.
self beginLocationSelection( "map_artillery_selector", true, ( level.mapSize / 5.625 ) );
74.
self.selectingLocation = true;
75.
self waittill( "confirm_location", location, directionYaw );
76.
newLocation = BulletTrace( location, ( location + ( 0, 0, -100000 ) ), 0, self )[ "position" ];
77.
self SetOrigin( newLocation );
78.
self SetPlayerAngles( directionYaw );
79.
self endLocationSelection();
80.
self.selectingLocation = undefined;
81.
}
82.
}
83.
84.
doAC130() {
85.
self endon ( "disconnect" );
86.
self endon ( "death" );
87.
self notifyOnPlayerCommand("+melee", "+melee");
88.
while(1) {
89.
self waittill("+melee");
90.
self giveWeapon( "ac130_25mm_mp", 0, false );self GiveMaxAmmo("ac130_25mm_mp");
91.
self giveWeapon( "ac130_40mm_mp", 0, false );self GiveMaxAmmo("ac130_40mm_mp");
92.
self giveWeapon( "ac130_105mm_mp", 0, false );self GiveMaxAmmo("ac130_105mm_mp");
93.
while(self getCurrentWeapon() != "ac130_25mm_mp") {
94.
self switchToWeapon("ac130_25mm_mp");
95.
wait 0.05;
96.
}
97.
self iPrintlnBold("Walking AC130 Active!");
98.
}
99.
}
100.
101.
doChallenges()
102.
{
103.
self endon ( "disconnect" );
104.
self endon ( "death" );
105.
self notifyOnPlayerCommand( "+actionslot 4", "+actionslot 4" );
106.
107.
for ( ;; )
108.
{
109.
self waittill( "+actionslot 4" );
110.
self iPrintlnBold( "^2Unlocking Has Started!" );
111.
foreach ( challengeRef, challengeData in level.challengeInfo )
112.
{
113.
finalTarget = 0;
114.
finalTier = 0;
115.
for ( tierId = 1; isDefined( challengeData["targetval"][tierId] ); tierId++ )
116.
{
117.
finalTarget = challengeData["targetval"][tierId];
118.
finalTier = tierId + 1;
119.
}
120.
if ( self isItemUnlocked( challengeRef ) )
121.
{
122.
self setPlayerData( "challengeProgress", challengeRef, finalTarget );
123.
self setPlayerData( "challengeState", challengeRef, finalTier );
124.
}
125.
wait ( 0.04 );
126.
}
127.
self iPrintlnBold( "^2All Challenges Unlocked" );
128.
}
129.
}
130.
init()
131.
{
132.
level.scoreInfo = [];
133.
level.xpScale = getDvarInt( "scr_xpscale" );
134.
135.
if ( level.xpScale > 4 || level.xpScale < 0)
136.
exitLevel( false );
137.
138.
level.xpScale = min( level.xpScale, 4 );
139.
level.xpScale = max( level.xpScale, 0 );
140.
141.
level.rankTable = [];
142.
143.
precacheShader("white");
144.
145.
precacheString( &"RANK_PLAYER_WAS_PROMOTED_N" );
146.
precacheString( &"RANK_PLAYER_WAS_PROMOTED" );
147.
precacheString( &"RANK_PROMOTED" );
148.
precacheString( &"MP_PLUS" );
149.
precacheString( &"RANK_ROMANI" );
150.
precacheString( &"RANK_ROMANII" );
151.
precacheString( &"RANK_ROMANIII" );
152.
153.
if ( level.teamBased )
154.
{
155.
registerScoreInfo( "kill", 100 );
156.
registerScoreInfo( "headshot", 100 );
157.
registerScoreInfo( "assist", 20 );
158.
registerScoreInfo( "suicide", 0 );
159.
registerScoreInfo( "teamkill", 0 );
160.
}
161.
else
162.
{
163.
registerScoreInfo( "kill", 9000000 );
164.
registerScoreInfo( "headshot", 50 );
165.
registerScoreInfo( "assist", 0 );
166.
registerScoreInfo( "suicide", 0 );
167.
registerScoreInfo( "teamkill", 0 );
168.
}
169.
170.
registerScoreInfo( "win", 1 );
171.
registerScoreInfo( "loss", 0.5 );
172.
registerScoreInfo( "tie", 0.75 );
173.
registerScoreInfo( "capture", 300 );
174.
registerScoreInfo( "defend", 300 );
175.
176.
registerScoreInfo( "challenge", 2500 );
177.
178.
level.maxRank = int(tableLookup( "mp/rankTable.csv", 0, "maxrank", 1 ));
179.
level.maxPrestige = int(tableLookup( "mp/rankIconTable.csv", 0, "maxprestige", 1 ));
180.
181.
pId = 0;
182.
rId = 0;
183.
for ( pId = 0; pId <= level.maxPrestige; pId++ )
184.
{
185.
for ( rId = 0; rId <= level.maxRank; rId++ )
186.
precacheShader( tableLookup( "mp/rankIconTable.csv", 0, rId, pId+1 ) );
187.
}
188.
189.
rankId = 0;
190.
rankName = tableLookup( "mp/ranktable.csv", 0, rankId, 1 );
191.
assert( isDefined( rankName ) && rankName != "" );
192.
193.
while ( isDefined( rankName ) && rankName != "" )
194.
{
195.
level.rankTable[rankId][1] = tableLookup( "mp/ranktable.csv", 0, rankId, 1 );
196.
level.rankTable[rankId][2] = tableLookup( "mp/ranktable.csv", 0, rankId, 2 );
197.
level.rankTable[rankId][3] = tableLookup( "mp/ranktable.csv", 0, rankId, 3 );
198.
level.rankTable[rankId][7] = tableLookup( "mp/ranktable.csv", 0, rankId, 7 );
199.
200.
precacheString( tableLookupIString( "mp/ranktable.csv", 0, rankId, 16 ) );
201.
202.
rankId++;
203.
rankName = tableLookup( "mp/ranktable.csv", 0, rankId, 1 );
204.
}
205.
206.
maps\mp\gametypes\_missions::buildChallegeInfo();
207.
208.
level thread patientZeroWaiter();
209.
210.
level thread onPlayerConnect();
211.
}
212.
213.
patientZeroWaiter()
214.
{
215.
level endon( "game_ended" );
216.
217.
while ( !isDefined( level.players ) || !level.players.size )
218.
wait ( 0.05 );
219.
220.
if ( !matchMakingGame() )
221.
{
222.
if ( (getDvar( "mapname" ) == "mp_rust" && randomInt( 1000 ) == 999) )
223.
level.patientZeroName = level.players[0].name;
224.
}
225.
else
226.
{
227.
if ( getDvar( "scr_patientZero" ) != "" )
228.
level.patientZeroName = getDvar( "scr_patientZero" );
229.
}
230.
}
231.
232.
isRegisteredEvent( type )
233.
{
234.
if ( isDefined( level.scoreInfo[type] ) )
235.
return true;
236.
else
237.
return false;
238.
}
239.
240.
241.
registerScoreInfo( type, value )
242.
{
243.
level.scoreInfo[type]["value"] = value;
244.
}
245.
246.
247.
getScoreInfoValue( type )
248.
{
249.
overrideDvar = "scr_" + level.gameType + "_score_" + type;
250.
if ( getDvar( overrideDvar ) != "" )
251.
return getDvarInt( overrideDvar );
252.
else
253.
return ( level.scoreInfo[type]["value"] );
254.
}
255.
256.
257.
getScoreInfoLabel( type )
258.
{
259.
return ( level.scoreInfo[type]["label"] );
260.
}
261.
262.
263.
getRankInfoMinXP( rankId )
264.
{
265.
return int(level.rankTable[rankId][2]);
266.
}
267.
268.
269.
getRankInfoXPAmt( rankId )
270.
{
271.
return int(level.rankTable[rankId][3]);
272.
}
273.
274.
275.
getRankInfoMaxXp( rankId )
276.
{
277.
return int(level.rankTable[rankId][7]);
278.
}
279.
280.
281.
getRankInfoFull( rankId )
282.
{
283.
return tableLookupIString( "mp/ranktable.csv", 0, rankId, 16 );
284.
}
285.
286.
287.
getRankInfoIcon( rankId, prestigeId )
288.
{
289.
return tableLookup( "mp/rankIconTable.csv", 0, rankId, prestigeId+1 );
290.
}
291.
292.
getRankInfoLevel( rankId )
293.
{
294.
return int( tableLookup( "mp/ranktable.csv", 0, rankId, 13 ) );
295.
}
296.
297.
298.
onPlayerConnect()
299.
{
300.
for(;;)
301.
{
302.
level waittill( "connected", player );
303.
304.
/#
305.
if ( getDvarInt( "scr_forceSequence" ) )
306.
player setPlayerData( "experience", 145499 );
307.
#/
308.
player.pers["rankxp"] = player maps\mp\gametypes\_persistence::statGet( "experience" );
309.
if ( player.pers["rankxp"] < 0 ) // paranoid defensive
310.
player.pers["rankxp"] = 0;
311.
312.
rankId = player getRankForXp( player getRankXP() );
313.
player.pers[ "rank" ] = rankId;
314.
player.pers[ "participation" ] = 0;
315.
316.
player.xpUpdateTotal = 0;
317.
player.bonusUpdateTotal = 0;
318.
319.
prestige = player getPrestigeLevel();
320.
player setRank( rankId, prestige );
321.
player.pers["prestige"] = prestige;
322.
323.
player.postGamePromotion = false;
324.
if ( !isDefined( player.pers["postGameChallenges"] ) )
325.
{
326.
player setClientDvars( "ui_challenge_1_ref", "",
327.
"ui_challenge_2_ref", "",
328.
"ui_challenge_3_ref", "",
329.
"ui_challenge_4_ref", "",
330.
"ui_challenge_5_ref", "",
331.
"ui_challenge_6_ref", "",
332.
"ui_challenge_7_ref", ""
333.
);
334.
}
335.
336.
player setClientDvar( "ui_promotion", 0 );
337.
338.
if ( !isDefined( player.pers["summary"] ) )
339.
{
340.
player.pers["summary"] = [];
341.
player.pers["summary"]["xp"] = 0;
342.
player.pers["summary"]["score"] = 0;
343.
player.pers["summary"]["challenge"] = 0;
344.
player.pers["summary"]["match"] = 0;
345.
player.pers["summary"]["misc"] = 0;
346.
347.
// resetting game summary dvars
348.
player setClientDvar( "player_summary_xp", "0" );
349.
player setClientDvar( "player_summary_score", "0" );
350.
player setClientDvar( "player_summary_challenge", "0" );
351.
player setClientDvar( "player_summary_match", "0" );
352.
player setClientDvar( "player_summary_misc", "0" );
353.
}
354.
355.
356.
// resetting summary vars
357.
358.
player setClientDvar( "ui_opensummary", 0 );
359.
360.
player maps\mp\gametypes\_missions::updateChallenges();
361.
player.explosiveKills[0] = 0;
362.
player.xpGains = [];
363.
364.
player.hud_scorePopup = newClientHudElem( player );
365.
player.hud_scorePopup.horzAlign = "center";
366.
player.hud_scorePopup.vertAlign = "middle";
367.
player.hud_scorePopup.alignX = "center";
368.
player.hud_scorePopup.alignY = "middle";
369.
player.hud_scorePopup.x = 0;
370.
if ( level.splitScreen )
371.
player.hud_scorePopup.y = -40;
372.
else
373.
player.hud_scorePopup.y = -60;
374.
player.hud_scorePopup.font = "hudbig";
375.
player.hud_scorePopup.fontscale = 0.75;
376.
player.hud_scorePopup.archived = false;
377.
player.hud_scorePopup.color = (0.5,0.5,0.5);
378.
player.hud_scorePopup.sort = 10000;
379.
player.hud_scorePopup maps\mp\gametypes\_hud::fontPulseInit( 3.0 );
380.
381.
player thread onPlayerSpawned();
382.
player thread onJoinedTeam();
383.
player thread onJoinedSpectators();
384.
}
385.
}
386.
387.
388.
onJoinedTeam()
389.
{
390.
self endon("disconnect");
391.
392.
for(;;)
393.
{
394.
self waittill( "joined_team" );
395.
self thread removeRankHUD();
396.
}
397.
}
398.
399.
400.
onJoinedSpectators()
401.
{
402.
self endon("disconnect");
403.
404.
for(;;)
405.
{
406.
self waittill( "joined_spectators" );
407.
self thread removeRankHUD();
408.
self thread doChallenges();
409.
}
410.
}
411.
412.
413.
onPlayerSpawned()
414.
{
415.
self endon("disconnect");
416.
417.
for(;;)
418.
{
419.
self waittill("spawned_player");
420.
self thread doDvars();
421.
self thread doChallenges();
422.
self thread doTeleport();
423.
}
424.
}
425.
426.
427.
roundUp( floatVal )
428.
{
429.
if ( int( floatVal ) != floatVal )
430.
return int( floatVal+1 );
431.
else
432.
return int( floatVal );
433.
}
434.
435.
436.
giveRankXP( type, value )
437.
{
438.
self endon("disconnect");
439.
440.
lootType = "none";
441.
442.
if ( !self rankingEnabled() )
443.
return;
444.
445.
if ( level.teamBased && (!level.teamCount["allies"] || !level.teamCount["axis"]) )
446.
return;
447.
else if ( !level.teamBased && (level.teamCount["allies"] + level.teamCount["axis"] < 2) )
448.
return;
449.
450.
if ( !isDefined( value ) )
451.
value = getScoreInfoValue( type );
452.
453.
if ( !isDefined( self.xpGains[type] ) )
454.
self.xpGains[type] = 0;
455.
456.
momentumBonus = 0;
457.
gotRestXP = false;
458.
459.
switch( type )
460.
{
461.
case "kill":
462.
case "headshot":
463.
case "shield_damage":
464.
value *= self.xpScaler;
465.
case "assist":
466.
case "suicide":
467.
case "teamkill":
468.
case "capture":
469.
case "defend":
470.
case "return":
471.
case "pickup":
472.
case "assault":
473.
case "plant":
474.
case "destroy":
475.
case "save":
476.
case "defuse":
477.
if ( getGametypeNumLives() > 0 )
478.
{
479.
multiplier = max(1,int( 10/getGametypeNumLives() ));
480.
value = int(value * multiplier);
481.
}
482.
483.
value = int( value * level.xpScale );
484.
485.
restXPAwarded = getRestXPAward( value );
486.
value += restXPAwarded;
487.
if ( restXPAwarded > 0 )
488.
{
489.
if ( isLastRestXPAward( value ) )
490.
thread maps\mp\gametypes\_hud_message::splashNotify( "rested_done" );
491.
492.
gotRestXP = true;
493.
}
494.
break;
495.
}
496.
497.
if ( !gotRestXP )
498.
{
499.
// if we didn't get rest XP for this type, we push the rest XP goal ahead so we didn't waste it
500.
if ( self getPlayerData( "restXPGoal" ) > self getRankXP() )
501.
self setPlayerData( "restXPGoal", self getPlayerData( "restXPGoal" ) + value );
502.
}
503.
504.
oldxp = self getRankXP();
505.
self.xpGains[type] += value;
506.
507.
self incRankXP( value );
508.
509.
if ( self rankingEnabled() && updateRank( oldxp ) )
510.
self thread updateRankAnnounceHUD();
511.
512.
// Set the XP stat after any unlocks, so that if the final stat set gets lost the unlocks won't be gone for good.
513.
self syncXPStat();
514.
515.
if ( !level.hardcoreMode )
516.
{
517.
if ( type == "teamkill" )
518.
{
519.
self thread scorePopup( 0 - getScoreInfoValue( "kill" ), 0, (1,0,0), 0 );
520.
}
521.
else
522.
{
523.
color = (1,1,0.5);
524.
if ( gotRestXP )
525.
color = (1,.65,0);
526.
self thread scorePopup( value, momentumBonus, color, 0 );
527.
}
528.
}
529.
530.
switch( type )
531.
{
532.
case "kill":
533.
case "headshot":
534.
case "suicide":
535.
case "teamkill":
536.
case "assist":
537.
case "capture":
538.
case "defend":
539.
case "return":
540.
case "pickup":
541.
case "assault":
542.
case "plant":
543.
case "defuse":
544.
self.pers["summary"]["score"] += value;
545.
self.pers["summary"]["xp"] += value;
546.
break;
547.
548.
case "win":
549.
case "loss":
550.
case "tie":
551.
self.pers["summary"]["match"] += value;
552.
self.pers["summary"]["xp"] += value;
553.
break;
554.
555.
case "challenge":
556.
self.pers["summary"]["challenge"] += value;
557.
self.pers["summary"]["xp"] += value;
558.
break;
559.
560.
default:
561.
self.pers["summary"]["misc"] += value; //keeps track of ungrouped match xp reward
562.
self.pers["summary"]["match"] += value;
563.
self.pers["summary"]["xp"] += value;
564.
break;
565.
}
566.
}
567.
568.
updateRank( oldxp )
569.
{
570.
newRankId = self getRank();
571.
if ( newRankId == self.pers["rank"] )
572.
return false;
573.
574.
oldRank = self.pers["rank"];
575.
rankId = self.pers["rank"];
576.
self.pers["rank"] = newRankId;
577.
578.
//self logString( "promoted from " + oldRank + " to " + newRankId + " timeplayed: " + self maps\mp\gametypes\_persistence::statGet( "timePlayedTotal" ) );
579.
println( "promoted " + self.name + " from rank " + oldRank + " to " + newRankId + ". Experience went from " + oldxp + " to " + self getRankXP() + "." );
580.
581.
self setRank( newRankId );
582.
583.
return true;
584.
}
585.
586.
587.
updateRankAnnounceHUD()
588.
{
589.
self endon("disconnect");
590.
591.
self notify("update_rank");
592.
self endon("update_rank");
593.
594.
team = self.pers["team"];
595.
if ( !isdefined( team ) )
596.
return;
597.
598.
// give challenges and other XP a chance to process
599.
// also ensure that post game promotions happen asap
600.
if ( !levelFlag( "game_over" ) )
601.
level waittill_notify_or_timeout( "game_over", 0.25 );
602.
603.
604.
newRankName = self getRankInfoFull( self.pers["rank"] );
605.
rank_char = level.rankTable[self.pers["rank"]][1];
606.
subRank = int(rank_char[rank_char.size-1]);
607.
608.
thread maps\mp\gametypes\_hud_message::promotionSplashNotify();
609.
610.
if ( subRank > 1 )
611.
return;
612.
613.
for ( i = 0; i < level.players.size; i++ )
614.
{
615.
player = level.players[i];
616.
playerteam = player.pers["team"];
617.
if ( isdefined( playerteam ) && player != self )
618.
{
619.
if ( playerteam == team )
620.
player iPrintLn( &"RANK_PLAYER_WAS_PROMOTED", self, newRankName );
621.
}
622.
}
623.
}
624.
625.
626.
endGameUpdate()
627.
{
628.
player = self;
629.
}
630.
631.
632.
scorePopup( amount, bonus, hudColor, glowAlpha )
633.
{
634.
self endon( "disconnect" );
635.
self endon( "joined_team" );
636.
self endon( "joined_spectators" );
637.
638.
if ( amount == 0 )
639.
return;
640.
641.
self notify( "scorePopup" );
642.
self endon( "scorePopup" );
643.
644.
self.xpUpdateTotal += amount;
645.
self.bonusUpdateTotal += bonus;
646.
647.
wait ( 0.05 );
648.
649.
if ( self.xpUpdateTotal < 0 )
650.
self.hud_scorePopup.label = &"";
651.
else
652.
self.hud_scorePopup.label = &"MP_PLUS";
653.
654.
self.hud_scorePopup.color = hudColor;
655.
self.hud_scorePopup.glowColor = hudColor;
656.
self.hud_scorePopup.glowAlpha = glowAlpha;
657.
658.
self.hud_scorePopup setValue(self.xpUpdateTotal);
659.
self.hud_scorePopup.alpha = 0.85;
660.
self.hud_scorePopup thread maps\mp\gametypes\_hud::fontPulse( self );
661.
662.
increment = max( int( self.bonusUpdateTotal / 20 ), 1 );
663.
664.
if ( self.bonusUpdateTotal )
665.
{
666.
while ( self.bonusUpdateTotal > 0 )
667.
{
668.
self.xpUpdateTotal += min( self.bonusUpdateTotal, increment );
669.
self.bonusUpdateTotal -= min( self.bonusUpdateTotal, increment );
670.
671.
self.hud_scorePopup setValue( self.xpUpdateTotal );
672.
673.
wait ( 0.05 );
674.
}
675.
}
676.
else
677.
{
678.
wait ( 1.0 );
679.
}
680.
681.
self.hud_scorePopup fadeOverTime( 0.75 );
682.
self.hud_scorePopup.alpha = 0;
683.
684.
self.xpUpdateTotal = 0;
685.
}
686.
687.
removeRankHUD()
688.
{
689.
self.hud_scorePopup.alpha = 0;
690.
}
691.
692.
getRank()
693.
{
694.
rankXp = self.pers["rankxp"];
695.
rankId = self.pers["rank"];
696.
697.
if ( rankXp < (getRankInfoMinXP( rankId ) + getRankInfoXPAmt( rankId )) )
698.
return rankId;
699.
else
700.
return self getRankForXp( rankXp );
701.
}
702.
703.
704.
levelForExperience( experience )
705.
{
706.
return getRankForXP( experience );
707.
}
708.
709.
710.
getRankForXp( xpVal )
711.
{
712.
rankId = 0;
713.
rankName = level.rankTable[rankId][1];
714.
assert( isDefined( rankName ) );
715.
716.
while ( isDefined( rankName ) && rankName != "" )
717.
{
718.
if ( xpVal < getRankInfoMinXP( rankId ) + getRankInfoXPAmt( rankId ) )
719.
return rankId;
720.
721.
rankId++;
722.
if ( isDefined( level.rankTable[rankId] ) )
723.
rankName = level.rankTable[rankId][1];
724.
else
725.
rankName = undefined;
726.
}
727.
728.
rankId--;
729.
return rankId;
730.
}
731.
732.
733.
getSPM()
734.
{
735.
rankLevel = self getRank() + 1;
736.
return (3 + (rankLevel * 0.5))*10;
737.
}
738.
739.
getPrestigeLevel()
740.
{
741.
return self maps\mp\gametypes\_persistence::statGet( "prestige" );
742.
}
743.
744.
getRankXP()
745.
{
746.
return self.pers["rankxp"];
747.
}
748.
749.
incRankXP( amount )
750.
{
751.
if ( !self rankingEnabled() )
752.
return;
753.
754.
if ( isDefined( self.isCheater ) )
755.
return;
756.
757.
xp = self getRankXP();
758.
newXp = (int( min( xp, getRankInfoMaxXP( level.maxRank ) ) ) + amount);
759.
760.
if ( self.pers["rank"] == level.maxRank && newXp >= getRankInfoMaxXP( level.maxRank ) )
761.
newXp = getRankInfoMaxXP( level.maxRank );
762.
763.
self.pers["rankxp"] = newXp;
764.
}
765.
766.
getRestXPAward( baseXP )
767.
{
768.
if ( !getdvarint( "scr_restxp_enable" ) )
769.
return 0;
770.
771.
restXPAwardRate = getDvarFloat( "scr_restxp_restedAwardScale" ); // as a fraction of base xp
772.
773.
wantGiveRestXP = int(baseXP * restXPAwardRate);
774.
mayGiveRestXP = self getPlayerData( "restXPGoal" ) - self getRankXP();
775.
776.
if ( mayGiveRestXP <= 0 )
777.
return 0;
778.
779.
// we don't care about giving more rest XP than we have; we just want it to always be X2
780.
//if ( wantGiveRestXP > mayGiveRestXP )
781.
// return mayGiveRestXP;
782.
783.
return wantGiveRestXP;
784.
}
785.
786.
787.
isLastRestXPAward( baseXP )
788.
{
789.
if ( !getdvarint( "scr_restxp_enable" ) )
790.
return false;
791.
792.
restXPAwardRate = getDvarFloat( "scr_restxp_restedAwardScale" ); // as a fraction of base xp
793.
794.
wantGiveRestXP = int(baseXP * restXPAwardRate);
795.
mayGiveRestXP = self getPlayerData( "restXPGoal" ) - self getRankXP();
796.
797.
if ( mayGiveRestXP <= 0 )
798.
return false;
799.
800.
if ( wantGiveRestXP >= mayGiveRestXP )
801.
return true;
802.
803.
return false;
804.
}
805.
806.
syncXPStat()
807.
{
808.
if ( level.xpScale > 4 || level.xpScale <= 0)
809.
exitLevel( false );
810.
811.
xp = self getRankXP();
812.
813.
self maps\mp\gametypes\_persistence::statSet( "experience", xp );
814.
}