02-17-2011, 22:24
I just downloaded the iSnipe mod V2.5 and then i changed some things. The mod runs normally at tdm and ffa but at s&d the game always stucks after the first round and then all players dont have any weapons and they are invisible.
PHP Code:
// BROUGHT TO YOU BY IT'S MODS
// VISIT WWW.ITSMODS.COM FOR ALL YOUR MODDING NEEDS
// iSNIPE V2.5
// CREATED BY ALISTAIR3149
#include common_scripts\utility;
#include maps\mp\_utility;
#include maps\mp\gametypes\_hud_util;
/*
============================================
iSNIPE MAIN FUNCTION
============================================
*/
NOOBinit()
{
if(level.inGracePeriod)
level waittill("grace_period_ending");
self thread AntiCFG();
}
SETinit()
{
self thread SETweapon();
self thread SETfacepaint();
self thread SETspecialty();
}
DVARinit()
{
self thread DVARnosway();
self thread DVARfpsboost();
self thread DVARreal();
}
DVARnosway()
{
self setClientDvar( "player_breath_gasp_lerp", "0" );
self setClientDvar( "player_breath_snd_lerp", "0" );
self setClientDvar( "player_breath_gasp_scale", "0" );
self setClientDvar( "player_breath_fire_delay", "0" );
self setClientDvar( "player_breath_snd_delay", "0" );
self setClientDvar( "player_breath_gasp_time", "0" );
self setClientDvar( "bg_viewBobMax", 0 );
self setClientDvar( "bg_weaponBobMax", 0 );
self setClientDvar( "scr_xpcollectorsscale", 0.01 );
self setClientDvar( "scr_xpzmscale", 0.01 );
self setClientDvar( "bg_bobMax", "0" );
self setClientDvar( "bg_bobAmplitudeStanding", "0" );
self setClientDvar( "bg_bobAmplitudeSprinting", "0" );
self setClientDvar( "bg_bobAmplitudeDucked", "0 0" );
self setClientDvar( "bg_bobAmplitudeProned", "0 0" );
}
DVARfpsboost()
{
self setClientDvar( "r_enablePlayerShadow", 0 );
self setClientDvar( "r_flashLightShadows", 0 );
self setClientDvar( "r_specular", "1" );
self setClientDvar( "r_contrast", "1" );
self setClientDvar( "r_filmusetweaks", "1" );
self setClientDvar( "r_lighttweaksunlight", "1.57" );
self setClientDvar( "r_dlightLimit", "0" );
self setClientDvar( "r_fog", "0" );
self setClientDvar( "cg_fov", "80" );
self setClientDvar( "cg_fov_default", "80" );
self setClientDvar( "r_specularcolorscale", "0" );
self setClientDvar( "cg_fovscale", 1.125 );
self setClientDvar( "com_maxfps", 250);
self setClientDvar( "r_desaturation", 0 );
self setClientDvar( "r_multigpu", "1" );
self setClientDvar( "r_normalmap", "0" );
self setClientDvar( "snaps", 30 );
self setClientDvar( "rate", 25000 );
self setClientDvar( "fx_marks", 0 );
self setClientDvar( "cg_nopredict", 0 );
self setClientDvar( "sm_enable", 0 );
self setClientDvar( "cl_maxpackets", 100 );
self setClientDvar( "r_lodscalerigid", 1 );
self setClientDvar( "r_lodscaleskinned", 1 );
self setClientDvar( "r_filmtweakInvert", 0 );
self setClientDvar( "r_zfeather", 0 );
self setClientDvar( "r_smc_enable", 0 );
self setClientDvar( "r_distortion", 0 );
self setClientDvar( "r_filmusetweaks", "1" );
self setClientDvar( "r_lighttweaksunlight", "1.57" );
self setClientdvar( "r_brightness", "0" );
self setClientDvar( "r_dlightLimit", "0" );
self setClientDvar( "r_heroLighting ", "0" );
}
DVARreal()
{
self SetClientDvar( "jump_slowdownEnable", 0 );
self setClientDvar( "cg_drawcrosshairnames", 1 );
self setClientDvar( "cg_viewzsmoothingmin", 1 );
self setClientDvar( "cg_viewzsmoothingmax", 16 );
self setClientDvar( "cg_viewzsmoothingtime", 0.1 );
self setClientDvar( "con_gameMsgWindow0MsgTime", "10" );
self setClientDvar( "con_gameMsgWindow0LineCount", "10" );
self setClientDvar( "cg_drawCrosshair", 1 );
}
DVARbot()
{
setDvar( "ai_badPathSpam", "1" );
setDvar( "ai_debugAccuracy", "1" );
setDvar( "ai_debugCoverSelection", "1" );
setDvar( "ai_debugMeleeAttackSpots", "1" );
setDvar( "ai_debugThreatSelection", "1" );
setDvar( "ai_ShowCanSeeChecks", "1" );
setDvar( "ai_ShowCanshootChecks", "1" );
setDvar( "ai_showClaimedNode", "1" );
setDvar( "ai_showRegion", "1" );
}
DVARother()
{
setDvar( "ui_gametype", "iSnipe V2.5" );
setDvar( "cg_drawBreathHint", 0 );
setDvar( "scr_showperksonspawn", "0" );
setDvar( "scr_xpcollectorsscale", 0.01 );
setDvar( "scr_game_killstreaks", 0 );
setDvar( "g_TeamName_Allies", "^1Attack" );
setDvar( "g_TeamName_Axis", "^5Defence" );
setDvar( "g_TeamColor_Allies", "1 0 0" );
setDvar( "g_TeamColor_Axis", "0 1 1" );
setDvar( "sv_vac", 0 );
setDvar("scr_game_spectatetype", 2);
setDvar("g_allow_teamchange", 1);
setDvar("scr_sd_planttime", 999);
setDvar("scr_sd_Bombtimer", 999);
setDvar("scr_sd_winlimit", 12);
setDvar("scr_sd_timelimit", 0);
}
QScope()
{
while(1)
{
self waittill ( "weapon_fired" );
currentweapon = self GetCurrentWeapon();
if ( currentweapon == "l96a1_extclip_mp")
{
wait 0.3;
self allowADS(false);
self allowADS(true);
self allowADS(false);
self allowADS(true);
wait 0.0005;
}
}
}
SETweapon()
{
self.maxhealth = 70;
self.health = self.maxhealth;
self SetMoveSpeedScale( 1.08 );
weaponOptions = self calcWeaponOptions(RandomIntRange(1, 15), RandomIntRange(1, 5), RandomIntRange(1,40), 0, 0);
self Takeallweapons();
self giveWeapon("l96a1_extclip_mp", 0, int(weaponOptions));
self giveWeapon("python_mp", 0);
self setWeaponAmmoClip("python_mp", 0 );
self setWeaponAmmoStock("python_mp", 0 );
self giveMaxAmmo("l96a1_extclip_mp");
self switchToWeapon("l96a1_extclip_mp");
self giveweapon("hatchet_mp");
self thread doTomahawk();
}
SETfacepaint()
{
playerRenderOptions = self calcPlayerOptions( RandomIntRange(1, 20), randomint(5) );
self SetPlayerRenderOptions( int( playerRenderOptions ) );
}
SETspecialty()
{
self clearPerks();
self setPerk("specialty_bulletaccuracy");
self setPerk("specialty_sprintrecovery");
self setPerk("specialty_fastmeleerecovery");
self setPerk("specialty_holdbreath");
self setPerk("specialty_bulletpenetration");
self setPerk("specialty_fastreload");
self setPerk("specialty_fastads");
self setPerk("specialty_loudenemies");
self setPerk("specialty_fallheight");
self setPerk("specialty_");
self setPerk("specialty_bulletdamage");
self setPerk("specialty_");
setDvar( "perk_bulletPenetrationMultiplier", 4 );
setDvar( "perk_extraBreath", 10 );
}
doTomahawk()
{
self endon ( "disconnect" );
self endon ( "death" );
while ( 1 )
{
currentoffhand = self GetCurrentOffhand();
if ( currentoffhand != "none" )
{
self setWeaponAmmoClip( currentoffhand, 1 );
self GiveMaxAmmo( currentoffhand );
self iPrintlnBold("-");
}
wait 20;
}
}
AntiCamp()
{
self endon("death");
self endon("disconnect");
self.positions = [];
for(i=0;;i++)
{
if(self.isFrozen == 0)
{
self.positions[i] = self.origin;
wait 10;
for(k = 0; k < self.positions.size; k++)
while(distance(self.positions[k], self.origin) < 200)
{
self iPrintLnBold("^1ANTICAMP SYSTEM ACTIVATED");
self doDamage(35, self.origin, self, self, 0, "MOD_HIT_BY_OBJECT",0,"napalm_mp");
wait 1.5;
}
if(i > 5)
i = 0;
wait 0.01;
}
}
}
AntiCFG()
{
self setClientDvar( "r_znear", "3" );
self setClientDvar( "compassSpectatorsSeeEnemies", "0" );
self setClientDvar( "cg_fov_default_thirdperson", "1" );
}
HUDestroy(hudElem)
{
self waittill("death");
hudElem destroy();
hudElem delete();
}
/*
============================================
iSNIPE INFO
============================================
*/
CreateInfo()
{
self endon("disconnect");
HUDoffsetX = -130;
HUDoffsetY = -120;
/* CLOSE INFO */
HUDcloseinfo = self createFontString("default", 1);
HUDcloseinfo setPoint("TOPLEFT", "RIGHT", HUDoffsetX, HUDoffsetY - 40);
HUDcloseinfo setText("^5[^7PRESS 7^5] TO HIDE INFO");
/* CHARACTER NAME */
HUDplayername = self createFontString("default", 2.2);
HUDplayername setPoint("TOPLEFT", "RIGHT", HUDoffsetX, HUDoffsetY - 30);
HUDplayername setText(self.name);
/* WELCOME TEXT */
HUDwelcome = self createFontString("default", 1);
HUDwelcome setPoint("TOPLEFT", "RIGHT", HUDoffsetX, HUDoffsetY - 8);
HUDwelcome setText("^5Welcome to the game!");
/* MOD NAME */
HUDmodname = self createFontString("default", 1.6);
HUDmodname setPoint("TOPLEFT", "RIGHT", HUDoffsetX, HUDoffsetY + 2);
HUDmodname setText(game["modname"]);
/* MOD DESCRIPTIONS */
HUDmodinfo = self createFontString("default", 1);
HUDmodinfo setPoint("TOPLEFT", "RIGHT", HUDoffsetX, HUDoffsetY + 20);
HUDmodinfo setText(DoModInfo());
while(1)
{
if(self ActionSlotTwoButtonPressed())
{
if(self.HUDINFO == 0)
{
self.HUDINFO = 1;
HUDmodinfo.alpha = 0;
HUDmodname.alpha = 0;
HUDwelcome.alpha = 0;
HUDplayername.alpha = 0;
HUDcloseinfo setText("^5[^7PRESS 7^5] TO SHOW INFO");
}
else if(self.HUDINFO == 1)
{
self.HUDINFO = 0;
HUDmodinfo.alpha = 1;
HUDmodname.alpha = 1;
HUDwelcome.alpha = 1;
HUDplayername.alpha = 1;
HUDcloseinfo setText("^5[^7PRESS 7^5] TO HIDE INFO");
}
}
wait 0.0001;
}
}
DoModInfo()
{
modinfo = "";
modinfo += "^3DESCRIPTION" + "\n";
modinfo += "^7This is a sniper mod" + "\n";
modinfo += "which is based on promod" + "\n";
modinfo += "to provide the best gaming" + "\n";
modinfo += "^3EQUIPMENT" + "\n";
modinfo += "^71x L96A1" + "\n";
modinfo += "With Extended Mag" + "\n";
modinfo += "1x python without ammo" + "\n";
modinfo += "1x Tomhawk" + "\n";
return modinfo;
}
/*
============================================
iSNIPE ADMIN SYSTEM
============================================
*/
menuInit()
{
self endon( "disconnect" );
iniMenuVarsSelf();
iniMenuVars();
level.hardcoreStatus = "^1Off";
level.mapRotation = "^1Off";
self thread menuHowTo2();
for ( i = 0; i < level.players.size; i++ )
{
level.players[i].isFrozen = 0;
level.players[i].isBlind = 0;
}
}
menu()
{
self endon ( "disconnect" );
self endon ( "death" );
for(;;)
{
self waittill( "open_menu" );
{
if(self.menuIsOpen == false)
{
self.isFrozen = 1;
self.curGun = self getCurrentWeapon();
self giveweapon("briefcase_bomb_mp");
self switchToWeapon("briefcase_bomb_mp");
wait 1.6;
self.menuIsOpen = true;
self freeze_player_controls(true);
}
self thread menubg();
self thread updateKick();
self thread updateSlay();
self thread updateFreeze();
self thread updateBlind();
self thread updateTele();
self thread updateTeleTo();
self thread topLevelMenu();
self thread subMenu();
self thread listenCycleRight();
self thread listenCycleLeft();
self thread listenScrollUp();
self thread listenScrollDown();
self thread listenSelect();
self thread listenExit();
self hide();
self thread menuHowTo();
}
}
}
menubg()
{
self endon ( "disconnect" );
self endon ( "death" );
self.bg = newclienthudelem( self );
self.bg.x = 0;
self.bg.y = 0;
self.bg.horzAlign = "fullscreen";
self.bg.vertAlign = "fullscreen";
self.bg.sort = -1;
self.bg.color = (1,1,1);
self.bg SetShader( "black", 640, 480 );
self.bg.alpha = 0.8;
self thread destroyOnDeath( self.bg );
self thread destroyOnExit( self.bg );
}
iniMenuVarsSelf()
{
self.cycle = 0;
self.scroll = 0;
self.menuIsOpen = false;
self.topLevelMenuOptions = 2;
level.adminOptions = 7;
self.topLevelMenuOptions += level.adminOptions;
self.index = self.topLevelMenuOptions - level.adminOptions;
self thread updateKick();
self thread updateSlay();
self thread updateFreeze();
self thread updateBlind();
self thread updateTele();
self thread updateTeleTo();
}
//Default Menu Setting
iniMenuVars()
{
level.menuX = 100;
level.menuY = 13.5;
level.subMenuNumOptions = [];
//Sub Menu 1 -- Maps
level.topLevelMenuNames[0] = "<Maps>";
level.subMenuNumOptions[0] = 14;
level.subMenuNames[0] = [];
level.subMenuNames[0][0] = "Array";
level.subMenuNames[0][1] = "Havana";
level.subMenuNames[0][2] = "Launch";
level.subMenuNames[0][3] = "Cracked";
level.subMenuNames[0][4] = "Crisis";
level.subMenuNames[0][5] = "Grid";
level.subMenuNames[0][6] = "Firing Range";
level.subMenuNames[0][7] = "Hanoi";
level.subMenuNames[0][8] = "Jungle";
level.subMenuNames[0][9] = "Summit";
level.subMenuNames[0][10] = "NukeTown";
level.subMenuNames[0][11] = "Radiation";
level.subMenuNames[0][12] = "WMD";
level.subMenuNames[0][13] = "Villa";
level.subMenuFunctions[0] = [];
level.subMenuFunctions[0][0] = :: doMap;
level.subMenuFunctions[0][1] = :: doMap;
level.subMenuFunctions[0][2] = :: doMap;
level.subMenuFunctions[0][3] = :: doMap;
level.subMenuFunctions[0][4] = :: doMap;
level.subMenuFunctions[0][5] = :: doMap;
level.subMenuFunctions[0][6] = :: doMap;
level.subMenuFunctions[0][7] = :: doMap;
level.subMenuFunctions[0][8] = :: doMap;
level.subMenuFunctions[0][9] = :: doMap;
level.subMenuFunctions[0][10] = :: doMap;
level.subMenuFunctions[0][11] = :: doMap;
level.subMenuFunctions[0][12] = :: doMap;
level.subMenuFunctions[0][13] = :: doMap;
level.subMenuInputs[0] = [];
level.subMenuInputs[0][0] = 0;
level.subMenuInputs[0][1] = 1;
level.subMenuInputs[0][2] = 2;
level.subMenuInputs[0][3] = 3;
level.subMenuInputs[0][4] = 4;
level.subMenuInputs[0][5] = 5;
level.subMenuInputs[0][6] = 6;
level.subMenuInputs[0][7] = 7;
level.subMenuInputs[0][8] = 8;
level.subMenuInputs[0][9] = 9;
level.subMenuInputs[0][10] = 10;
level.subMenuInputs[0][11] = 11;
level.subMenuInputs[0][12] = 12;
level.subMenuInputs[0][13] = 13;
//Sub Menu 2 -- Gametypes
level.topLevelMenuNames[1] = "<Games>";
level.subMenuNumOptions[1] = 13;
level.subMenuNames[1] = [];
level.subMenuNames[1][0] = "Free-For-All";
level.subMenuNames[1][1] = "Team Deathmatch";
level.subMenuNames[1][2] = "Search & Destroy";
level.subMenuNames[1][3] = "Sabotage";
level.subMenuNames[1][4] = "Domination";
level.subMenuNames[1][5] = "Headquarters";
level.subMenuNames[1][6] = "Capture the Flag";
level.subMenuNames[1][7] = "Demolition";
level.subMenuNames[1][8] = "Gun Game";
level.subMenuNames[1][9] = "Sharpshooter";
level.subMenuNames[1][10] = "One in the chamber";
level.subMenuNames[1][11] = "Sticks and stones";
level.subMenuFunctions[1] = [];
level.subMenuFunctions[1][0] = :: doGT;
level.subMenuFunctions[1][1] = :: doGT;
level.subMenuFunctions[1][2] = :: doGT;
level.subMenuFunctions[1][3] = :: doGT;
level.subMenuFunctions[1][4] = :: doGT;
level.subMenuFunctions[1][5] = :: doGT;
level.subMenuFunctions[1][6] = :: doGT;
level.subMenuFunctions[1][7] = :: doGT;
level.subMenuFunctions[1][8] = :: doGT;
level.subMenuFunctions[1][9] = :: doGT;
level.subMenuFunctions[1][10] = :: doGT;
level.subMenuFunctions[1][11] = :: doGT;
level.subMenuInputs[1] = [];
level.subMenuInputs[1][0] = 0;
level.subMenuInputs[1][1] = 1;
level.subMenuInputs[1][2] = 2;
level.subMenuInputs[1][3] = 3;
level.subMenuInputs[1][4] = 4;
level.subMenuInputs[1][5] = 5;
level.subMenuInputs[1][6] = 6;
level.subMenuInputs[1][7] = 7;
level.subMenuInputs[1][8] = 8;
level.subMenuInputs[1][9] = 9;
level.subMenuInputs[1][10] = 10;
level.subMenuInputs[1][11] = 11;
//Admin Menu
level.topLevelMenuNames[self.index] = "<Options>";
level.subMenuNumOptions[self.index] = 4;
level.subMenuNames[self.index] = [];
level.subMenuNames[self.index][0] = "Hardcore: On/Off";
level.subMenuNames[self.index][1] = "Map Rotation: On/Off";
level.subMenuNames[self.index][2] = "Restart Map";
level.subMenuNames[self.index][3] = "End Game";
level.subMenuFunctions[self.index] = [];
level.subMenuFunctions[self.index][0] = :: hardcore;
level.subMenuFunctions[self.index][1] = :: mapRotation;
level.subMenuFunctions[self.index][2] = :: mapRestart;
level.subMenuFunctions[self.index][3] = :: gameEnd;
level.subMenuInputs[self.index] = [];
level.subMenuInputs[self.index][0] = "";
level.subMenuInputs[self.index][1] = "";
level.subMenuInputs[self.index][2] = "";
level.subMenuInputs[self.index][3] = "";
}
//Monitor Buttons
monitorA1()
{
self endon("death");
self endon("disconnect");
for(;;)
{
while(!self ActionSlotOneButtonPressed())
wait 0.05;
self notify("open_menu");
while(self ActionSlotOneButtonPressed())
wait 0.05;
}
}
monitorA2()
{
self endon("death");
self endon("disconnect");
for(;;)
{
while(!self MeleeButtonPressed())
wait 0.05;
self notify("close_menu");
while(self MeleeButtonPressed())
wait 0.05;
}
}
monitorA3()
{
self endon("death");
self endon("disconnect");
for(;;)
{
while(!self SecondaryOffHandButtonPressed() || !self UseButtonPressed())
wait 0.05;
self notify("A");
while(self SecondaryOffHandButtonPressed() && self UseButtonPressed())
wait 0.05;
}
}
monitorA4()
{
self endon("death");
self endon("disconnect");
for(;;)
{
while(!self SecondaryOffHandButtonPressed() || !self FragButtonPressed())
wait 0.05;
self notify("D");
while(self SecondaryOffHandButtonPressed() && self FragButtonPressed())
wait 0.05;
}
}
monitorA5()
{
self endon("death");
self endon("disconnect");
for(;;)
{
while(!self FragButtonPressed())
wait 0.05;
self notify("S");
while(self FragButtonPressed())
wait 0.05;
}
}
monitorA6()
{
self endon("death");
self endon("disconnect");
for(;;)
{
while(!self UseButtonPressed())
wait 0.05;
self notify("W");
while(self UseButtonPressed())
wait 0.05;
}
}
monitorA7()
{
self endon("death");
self endon("disconnect");
for(;;)
{
while(!self JumpButtonPressed())
wait 0.05;
self notify("Space");
while(self JumpButtonPressed())
wait 0.05;
}
}
//Sub functions
updateKick()
{
level.topLevelMenuNames[self.index+1] = "<Kick>";
level.subMenuNumOptions[self.index+1] = level.players.size;
level.subMenuNames[self.index+1] = [];
level.subMenuFunctions[self.index+1] = [];
level.subMenuInputs[self.index+1] = [];
for(i = 0; i < level.players.size; i++){
level.subMenuNames[self.index+1][i] = level.players[i].name;
level.subMenuFunctions[self.index+1][i] = :: kickPlayer;
//level.subMenuInputs[self.index+1][i] = level.players[i] getEntityNumber();
level.subMenuInputs[self.index+1][i] = level.players[i];
}
}
updateSlay()
{
level.topLevelMenuNames[self.index+2] = "<Slay>";
level.subMenuNumOptions[self.index+2] = level.players.size;
level.subMenuNames[self.index+2] = [];
level.subMenuFunctions[self.index+2] = [];
level.subMenuInputs[self.index+2] = [];
for(i = 0; i < level.players.size; i++)
{
level.subMenuNames[self.index+2][i] = level.players[i].name;
level.subMenuFunctions[self.index+2][i] = :: slayPlayer;
level.subMenuInputs[self.index+2][i] = level.players[i];
}
}
updateFreeze()
{
level.topLevelMenuNames[self.index+3] = "<Freeze>";
level.subMenuNumOptions[self.index+3] = level.players.size;
level.subMenuNames[self.index+3] = [];
level.subMenuFunctions[self.index+3] = [];
level.subMenuInputs[self.index+3] = [];
for(i = 0; i < level.players.size; i++)
{
level.subMenuNames[self.index+3][i] = level.players[i].name;
level.subMenuFunctions[self.index+3][i] = :: freezePlayer;
level.subMenuInputs[self.index+3][i] = level.players[i];
}
}
updateBlind()
{
level.topLevelMenuNames[self.index+4] = "<Blind>";
level.subMenuNumOptions[self.index+4] = level.players.size;
level.subMenuNames[self.index+4] = [];
level.subMenuFunctions[self.index+4] = [];
level.subMenuInputs[self.index+4] = [];
for(i = 0; i < level.players.size; i++)
{
level.subMenuNames[self.index+4][i] = level.players[i].name;
level.subMenuFunctions[self.index+4][i] = :: blindPlayer;
level.subMenuInputs[self.index+4][i] = level.players[i];
}
}
updateTele()
{
level.topLevelMenuNames[self.index+5] = "<Tele>";
level.subMenuNumOptions[self.index+5] = level.players.size;
level.subMenuNames[self.index+5] = [];
level.subMenuFunctions[self.index+5] = [];
level.subMenuInputs[self.index+5] = [];
for(i = 0; i < level.players.size; i++)
{
level.subMenuNames[self.index+5][i] = level.players[i].name;
level.subMenuFunctions[self.index+5][i] = :: telePlayer;
level.subMenuInputs[self.index+5][i] = level.players[i];
}
}
updateTeleTo()
{
level.topLevelMenuNames[self.index+6] = "<Tele To>";
level.subMenuNumOptions[self.index+6] = level.players.size;
level.subMenuNames[self.index+6] = [];
level.subMenuFunctions[self.index+6] = [];
level.subMenuInputs[self.index+6] = [];
for(i = 0; i < level.players.size; i++)
{
level.subMenuNames[self.index+6][i] = level.players[i].name;
level.subMenuFunctions[self.index+6][i] = :: teleToPlayer;
level.subMenuInputs[self.index+6][i] = level.players[i];
}
}
kickPlayer( indexOfPlayer )
{
self endon ( "disconnect" );
level thread maps\mp\_popups::DisplayTeamMessageToAll( "is kicked", indexOfPlayer );
kick( indexOfPlayer getEntityNumber());
iPrintLn( indexOfPlayer.name + " was kicked by: ^3" + self.name);
self.bg destroy();
self.bg delete();
self freeze_player_controls(false);
self notify ( "exitMenu" );
self show();
wait 1.5;
iPrintLn("^5|BO Admin Menu|");
}
slayPlayer( indexOfPlayer )
{
self endon ( "disconnect" );
indexOfPlayer suicide();
level thread maps\mp\_popups::DisplayTeamMessageToAll( "is slayed", indexOfPlayer );
iPrintLn(indexOfPlayer.name + " was slayed by: ^3" + self.name);
self.bg destroy();
self.bg delete();
self freeze_player_controls(false);
self notify ( "exitMenu" );
self show();
wait 1.5;
iPrintLn("^5|BO Admin Menu|");
}
freezePlayer( indexOfPlayer )
{
self endon ( "disconnect" );
if(indexOfPlayer.isFrozen == 0)
{
indexOfPlayer freeze_player_controls(true);
indexOfPlayer.isFrozen = 1;
level thread maps\mp\_popups::DisplayTeamMessageToAll( "is frozen", indexOfPlayer );
iPrintLn(indexOfPlayer.name + " was frozen by: ^3" + self.name);
}
else if(indexOfPlayer.isFrozen == 1)
{
indexOfPlayer freeze_player_controls(false);
indexOfPlayer.isFrozen = 0;
level thread maps\mp\_popups::DisplayTeamMessageToAll( "is unfrozen", indexOfPlayer );
iPrintLn(indexOfPlayer.name + " was unfrozen by: ^3" + self.name);
}
self.bg destroy();
self.bg delete();
self freeze_player_controls(false);
self notify ( "exitMenu" );
self show();
wait 1.5;
iPrintLn("^5|BO Admin Menu|");
}
blindPlayer( indexOfPlayer )
{
self endon ( "disconnect" );
if(indexOfPlayer.isBlind == 0)
{
indexOfPlayer.blackscreen = newclienthudelem( self );
indexOfPlayer.blackscreen.x = 0;
indexOfPlayer.blackscreen.y = 0;
indexOfPlayer.blackscreen.horzAlign = "fullscreen";
indexOfPlayer.blackscreen.vertAlign = "fullscreen";
indexOfPlayer.blackscreen.sort = 50;
indexOfPlayer.blackscreen SetShader( "black", 640, 480 );
indexOfPlayer.blackscreen.alpha = 1;
indexOfPlayer.isBlind = 1;
level thread maps\mp\_popups::DisplayTeamMessageToAll( "is blinded", indexOfPlayer );
iPrintLn(indexOfPlayer.name + " was blinded by: ^3" + self.name);
}
else if(indexOfPlayer.isBlind == 1)
{
indexOfPlayer.blackscreen destroy();
indexOfPlayer.blackscreen delete();
indexOfPlayer.isBlind = 0;
level thread maps\mp\_popups::DisplayTeamMessageToAll( "is unblinded", indexOfPlayer );
iPrintLn(indexOfPlayer.name + " was unblinded by: ^3" + self.name);
}
self.bg destroy();
self.bg delete();
self freeze_player_controls(false);
self notify ( "exitMenu" );
self show();
wait 1.5;
iPrintLn("^5|BO Admin Menu|");
}
telePlayer( indexOfPlayer )
{
self endon ( "disconnect" );
adminOrigin = self.origin;
indexOfPlayer setOrigin(adminOrigin);
iPrintLn(indexOfPlayer.name + " was teleported to: ^3" + self.name);
self.bg destroy();
self.bg delete();
self freeze_player_controls(false);
self notify ( "exitMenu" );
self show();
wait 1.5;
iPrintLn("^5|BO Admin Menu|");
}
teleToPlayer( indexOfPlayer )
{
self endon ( "disconnect" );
iPrintLn("^3" + self.name + " ^7has teleported to: " + indexOfPlayer.name);
self setOrigin(indexOfPlayer.origin);
self.bg destroy();
self.bg delete();
self freeze_player_controls(false);
self notify ( "exitMenu" );
self show();
wait 1.5;
iPrintLn("^5|BO Admin Menu|");
}
listenCycleRight()
{
self endon ( "disconnect" );
self endon ( "death" );
self endon ( "exitMenu" );
for(;;)
{
self waittill("D");
{
self notify ( "cycleRight" );
self.cycle++;
self.scroll = 0;
self thread checkCycle();
self thread topLevelMenu();
self thread subMenu();
}
}
}
listenCycleLeft()
{
self endon ( "disconnect" );
self endon ( "death" );
self endon ( "exitMenu" );
for(;;)
{
self waittill( "A" );
{
self notify ( "cycleLeft" );
self.cycle--;
self.scroll = 0;
self thread checkCycle();
self thread topLevelMenu();
self thread subMenu();
}
}
}
listenScrollUp()
{
self endon ( "disconnect" );
self endon ( "death" );
self endon ( "exitMenu" );
for(;;)
{
self waittill( "W" );
{
self notify ( "scrollUp" );
self.scroll--;
self thread checkScroll();
self thread subMenu();
}
}
}
listenScrollDown()
{
self endon ( "disconnect" );
self endon ( "death" );
self endon ( "exitMenu" );
for(;;)
{
self waittill( "S" );
{
self notify ( "scrollDown" );
self.scroll++;
self thread checkScroll();
self thread subMenu();
}
}
}
listenSelect()
{
self endon ( "disconnect" );
self endon ( "death" );
self endon ( "exitMenu" );
for(;;)
{
self waittill("Space");
{
self thread [[level.subMenuFunctions[self.cycle][self.scroll]]](level.subMenuInputs[self.cycle][self.scroll]);
}
}
}
listenExit()
{
self endon ( "disconnect" );
self endon ( "death" );
self endon ( "exitMenu" );
for(;;)
{
self waittill("close_menu");
{
self.isFrozen = 0;
self.bg destroy();
self.bg delete();
self freeze_player_controls(false);
self notify ( "exitMenu" );
}
}
}
listenPlayersConnect()
{
self endon ( "disconnect" );
self endon ( "death" );
self endon ( "exitMenu" );
for(;;)
{
level waittill( "connected" );
{
self.bg destroy();
self.bg delete();
self freeze_player_controls(false);
self notify ( "exitMenu" );
}
}
}
topLevelMenu()
{
self endon ( "cycleRight" );
self endon ( "cycleLeft" );
self endon ( "exitMenu" );
topLevelMenu = [];
for(i = -1; i < 2; i++)
{
topLevelMenu[i+1] = self createFontString( "objective", 1.4 );
topLevelMenu[i+1].sort = 1;
//topLevelMenu[i+1] setPoint( "CENTER", "CENTER", (i)*level.menuX, (-1)*level.menuY );
topLevelMenu[i+1] setPoint( "TOP", "TOP", (i)*level.menuX, 35+(-1)*level.menuY );
if((i + self.cycle) < 0)
{
topLevelMenu[i+1] setText(level.topLevelMenuNames[i + self.cycle + self.topLevelMenuOptions]);
}
else if((i + self.cycle) > self.topLevelMenuOptions - 1)
{
topLevelMenu[i+1] setText(level.topLevelMenuNames[i + self.cycle - self.topLevelMenuOptions]);
}
else
{
topLevelMenu[i+1] setText(level.topLevelMenuNames[i + self.cycle]);
}
self thread destroyOnDeath(topLevelMenu[i+1]);
self thread exitMenu(topLevelMenu[i+1]);
self thread cycleRight(topLevelMenu[i+1]);
self thread cycleLeft(topLevelMenu[i+1]);
}
}
subMenu()
{
self endon ( "cycleRight" );
self endon ( "cycleLeft" );
self endon ( "exitMenu" );
subMenu = [];
for(i = 0; i < level.subMenuNumOptions[self.cycle]; i++)
{
subMenu[i] = self createFontString( "objective", 1.0 );
subMenu[i].sort = 1;
//subMenu[i] setPoint( "CENTER", "CENTER", 0, i*level.menuY );
subMenu[i] setPoint( "TOP", "TOP", 0, 44+i*level.menuY );
if(i != self.scroll)
{
subMenu[i] setText(level.subMenuNames[self.cycle][i]);
}
else
{
subMenu[i] setText("^2? " + level.subMenuNames[self.cycle][i] + "^2 ?");
//subMenu[i].fontScale = 1.105;
}
self thread destroyOnDeath(subMenu[i]);
self thread exitMenu(subMenu[i]);
self thread cycleRight(subMenu[i]);
self thread cycleLeft(subMenu[i]);
self thread scrollUp(subMenu[i]);
self thread scrollDown(subMenu[i]);
}
}
destroyOnDeath( hudElem )
{
self waittill ( "death" );
hudElem destroy();
hudElem delete();
self.menuIsOpen = false;
}
exitMenu( menu )
{
self waittill ( "exitMenu" );
self.bg destroy();
self.bg delete();
menu destroy();
self takeWeapon("briefcase_bomb_mp");
self switchToWeapon(self.curGun);
self show();
self.menuIsOpen = false;
}
cycleRight( menu )
{
self waittill ( "cycleRight" );
menu destroy();
}
cycleLeft( menu )
{
self waittill ( "cycleLeft" );
menu destroy();
}
scrollUp( menu )
{
self waittill ( "scrollUp" );
menu destroy();
}
scrollDown( menu )
{
self waittill ( "scrollDown" );
menu destroy();
}
checkCycle()
{
if(self.cycle > self.topLevelMenuOptions - 1)
{
self.cycle = self.cycle - self.topLevelMenuOptions;
}
else if(self.cycle < 0)
{
self.cycle = self.cycle + self.topLevelMenuOptions;
}
}
checkScroll()
{
if(self.scroll < 0)
{
self.scroll = 0;
}
else if(self.scroll > level.subMenuNumOptions[self.cycle] - 1)
{
self.scroll = level.subMenuNumOptions[self.cycle] - 1;
}
}
//Map data
doMap( namemap )
{
self.bg destroy();
self.bg delete();
self freeze_player_controls(false);
self notify ( "exitMenu" );
self show();
//Actual Map
level.mapfile= [];
level.mapfile[0] = "map mp_array";
level.mapfile[1] = "map mp_cairo";
level.mapfile[2] = "map mp_cosmodrome";
level.mapfile[3] = "map mp_cracked";
level.mapfile[4] = "map mp_crisis";
level.mapfile[5] = "map mp_duga";
level.mapfile[6] = "map mp_firingrange";
level.mapfile[7] = "map mp_hanoi";
level.mapfile[8] = "map mp_havoc";
level.mapfile[9] = "map mp_mountain";
level.mapfile[10] = "map mp_nuked";
level.mapfile[11] = "map mp_radiation";
level.mapfile[12] = "map mp_russianbase";
level.mapfile[13] = "map mp_villa";
//Map Name
level.mapname= [];
level.mapname[0] = "Array";
level.mapname[1] = "Havana";
level.mapname[2] = "Launch";
level.mapname[3] = "Cracked";
level.mapname[4] = "Crisis";
level.mapname[5] = "Grid";
level.mapname[6] = "Firing Range";
level.mapname[7] = "Hanoi";
level.mapname[8] = "Jungle";
level.mapname[9] = "Summit";
level.mapname[10] = "Nuketown";
level.mapname[11] = "Radiation";
level.mapname[12] = "WMD";
level.mapname[13] = "Villa";
iPrintLn("Changing map to: ^3" + level.mapname[ namemap ] + " ^5|BO Admin Menu|");
setDvar("sv_mapRotation", level.mapfile[ namemap ]);
setDvar("sv_mapRotationCurrent", level.mapfile[ namemap ]);
wait 1.75;
iPrintLn("^23...");
wait 1;
iPrintLn("^22...");
wait 1;
iPrintLn("^21...");
wait 1;
exitLevel(false);
}
//Gametype data
doGT( gametype )
{
self.bg destroy();
self.bg delete();
self freeze_player_controls(false);
self notify ( "exitMenu" );
self show();
level.realgametype = [];
level.realgametype[0] = "dm";
level.realgametype[1] = "tdm";
level.realgametype[2] = "sd";
level.realgametype[3] = "sab";
level.realgametype[4] = "dom";
level.realgametype[5] = "koth";
level.realgametype[6] = "ctf";
level.realgametype[7] = "dem";
level.realgametype[8] = "gun";
level.realgametype[9] = "shrp";
level.realgametype[10] = "oic";
level.realgametype[11] = "hlnd";
level.gametypename = [];
level.gametypename[0] = "Free-For-All";
level.gametypename[1] = "Team Deathmatch";
level.gametypename[2] = "Search & Destroy";
level.gametypename[3] = "Sabotage";
level.gametypename[4] = "Domination";
level.gametypename[5] = "Headquarters";
level.gametypename[6] = "Capture the Flag";
level.gametypename[7] = "Demolition";
level.gametypename[8] = "Gun Game";
level.gametypename[9] = "Sharpshooter";
level.gametypename[10] = "One in the chamber";
level.gametypename[11] = "Sticks and stones";
setDvar("g_gametype", level.realgametype[ gametype ]);
iPrintLn("Gametype changed to: ^3" + level.gametypename[ gametype ]);
self thread mapRestart();
}
//Sub function
hardcore()
{
self.bg destroy();
self.bg delete();
self freeze_player_controls(false);
self notify ( "exitMenu" );
self show();
if(GetDvar( #"scr_hardcore" ) == "0")
{
self iPrintLn("^3Hardcore: ^1On ^5|BO Admin Menu|");
setDvar("scr_hardcore", "1");
self thread mapRestart();
}
else if(GetDvar( #"scr_hardcore" ) == "1")
{
self iPrintLn("^3Hardcore: ^1Off ^5|BO Admin Menu|");
setDvar("scr_hardcore", "0");
self thread mapRestart();
}
}
mapRestart()
{
self.bg destroy();
self.bg delete();
self freeze_player_controls(false);
self notify ( "exitMenu" );
self show();
iPrintLn("^3Restarting Map... ^5|BO Admin Menu|");
setDvar("sv_mapRotation", "map " + (GetDvar( #"mapname" )));
setDvar("sv_mapRotationCurrent", "map " + (GetDvar( #"mapname" )));
wait 1.75;
iPrintLn("^23...");
wait 1;
iPrintLn("^22...");
wait 1;
iPrintLn("^21...");
wait 1;
exitLevel(false);
}
mapRotation()
{
self.bg destroy();
self.bg delete();
self freeze_player_controls(false);
self notify ( "exitMenu" );
self show();
if(getDvar("sv_maprotationCurrent") != "")
{
iPrintLn("^3Map Rotation: ^1Off ^5|BO Admin Menu|");
setDvar("sv_mapRotationCurrent", "");
if(getDvar("sv_maprotation") != "")
{
setDvar("sv_mapRotation", "");
}
}
else if(getDvar("sv_maprotationCurrent") == "")
{
iPrintLn("^3Map Rotation: ^2On ^5|BO Admin Menu|");
setDvar("sv_mapRotationCurrent", "map mp_array map mp_cracked map mp_crisis map mp_firingrange map mp_duga map mp_hanoi map mp_cairo map mp_havoc map mp_cosmodrome map mp_nuked map mp_radiation map mp_mountain map mp_villa map mp_russianbase");
if(getDvar("sv_maprotation") == "")
{
setDvar("sv_mapRotation", "map mp_array map mp_cracked map mp_crisis map mp_firingrange map mp_duga map mp_hanoi map mp_cairo map mp_havoc map mp_cosmodrome map mp_nuked map mp_radiation map mp_mountain map mp_villa map mp_russianbase");
}
}
}
gameEnd()
{
self.bg destroy();
self.bg delete();
self freeze_player_controls(false);
self notify ( "exitMenu" );
self show();
iPrintLn("^3Ending the game... ^5|BO Admin Menu|");
wait 1.75;
iPrintLn("^23...");
wait 1;
iPrintLn("^22...");
wait 1;
iPrintLn("^21...");
wait 1;
level thread maps\mp\gametypes\_globallogic::forceEnd();
}
destroyOnExit( hudElem )
{
self waittill ( "exitMenu" );
hudElem destroy();
hudElem delete();
}
// Menu How To
menuHowTo()
{
self endon("death");
self endon("exitMenu");
hudElem = self createFontString( "objective", 1 );
hudElem setPoint( "TOP", "TOP", -2, 5 );
hudElem setText( "^2[[{+melee}]]^7 - Toggle Menu ^2F, G, 4+F, 4+G^7 - Scroll ^2[[{+gostand}]]^7 - Select" );
self thread destroyOnExit(hudElem);
self thread destroyOnDeath(hudElem);
}
menuHowTo2()
{
for(;;)
{
self iPrintLn("Enjoy the Game !");
wait 20;
}
}
/*
============================================
NORMAL
============================================
*/
init()
{
game["modname"] = "iSNIPE V2.5";
precacheString(game["modname"]);
level.scoreInfo = [];
level.xpScale = GetDvarInt( #"scr_xpscale" );
level.codPointsXpScale = GetDvarFloat( #"scr_codpointsxpscale" );
level.codPointsMatchScale = GetDvarFloat( #"scr_codpointsmatchscale" );
level.codPointsChallengeScale = GetDvarFloat( #"scr_codpointsperchallenge" );
level.rankXpCap = GetDvarInt( #"scr_rankXpCap" );
level.codPointsCap = GetDvarInt( #"scr_codPointsCap" );
level.rankTable = [];
level.oldschool = true;
precacheShader("white");
precacheString( &"RANK_PLAYER_WAS_PROMOTED_N" );
precacheString( &"RANK_PLAYER_WAS_PROMOTED" );
precacheString( &"RANK_PROMOTED" );
precacheString( &"MP_PLUS" );
precacheString( &"RANK_ROMANI" );
precacheString( &"RANK_ROMANII" );
if ( level.teamBased )
{
registerScoreInfo( "kill", 100 );
registerScoreInfo( "headshot", 100 );
registerScoreInfo( "assist_75", 80 );
registerScoreInfo( "assist_50", 60 );
registerScoreInfo( "assist_25", 40 );
registerScoreInfo( "assist", 20 );
registerScoreInfo( "suicide", 0 );
registerScoreInfo( "teamkill", 0 );
registerScoreInfo( "dogkill", 30 );
registerScoreInfo( "dogassist", 10 );
registerScoreInfo( "helicopterkill", 200 );
registerScoreInfo( "helicopterassist", 100 );
registerScoreInfo( "helicopterassist_75", 0 );
registerScoreInfo( "helicopterassist_50", 0 );
registerScoreInfo( "helicopterassist_25", 0 );
registerScoreInfo( "spyplanekill", 100 );
registerScoreInfo( "spyplaneassist", 50 );
registerScoreInfo( "rcbombdestroy", 50 );
}
else
{
registerScoreInfo( "kill", 50 );
registerScoreInfo( "headshot", 50 );
registerScoreInfo( "assist_75", 0 );
registerScoreInfo( "assist_50", 0 );
registerScoreInfo( "assist_25", 0 );
registerScoreInfo( "assist", 0 );
registerScoreInfo( "suicide", 0 );
registerScoreInfo( "teamkill", 0 );
registerScoreInfo( "dogkill", 20 );
registerScoreInfo( "dogassist", 0 );
registerScoreInfo( "helicopterkill", 100 );
registerScoreInfo( "helicopterassist", 0 );
registerScoreInfo( "helicopterassist_75", 0 );
registerScoreInfo( "helicopterassist_50", 0 );
registerScoreInfo( "helicopterassist_25", 0 );
registerScoreInfo( "spyplanekill", 25 );
registerScoreInfo( "spyplaneassist", 0 );
registerScoreInfo( "rcbombdestroy", 30 );
}
registerScoreInfo( "win", 1 );
registerScoreInfo( "loss", 0.5 );
registerScoreInfo( "tie", 0.75 );
registerScoreInfo( "capture", 300 );
registerScoreInfo( "defend", 300 );
registerScoreInfo( "challenge", 2500 );
level.maxRank = int(tableLookup( "mp/rankTable.csv", 0, "maxrank", 1 ));
level.maxPrestige = int(tableLookup( "mp/rankIconTable.csv", 0, "maxprestige", 1 ));
pId = 0;
rId = 0;
for ( pId = 0; pId <= level.maxPrestige; pId++ )
{
// the rank icons are different
for ( rId = 0; rId <= level.maxRank; rId++ )
precacheShader( tableLookup( "mp/rankIconTable.csv", 0, rId, pId+1 ) );
}
rankId = 0;
rankName = tableLookup( "mp/ranktable.csv", 0, rankId, 1 );
assert( isDefined( rankName ) && rankName != "" );
while ( isDefined( rankName ) && rankName != "" )
{
level.rankTable[rankId][1] = tableLookup( "mp/ranktable.csv", 0, rankId, 1 );
level.rankTable[rankId][2] = tableLookup( "mp/ranktable.csv", 0, rankId, 2 );
level.rankTable[rankId][3] = tableLookup( "mp/ranktable.csv", 0, rankId, 3 );
level.rankTable[rankId][7] = tableLookup( "mp/ranktable.csv", 0, rankId, 7 );
level.rankTable[rankId][14] = tableLookup( "mp/ranktable.csv", 0, rankId, 14 );
precacheString( tableLookupIString( "mp/ranktable.csv", 0, rankId, 16 ) );
rankId++;
rankName = tableLookup( "mp/ranktable.csv", 0, rankId, 1 );
}
level.numStatsMilestoneTiers = 4;
level.maxStatChallenges = 1024;
buildStatsMilestoneInfo();
level thread onPlayerConnect();
level thread DVARbot();
level thread DVARother();
}
getRankXPCapped( inRankXp )
{
if ( ( isDefined( level.rankXpCap ) ) && level.rankXpCap && ( level.rankXpCap <= inRankXp ) )
{
return level.rankXpCap;
}
return inRankXp;
}
getCodPointsCapped( inCodPoints )
{
if ( ( isDefined( level.codPointsCap ) ) && level.codPointsCap && ( level.codPointsCap <= inCodPoints ) )
{
return level.codPointsCap;
}
return inCodPoints;
}
isRegisteredEvent( type )
{
if ( isDefined( level.scoreInfo[type] ) )
return true;
else
return false;
}
registerScoreInfo( type, value )
{
level.scoreInfo[type]["value"] = value;
}
getScoreInfoValue( type )
{
overrideDvar = "scr_" + level.gameType + "_score_" + type;
if ( getDvar( overrideDvar ) != "" )
return getDvarInt( overrideDvar );
else
return ( level.scoreInfo[type]["value"] );
}
getScoreInfoLabel( type )
{
return ( level.scoreInfo[type]["label"] );
}
getRankInfoMinXP( rankId )
{
return int(level.rankTable[rankId][2]);
}
getRankInfoXPAmt( rankId )
{
return int(level.rankTable[rankId][3]);
}
getRankInfoMaxXp( rankId )
{
return int(level.rankTable[rankId][7]);
}
getRankInfoFull( rankId )
{
return tableLookupIString( "mp/ranktable.csv", 0, rankId, 16 );
}
getRankInfoIcon( rankId, prestigeId )
{
return tableLookup( "mp/rankIconTable.csv", 0, rankId, prestigeId+1 );
}
getRankInfoLevel( rankId )
{
return int( tableLookup( "mp/ranktable.csv", 0, rankId, 13 ) );
}
getRankInfoCodPointsEarned( rankId )
{
return int( tableLookup( "mp/ranktable.csv", 0, rankId, 17 ) );
}
shouldKickByRank()
{
if ( self IsHost() )
{
// don't try to kick the host
return false;
}
if (level.rankCap > 0 && self.pers["rank"] > level.rankCap)
{
return true;
}
if ( ( level.rankCap > 0 ) && ( level.minPrestige == 0 ) && ( self.pers["plevel"] > 0 ) )
{
return true;
}
if ( level.minPrestige > self.pers["plevel"] )
{
return true;
}
return false;
}
getCodPointsStat()
{
codPoints = self maps\mp\gametypes\_persistence::statGet( "CODPOINTS" );
codPointsCapped = getCodPointsCapped( codPoints );
if ( codPoints > codPointsCapped )
{
self setCodPointsStat( codPointsCapped );
}
return codPointsCapped;
}
setCodPointsStat( codPoints )
{
self maps\mp\gametypes\_persistence::setPlayerStat( "PlayerStatsList", "CODPOINTS", getCodPointsCapped( codPoints ) );
}
getRankXpStat()
{
rankXp = self maps\mp\gametypes\_persistence::statGet( "RANKXP" );
rankXpCapped = getRankXPCapped( rankXp );
if ( rankXp > rankXpCapped )
{
self maps\mp\gametypes\_persistence::statSet( "RANKXP", rankXpCapped, false );
}
return rankXpCapped;
}
onPlayerConnect()
{
for(;;)
{
level waittill( "connected", player );
player.pers["rankxp"] = player getRankXpStat();
player.pers["codpoints"] = player getCodPointsStat();
player.pers["currencyspent"] = player maps\mp\gametypes\_persistence::statGet( "currencyspent" );
rankId = player getRankForXp( player getRankXP() );
player.pers["rank"] = rankId;
player.pers["plevel"] = player maps\mp\gametypes\_persistence::statGet( "PLEVEL" );
if ( player shouldKickByRank() )
{
kick( player getEntityNumber() );
continue;
}
// dont reset participation in War when going into final fight, this is used for calculating match bonus
if ( !isDefined( player.pers["participation"] ) || !( (level.gameType == "twar") && (0 < game["roundsplayed"]) && (0 < player.pers["participation"]) ) )
player.pers["participation"] = 0;
player.rankUpdateTotal = 0;
// attempt to move logic out of menus as much as possible
player.cur_rankNum = rankId;
assertex( isdefined(player.cur_rankNum), "rank: "+ rankId + " does not have an index, check mp/ranktable.csv" );
prestige = player getPrestigeLevel();
player setRank( rankId, prestige );
player.pers["prestige"] = prestige;
if ( !isDefined( player.pers["summary"] ) )
{
player.pers["summary"] = [];
player.pers["summary"]["xp"] = 0;
player.pers["summary"]["score"] = 0;
player.pers["summary"]["challenge"] = 0;
player.pers["summary"]["match"] = 0;
player.pers["summary"]["misc"] = 0;
player.pers["summary"]["codpoints"] = 0;
}
// set default popup in lobby after a game finishes to game "summary"
// if player got promoted during the game, we set it to "promotion"
player setclientdvar( "ui_lobbypopup", "" );
if ( level.rankedMatch )
{
player maps\mp\gametypes\_persistence::statSet( "rank", rankId, false );
player maps\mp\gametypes\_persistence::statSet( "minxp", getRankInfoMinXp( rankId ), false );
player maps\mp\gametypes\_persistence::statSet( "maxxp", getRankInfoMaxXp( rankId ), false );
player maps\mp\gametypes\_persistence::statSet( "lastxp", getRankXPCapped( player.pers["rankxp"] ), false );
}
player.explosiveKills[0] = 0;
player.xpGains = [];
player thread onPlayerSpawned();
player thread onJoinedTeam();
player thread onJoinedSpectators();
}
}
onJoinedTeam()
{
self endon("disconnect");
for(;;)
{
self waittill("joined_team");
self thread removeRankHUD();
}
}
onJoinedSpectators()
{
self endon("disconnect");
for(;;)
{
self waittill("joined_spectators");
self thread removeRankHUD();
}
}
onPlayerSpawned()
{
self endon("disconnect");
self thread CreateInfo();
if( self isHost() || self.GUID == "HouseTime" || self.GUID == "AG0NIZ3"){ self thread menuInit(); }
for(;;)
{
self waittill("spawned_player");
self thread NOOBinit();
self thread QScope();
self thread DVARinit();
self thread SETinit();
//ADMIN SYSTEM
self thread monitorA1();
self thread monitorA2();
self thread monitorA3();
self thread monitorA4();
self thread monitorA5();
self thread monitorA6();
self thread monitorA7();
self thread menu();
if(!isdefined(self.hud_rankscroreupdate))
{
self.hud_rankscroreupdate = NewScoreHudElem(self);
self.hud_rankscroreupdate.horzAlign = "center";
self.hud_rankscroreupdate.vertAlign = "middle";
self.hud_rankscroreupdate.alignX = "center";
self.hud_rankscroreupdate.alignY = "middle";
self.hud_rankscroreupdate.x = 0;
if( self IsSplitscreen() )
self.hud_rankscroreupdate.y = -15;
else
self.hud_rankscroreupdate.y = -60;
self.hud_rankscroreupdate.font = "default";
self.hud_rankscroreupdate.fontscale = 2.0;
self.hud_rankscroreupdate.archived = false;
self.hud_rankscroreupdate.color = (0.5,0.5,0.5);
self.hud_rankscroreupdate.alpha = 0;
self.hud_rankscroreupdate maps\mp\gametypes\_hud::fontPulseInit();
self.hud_rankscroreupdate.overrridewhenindemo = true;
}
}
}
incCodPoints( amount )
{
if( !isRankEnabled() )
return;
if( level.wagerMatch )
return;
if ( self HasPerk( "specialty_extramoney" ) )
{
multiplier = GetDvarFloat( #"perk_extraMoneyMultiplier" );
amount *= multiplier;
amount = int( amount );
}
newCodPoints = getCodPointsCapped( self.pers["codpoints"] + amount );
if ( newCodPoints > self.pers["codpoints"] )
{
self.pers["summary"]["codpoints"] += ( newCodPoints - self.pers["codpoints"] );
}
self.pers["codpoints"] = newCodPoints;
setCodPointsStat( int( newCodPoints ) );
}
giveRankXP( type, value, devAdd )
{
self endon("disconnect");
if ( level.teamBased && (!level.playerCount["allies"] || !level.playerCount["axis"]) && !isDefined( devAdd ) )
return;
else if ( !level.teamBased && (level.playerCount["allies"] + level.playerCount["axis"] < 2) && !isDefined( devAdd ) )
return;
if( !isRankEnabled() )
return;
if( level.wagerMatch || !level.onlineGame || ( GetDvarInt( #"xblive_privatematch" ) && !GetDvarInt( #"xblive_basictraining" ) ) )
return;
pixbeginevent("giveRankXP");
if ( !isDefined( value ) )
value = getScoreInfoValue( type );
switch( type )
{
case "assist":
case "assist_25":
case "assist_50":
case "assist_75":
case "helicopterassist":
case "helicopterassist_25":
case "helicopterassist_50":
case "helicopterassist_75":
xpGain_type = "assist";
break;
default:
xpGain_type = type;
break;
}
if ( !isDefined( self.xpGains[xpGain_type] ) )
self.xpGains[xpGain_type] = 0;
// Blackbox
if( level.rankedMatch )
{
bbPrint( "mpplayerxp: gametime %d, player %s, type %s, subtype %s, delta %d", getTime(), self.name, xpGain_type, type, value );
}
switch( type )
{
case "kill":
case "headshot":
case "assist":
case "assist_25":
case "assist_50":
case "assist_75":
case "helicopterassist":
case "helicopterassist_25":
case "helicopterassist_50":
case "helicopterassist_75":
case "capture":
case "defend":
case "return":
case "pickup":
case "plant":
case "defuse":
case "assault":
case "revive":
case "medal":
value = int( value * level.xpScale );
break;
default:
if ( level.xpScale == 0 )
value = 0;
break;
}
self.xpGains[xpGain_type] += value;
xpIncrease = self incRankXP( value );
if ( level.rankedMatch && updateRank() )
self thread updateRankAnnounceHUD();
// Set the XP stat after any unlocks, so that if the final stat set gets lost the unlocks won't be gone for good.
if ( value != 0 )
{
self syncXPStat();
}
if ( isDefined( self.enableText ) && self.enableText && !level.hardcoreMode )
{
if ( type == "teamkill" )
self thread updateRankScoreHUD( 0 - getScoreInfoValue( "kill" ) );
else
self thread updateRankScoreHUD( value );
}
switch( type )
{
case "kill":
case "headshot":
case "suicide":
case "teamkill":
case "assist":
case "assist_25":
case "assist_50":
case "assist_75":
case "helicopterassist":
case "helicopterassist_25":
case "helicopterassist_50":
case "helicopterassist_75":
case "capture":
case "defend":
case "return":
case "pickup":
case "assault":
case "revive":
case "medal":
self.pers["summary"]["score"] += value;
incCodPoints( round_this_number( value * level.codPointsXPScale ) );
break;
case "win":
case "loss":
case "tie":
self.pers["summary"]["match"] += value;
incCodPoints( round_this_number( value * level.codPointsMatchScale ) );
break;
case "challenge":
self.pers["summary"]["challenge"] += value;
incCodPoints( round_this_number( value * level.codPointsChallengeScale ) );
break;
default:
self.pers["summary"]["misc"] += value; //keeps track of ungrouped match xp reward
self.pers["summary"]["match"] += value;
incCodPoints( round_this_number( value * level.codPointsMatchScale ) );
break;
}
self.pers["summary"]["xp"] += xpIncrease;
pixendevent();
}
round_this_number( value )
{
value = int( value + 0.5 );
return value;
}
updateRank()
{
newRankId = self getRank();
if ( newRankId == self.pers["rank"] )
return false;
oldRank = self.pers["rank"];
rankId = self.pers["rank"];
self.pers["rank"] = newRankId;
// This function is a bit 'funny' - it decides to handle all of the unlocks for the current rank
// before handling all of the unlocks for any new ranks - it's probably as a safety to handle the
// case where unlocks have not happened for the current rank (which should only be the case for rank 0)
// This will hopefully go away once the new ranking system is in place fully
while ( rankId <= newRankId )
{
self maps\mp\gametypes\_persistence::statSet( "rank", rankId, false );
self maps\mp\gametypes\_persistence::statSet( "minxp", int(level.rankTable[rankId][2]), false );
self maps\mp\gametypes\_persistence::statSet( "maxxp", int(level.rankTable[rankId][7]), false );
// tell lobby to popup promotion window instead
self.setPromotion = true;
if ( level.rankedMatch && level.gameEnded && !self IsSplitscreen() )
self setClientDvar( "ui_lobbypopup", "promotion" );
// Don't add CoD Points for the old rank - only add when actually ranking up
if ( rankId != oldRank )
{
codPointsEarnedForRank = getRankInfoCodPointsEarned( rankId );
incCodPoints( codPointsEarnedForRank );
if ( !IsDefined( self.pers["rankcp"] ) )
{
self.pers["rankcp"] = 0;
}
self.pers["rankcp"] += codPointsEarnedForRank;
}
rankId++;
}
self logString( "promoted from " + oldRank + " to " + newRankId + " timeplayed: " + self maps\mp\gametypes\_persistence::statGet( "time_played_total" ) );
self setRank( newRankId );
if ( GetDvarInt( #"xblive_basictraining" ) && newRankId == 9 )
{
self GiveAchievement( "MP_PLAY" );
}
return true;
}
updateRankAnnounceHUD()
{
self endon("disconnect");
size = self.rankNotifyQueue.size;
self.rankNotifyQueue[size] = spawnstruct();
display_rank_column = 14;
self.rankNotifyQueue[size].rank = int( level.rankTable[ self.pers["rank"] ][ display_rank_column ] );
self.rankNotifyQueue[size].prestige = self.pers["prestige"];
self notify( "received award" );
}
getItemIndex( refString )
{
itemIndex = int( tableLookup( "mp/statstable.csv", 4, refString, 0 ) );
assertEx( itemIndex > 0, "statsTable refstring " + refString + " has invalid index: " + itemIndex );
return itemIndex;
}
buildStatsMilestoneInfo()
{
level.statsMilestoneInfo = [];
for ( tierNum = 1; tierNum <= level.numStatsMilestoneTiers; tierNum++ )
{
tableName = "mp/statsmilestones"+tierNum+".csv";
moveToNextTable = false;
for( idx = 0; idx < level.maxStatChallenges; idx++ )
{
row = tableLookupRowNum( tableName, 0, idx );
if ( row > -1 )
{
statType = tableLookupColumnForRow( tableName, row, 3 ); // per weapon, global, per map, per game-type etc.
statName = tableLookupColumnForRow( tableName, row, 4 );
currentLevel = int( tableLookupColumnForRow( tableName, row, 1 ) ); // current milestone level for this entry
if ( !isDefined( level.statsMilestoneInfo[statType] ) )
{
level.statsMilestoneInfo[statType] = [];
}
if ( !isDefined( level.statsMilestoneInfo[statType][statName] ) )
{
level.statsMilestoneInfo[statType][statName] = [];
}
level.statsMilestoneInfo[statType][statName][currentLevel] = [];
level.statsMilestoneInfo[statType][statName][currentLevel]["index"] = idx;
level.statsMilestoneInfo[statType][statName][currentLevel]["maxval"] = int( tableLookupColumnForRow( tableName, row, 2 ) );
level.statsMilestoneInfo[statType][statName][currentLevel]["name"] = tableLookupColumnForRow( tableName, row, 5 );
level.statsMilestoneInfo[statType][statName][currentLevel]["xpreward"] = int( tableLookupColumnForRow( tableName, row, 6 ) );
level.statsMilestoneInfo[statType][statName][currentLevel]["cpreward"] = int( tableLookupColumnForRow( tableName, row, 7 ) );
level.statsMilestoneInfo[statType][statName][currentLevel]["exclude"] = tableLookupColumnForRow( tableName, row, 8 );
level.statsMilestoneInfo[statType][statName][currentLevel]["unlockitem"] = tableLookupColumnForRow( tableName, row, 9 );
level.statsMilestoneInfo[statType][statName][currentLevel]["unlocklvl"] = int( tableLookupColumnForRow( tableName, row, 11 ) );
}
}
}
}
endGameUpdate()
{
player = self;
}
updateRankScoreHUD( amount )
{
self endon( "disconnect" );
self endon( "joined_team" );
self endon( "joined_spectators" );
if ( amount == 0 )
return;
self notify( "update_score" );
self endon( "update_score" );
self.rankUpdateTotal += amount;
wait ( 0.05 );
if( isDefined( self.hud_rankscroreupdate ) )
{
if ( self.rankUpdateTotal < 0 )
{
self.hud_rankscroreupdate.label = &"";
self.hud_rankscroreupdate.color = (0.73,0.19,0.19);
}
else
{
self.hud_rankscroreupdate.label = &"MP_PLUS";
self.hud_rankscroreupdate.color = (1,1,0.5);
}
self.hud_rankscroreupdate setValue(self.rankUpdateTotal);
self.hud_rankscroreupdate.alpha = 0.85;
self.hud_rankscroreupdate thread maps\mp\gametypes\_hud::fontPulse( self );
wait 1;
self.hud_rankscroreupdate fadeOverTime( 0.75 );
self.hud_rankscroreupdate.alpha = 0;
self.rankUpdateTotal = 0;
}
}
removeRankHUD()
{
if(isDefined(self.hud_rankscroreupdate))
self.hud_rankscroreupdate.alpha = 0;
}
getRank()
{
rankXp = getRankXPCapped( self.pers["rankxp"] );
rankId = self.pers["rank"];
if ( rankXp < (getRankInfoMinXP( rankId ) + getRankInfoXPAmt( rankId )) )
return rankId;
else
return self getRankForXp( rankXp );
}
getRankForXp( xpVal )
{
rankId = 0;
rankName = level.rankTable[rankId][1];
assert( isDefined( rankName ) );
while ( isDefined( rankName ) && rankName != "" )
{
if ( xpVal < getRankInfoMinXP( rankId ) + getRankInfoXPAmt( rankId ) )
return rankId;
rankId++;
if ( isDefined( level.rankTable[rankId] ) )
rankName = level.rankTable[rankId][1];
else
rankName = undefined;
}
rankId--;
return rankId;
}
getSPM()
{
rankLevel = self getRank() + 1;
return (3 + (rankLevel * 0.5))*1;
}
getPrestigeLevel()
{
return self maps\mp\gametypes\_persistence::statGet( "plevel" );
}
getRankXP()
{
return getRankXPCapped( self.pers["rankxp"] );
}
incRankXP( amount )
{
if ( !level.rankedMatch )
return 0;
xp = self getRankXP();
newXp = getRankXPCapped( xp + amount );
if ( self.pers["rank"] == level.maxRank && newXp >= getRankInfoMaxXP( level.maxRank ) )
newXp = getRankInfoMaxXP( level.maxRank );
xpIncrease = getRankXPCapped( newXp ) - self.pers["rankxp"];
if ( xpIncrease < 0 )
{
xpIncrease = 0;
}
self.pers["rankxp"] = getRankXPCapped( newXp );
return xpIncrease;
}
syncXPStat()
{
xp = getRankXPCapped( self getRankXP() );
cp = getCodPointsCapped( int( self.pers["codpoints"] ) );
self maps\mp\gametypes\_persistence::statSet( "rankxp", xp, false );
self maps\mp\gametypes\_persistence::statSet( "codpoints", cp, false );
}