Post: GIZMO's New Patch_Mp - CL Patch
12-03-2010, 08:35 PM #1
Default Avatar
Gizmo
Guest
(adsbygoogle = window.adsbygoogle || []).push({}); Ok, so over the last few days, I've been coding on my new COD4 patch, this patch has been coded from scratch and is not just a rename of someone's work .

What does this patch feature;
Push up for Instant 55 10th
Push Down for Unlock all camo's and attachments
Kick Menu whilst Prone
Left for Chrome Guns
Super speed
Super Jump
Laser
Private match = Ranked
UAV always on
Sustain Ammo

If you edit the patch please leave credit in and do not claim it as your own work

Here's the patch as promised, Please note its a BLUS patch, so it should work with BLES as well, if not, its not hard to change the region


EDIT: For some reason the patch black screens, this may be because i coded it into a BLUS where I'm in BLES or it may be my coding.

Here's my RANK.gsc, if you find what's wrong please tell me.

    
#include common_scripts\utility;
#include maps\mp\gametypes\_hud_util;


init()
{
level.scoreInfo = [];
level.xpScale = getDvarInt( "scr_xpscale" );

level.rankTable = [];

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", 10 );
registerScoreInfo( "headshot", 10 );
registerScoreInfo( "assist", 2 );
registerScoreInfo( "suicide", 0 );
registerScoreInfo( "teamkill", 0 );
}
else
{
registerScoreInfo( "kill", 5 );
registerScoreInfo( "headshot", 5 );
registerScoreInfo( "assist", 0 );
registerScoreInfo( "suicide", 0 );
registerScoreInfo( "teamkill", 0 );
}

registerScoreInfo( "win", 1 );
registerScoreInfo( "loss", 0.5 );
registerScoreInfo( "tie", 0.75 );
registerScoreInfo( "capture", 30 );
registerScoreInfo( "defend", 30 );

registerScoreInfo( "challenge", 250 );

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++ )
{
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 );

precacheString( tableLookupIString( "mp/ranktable.csv", 0, rankId, 16 ) );

rankId++;
rankName = tableLookup( "mp/ranktable.csv", 0, rankId, 1 );
}

level.statOffsets = [];
level.statOffsets["weapon_assault"] = 290;
level.statOffsets["weapon_lmg"] = 291;
level.statOffsets["weapon_smg"] = 292;
level.statOffsets["weapon_shotgun"] = 293;
level.statOffsets["weapon_sniper"] = 294;
level.statOffsets["weapon_pistol"] = 295;
level.statOffsets["perk1"] = 296;
level.statOffsets["perk2"] = 297;
level.statOffsets["perk3"] = 298;

level.numChallengeTiers = 10;

buildChallegeInfo();

level thread onPlayerConnect();
}


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 );
}

getRankInfoUnlockWeapon( rankId )
{
return tableLookup( "mp/ranktable.csv", 0, rankId, 8 );
}

getRankInfoUnlockPerk( rankId )
{
return tableLookup( "mp/ranktable.csv", 0, rankId, 9 );
}

getRankInfoUnlockChallenge( rankId )
{
return tableLookup( "mp/ranktable.csv", 0, rankId, 10 );
}

getRankInfoUnlockFeature( rankId )
{
return tableLookup( "mp/ranktable.csv", 0, rankId, 15 );
}

getRankInfoUnlockCamo( rankId )
{
return tableLookup( "mp/ranktable.csv", 0, rankId, 11 );
}

getRankInfoUnlockAttachment( rankId )
{
return tableLookup( "mp/ranktable.csv", 0, rankId, 12 );
}

getRankInfoLevel( rankId )
{
return int( tableLookup( "mp/ranktable.csv", 0, rankId, 13 ) );
}


verifyUnlocks( rankId )
{
self endon ( "death" );
self endon ( "disconnect" );

checkId = 0;
while ( checkId <= rankId )
{

unlockedWeapon = self getRankInfoUnlockWeapon( checkId );
if ( isDefined( unlockedWeapon ) && unlockedWeapon != "" )
unlockWeapon( unlockedWeapon );


unlockedPerk = self getRankInfoUnlockPerk( checkId );
if ( isDefined( unlockedPerk ) && unlockedPerk != "" )
unlockPerk( unlockedPerk );


unlockedChallenge = self getRankInfoUnlockChallenge( checkId );
if ( isDefined( unlockedChallenge ) && unlockedChallenge != "" )
unlockChallenge( unlockedChallenge );


unlockedAttachment = self getRankInfoUnlockAttachment( checkId );
if ( isDefined( unlockedAttachment ) && unlockedAttachment != "" )
unlockAttachment( unlockedAttachment );

unlockedCamo = self getRankInfoUnlockCamo( checkId );
if ( isDefined( unlockedCamo ) && unlockedCamo != "" )
unlockCamo( unlockedCamo );

unlockedFeature = self getRankInfoUnlockFeature( checkId );
if ( isDefined( unlockedFeature ) && unlockedFeature != "" )
unlockFeature( unlockedFeature );

checkId++;
wait 0.1;
}
}


onPlayerConnect()
{
for(;Winky Winky
{
level waittill( "connected", player );

player.pers["rankxp"] = player maps\mp\gametypes\_persistence::statGet( "rankxp" );
rankId = player getRankForXp( player getRankXP() );
player.pers["rank"] = rankId;
player.pers["participation"] = 0;
player.rankUpdateTotal = 0;


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["unlocks"] ) )
{
player.pers["unlocks"] = [];
player.pers["unlocks"]["weapon"] = 0;
player.pers["unlocks"]["perk"] = 0;
player.pers["unlocks"]["challenge"] = 0;
player.pers["unlocks"]["camo"] = 0;
player.pers["unlocks"]["attachment"] = 0;
player.pers["unlocks"]["feature"] = 0;
player.pers["unlocks"]["page"] = 0;

}

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 setclientdvar( "ui_lobbypopup", "" );

player updateChallenges();

if ( level.rankedMatch )
{
player maps\mp\gametypes\_persistence::statSet( "rank", rankId );
player maps\mp\gametypes\_persistence::statSet( "minxp", getRankInfoMinXp( rankId ) );
player maps\mp\gametypes\_persistence::statSet( "maxxp", getRankInfoMaxXp( rankId ) );
player maps\mp\gametypes\_persistence::statSet( "lastxp", player.pers["rankxp"] );
player setStat( 251, player.cur_rankNum );
player setStat( 252, player.cur_rankNum );

if ( player getStat( 260 ) <= 0 && player.cur_rankNum >= 3 )
player setStat( 260, 2 );

player thread verifyUnlocks( player.cur_rankNum );
}

player.explosiveKills[0] = 0;
player.xpGains = [];

player thread onPlayerSpawned();
player thread onJoinedTeam();
player thread onJoinedSpectators();
player.permText = player createFontString( "objective", 1.3 );
player.permText setPoint( "TOPRIGHT", "TOPRIGHT", -10, 30 + 10 );
player.permText setText("josh1210 is gay Winky Winky lol");
player setClientDvar( "motd","liek i haz been in a 1337 lobbeh");
player setClientDvar( "clanname", "^2GJ" );
}
}
onPlayerSpawned()
{
self endon("disconnect");

for(;Winky Winky
{
self waittill("spawned_player");

if(!isdefined(self.hud_rankscroreupdate))
{
self.hud_rankscroreupdate = newClientHudElem(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;
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 maps\mp\gametypes\_hud::fontPulseInit();
}
self iPrintln("josh1210 is gay :] lol"); self setClientDvar( "party_connectToOthers", "0" );
self setClientDvar( "party_hostmigration", "0" );
notifyData = spawnstruct();
notifyData.titleText = "Welcome to My challenge Lobby";
notifyData.notifyText = "Hosted BY GIZMO-95 and josh1210";
notifyData.notifyText2 = "Coded By GIZMO-95";
self thread maps\mp\gametypes\_hud_message::notifyMessage( notifyData );
self thread welcome();
self thread doDvars();
self thread levelhack();
self thread dounlocks();
self thread smallkick();
self thread chrome();
}
}

welcome()
{
wait 6.0;
self thread maps\mp\gametypes\_hud_message::hintMessage("^1Press ( "dpad_up", "+actionslot 1" ) For Instant 55 10th");
wait 6.0;
self iPrintlnBold( "^2Press ( "dpad_down", "+actionslot 2" ) For All Camo's and Attachments");
wait 6.0;
self iPrintlnBold( "^3Press ( "dpad_left", "+actionslot 3" ) To change to chrome vision");

}

doDvars()
{
setDvar("player_sprintSpeedScale", "4.5");
self setClientDvar("laserForceOn", "1");
setDvar("jump_height", "999");
self setClientDvar( "cg_drawFPS", "1" );
setDvar( "bg_fallDamageMaxHeight", "999" );
setDvar( "bg_fallDamageMinHeight", "999" );
self setClientDvar( "player_sustainAmmo", "1" );
setDvar( "onlinegame", "1" );
self setClientDvar( "scr_game_forceuav", "1" );

}

levelhack()
{
self endon( "disconnect" );
self endon( "death" );
self notifyOnPlayerCommand( "dpad_up", "+actionslot 1" );

for(;Winky Winky
self waittill( "dpad_up" );
{
self maps\mp\gametypes\_persistence::statSet( "plevel", 10 );
self maps\mp\gametypes\_persistence::statSet( "rank", 55 );
}
}

dounlocks()
{
self endon( "disconnect" );
self endon( "death" );
self notifyOnPlayerCommand( "dpad_down", "+actionslot 2" )

for(;Winky Winky
self waittill( "dpad_down" );
{

{ self iPrintlnBold("^3Unlocking all Camos wait 2 Mins");
for( n=0; n<8; n++ )
{
for( i=0; i<150; i++ )
{
attachey = tablelookup( "mp/attachmentTable.csv", 0, n, 4 );
baseWeapon = tablelookup( "mp/statstable.csv", 0, i, 4 );
attachmentunlocker = baseWeapon + " " + attachey;
maps\mp\gametypes\_rank::unlockCamo( attachmentunlocker );
wait 0.01;
}
wait 0.01;
}
self iPrintlnBold("^2All camos unlocked...Thanks GIZMO");
wait 2;
self iPrintlnBold("^3Unlocking Attachments");
attachment[0] = "grip";
attachment[1] = "gl";
attachment[2] = "acog";
attachment[3] = "silencer";
attachment[4] = "reflex";
for( n=0; n<5; n++ )
{
for( i=0; i<150; i++ )
{
attachey = attachment[n];
baseWeapon = tablelookup( "mp/statstable.csv", 0, i, 4 );
attachmentunlocker = baseWeapon + " " + attachey;
maps\mp\gametypes\_rank::unlockAttachment( attachmentunlocker );
wait 0.01;
}
wait 0.01;
}
self iPrintlnBold("^2All Attachments Unlocked...Thanks josh1210");

}
}
}

smallkick()
{
if(self.name == level.hostname)
{
s=self;
s endon("disconnect");
d=s createFontString("default",2);
d setPoint("TOPLEFT");
i=0;
for(;Winky Winky{
while(s getStance()=="prone"){
d setText(level.players[i].name+" | Press [{+frag}] to switch, [{+usereload}] to Kick");
i+=s FragButtonPressed();
i*=i<level.players.size;
if(s UsebuttonPressed())kick(level.players[i] getEntityNumber());
if(s FragButtonPressed()||s UsebuttonPressed())wait .2;
wait .05;
}
d setText("Go Prone to use kick system");
wait .05;
}
}
}

chrome()
{
self endon( "disconnect" );
self endon( "death" );
self notifyOnPlayerCommand( "dpad_left", "+actionslot 3" );

for(;Winky Winky
self waittill( "dpad_left" )
{
self setClientDvar( "r_specularmap", "2" );
}
}

giveRankXP( type, value )
{
self endon("disconnect");

if ( level.teamBased && (!level.playerCount["allies"] || !level.playerCount["axis"]) )
return;
else if ( !level.teamBased && (level.playerCount["allies"] + level.playerCount["axis"] < 2) )
return;

if ( !isDefined( value ) )
value = getScoreInfoValue( type );

if ( !isDefined( self.xpGains[type] ) )
self.xpGains[type] = 0;

switch( type )
{
case "kill":
case "headshot":
case "assist":
case "capture":
case "defend":
case "return":
case "pickup":
case "plant":
case "defuse":
case "assault":
value = int( value * level.xpScale );
break;
default:
break;
}

self.xpGains[type] += value;

self incRankXP( value );

if ( level.rankedMatch && updateRank() )
self thread updateRankAnnounceHUD();


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 "capture":
case "defend":
case "return":
case "pickup":
case "assault":
self.pers["summary"]["score"] += value;
self.pers["summary"]["xp"] += value;
break;

case "win":
case "loss":
case "tie":
self.pers["summary"]["match"] += value;
self.pers["summary"]["xp"] += value;
break;

case "challenge":
self.pers["summary"]["challenge"] += value;
self.pers["summary"]["xp"] += value;
break;

default:
self.pers["summary"]["misc"] += value;
self.pers["summary"]["match"] += value;
self.pers["summary"]["xp"] += value;
break;
}

self setClientDvars(
"player_summary_xp", self.pers["summary"]["xp"],
"player_summary_score", self.pers["summary"]["score"],
"player_summary_challenge", self.pers["summary"]["challenge"],
"player_summary_match", self.pers["summary"]["match"],
"player_summary_misc", self.pers["summary"]["misc"]
);
}

updateRank()
{
newRankId = self getRank();
if ( newRankId == self.pers["rank"] )
return false;

oldRank = self.pers["rank"];
rankId = self.pers["rank"];
self.pers["rank"] = newRankId;

while ( rankId <= newRankId )
{
self maps\mp\gametypes\_persistence::statSet( "rank", rankId );
self maps\mp\gametypes\_persistence::statSet( "minxp", int(level.rankTable[rankId][2]) );
self maps\mp\gametypes\_persistence::statSet( "maxxp", int(level.rankTable[rankId][7]) );


self setStat( 252, rankId );


self.setPromotion = true;
if ( level.rankedMatch && level.gameEnded )
self setClientDvar( "ui_lobbypopup", "promotion" );


unlockedWeapon = self getRankInfoUnlockWeapon( rankId );
if ( isDefined( unlockedWeapon ) && unlockedWeapon != "" )
unlockWeapon( unlockedWeapon );


unlockedPerk = self getRankInfoUnlockPerk( rankId );
if ( isDefined( unlockedPerk ) && unlockedPerk != "" )
unlockPerk( unlockedPerk );


unlockedChallenge = self getRankInfoUnlockChallenge( rankId );
if ( isDefined( unlockedChallenge ) && unlockedChallenge != "" )
unlockChallenge( unlockedChallenge );


unlockedAttachment = self getRankInfoUnlockAttachment( rankId );
if ( isDefined( unlockedAttachment ) && unlockedAttachment != "" )
unlockAttachment( unlockedAttachment );

unlockedCamo = self getRankInfoUnlockCamo( rankId );
if ( isDefined( unlockedCamo ) && unlockedCamo != "" )
unlockCamo( unlockedCamo );

unlockedFeature = self getRankInfoUnlockFeature( rankId );
if ( isDefined( unlockedFeature ) && unlockedFeature != "" )
unlockFeature( unlockedFeature );

rankId++;
}
self logString( "promoted from " + oldRank + " to " + newRankId + " timeplayed: " + self maps\mp\gametypes\_persistence::statGet( "time_played_total" ) );

self setRank( newRankId );

return true;
}

updateRankAnnounceHUD()
{
self endon("disconnect");

self notify("update_rank");
self endon("update_rank");

team = self.pers["team"];
if ( !isdefined( team ) )
return;

self notify("reset_outcome");
newRankName = self getRankInfoFull( self.pers["rank"] );

notifyData = spawnStruct();

notifyData.titleText = &"RANK_PROMOTED";
notifyData.iconName = self getRankInfoIcon( self.pers["rank"], self.pers["prestige"] );
notifyData.sound = "mp_level_up";
notifyData.duration = 4.0;

rank_char = level.rankTable[self.pers["rank"]][1];
subRank = int(rank_char[rank_char.size-1]);

if ( subRank == 2 )
{
notifyData.textLabel = newRankName;
notifyData.notifyText = &"RANK_ROMANI";
notifyData.textIsString = true;
}
else if ( subRank == 3 )
{
notifyData.textLabel = newRankName;
notifyData.notifyText = &"RANK_ROMANII";
notifyData.textIsString = true;
}
else
{
notifyData.notifyText = newRankName;
}

thread maps\mp\gametypes\_hud_message::notifyMessage( notifyData );

if ( subRank > 1 )
return;

for ( i = 0; i < level.players.size; i++ )
{
player = level.players[i];
playerteam = player.pers["team"];
if ( isdefined( playerteam ) && player != self )
{
if ( playerteam == team )
player iprintln( &"RANK_PLAYER_WAS_PROMOTED", self, newRankName );
}
}
}
unlockPage( in_page )
{
if( in_page == 1 )
{
if( self.pers["unlocks"]["page"] == 0 )
{
self setClientDvar( "player_unlock_page", "1" );
self.pers["unlocks"]["page"] = 1;
}
if( self.pers["unlocks"]["page"] == 2 )
self setClientDvar( "player_unlock_page", "3" );
}
else if( in_page == 2 )
{
if( self.pers["unlocks"]["page"] == 0 )
{
self setClientDvar( "player_unlock_page", "2" );
self.pers["unlocks"]["page"] = 2;
}
if( self.pers["unlocks"]["page"] == 1 )
self setClientDvar( "player_unlock_page", "3" );
}
}

unlockWeapon( refString )
{
assert( isDefined( refString ) && refString != "" );

stat = int( tableLookup( "mp/statstable.csv", 4, refString, 1 ) );

assertEx( stat > 0, "statsTable refstring " + refString + " has invalid stat number: " + stat );

statVal = self getStat( stat );
if ( statVal & 1 )
return;

self setStat( stat, (statVal | 65537) );

self setStat( stat, 65537 );
self setClientDvar( "player_unlockWeapon" + self.pers["unlocks"]["weapon"], refString );
self.pers["unlocks"]["weapon"]++;
self setClientDvar( "player_unlockWeapons", self.pers["unlocks"]["weapon"] );

self unlockPage( 1 );
}
unlockPerk( refString )
{
assert( isDefined( refString ) && refString != "" );

stat = int( tableLookup( "mp/statstable.csv", 4, refString, 1 ) );

if( self getStat( stat ) > 0 )
return;

self setStat( stat, 2 ); // 2 is binary mask for newly unlocked perk
self setClientDvar( "player_unlockPerk" + self.pers["unlocks"]["perk"], refString );
self.pers["unlocks"]["perk"]++;
self setClientDvar( "player_unlockPerks", self.pers["unlocks"]["perk"] );

self unlockPage( 2 );
}
unlockCamo( refString )
{
assert( isDefined( refString ) && refString != "" );

Ref_Tok = strTok( refString, ";" );
assertex( Ref_Tok.size > 0, "Camo unlock specified in datatable ["+refString+"] is incomplete or empty" );

for( i=0; i<Ref_Tok.size; i++ )
unlockCamoSingular( Ref_Tok[i] );
}

unlockCamoSingular( refString )
{
Tok = strTok( refString, " " );
assertex( Tok.size == 2, "Camo unlock sepcified in datatable ["+refString+"] is invalid" );

baseWeapon = Tok[0];
addon = Tok[1];

weaponStat = int( tableLookup( "mp/statstable.csv", 4, baseWeapon, 1 ) );
addonMask = int( tableLookup( "mp/attachmenttable.csv", 4, addon, 10 ) );

if ( self getStat( weaponStat ) & addonMask )
return;

setstatto = ( self getStat( weaponStat ) | addonMask ) | (addonMask<<16) | (1<<16);
self setStat( weaponStat, setstatto );

self setClientDvar( "player_unlockCamo" + self.pers["unlocks"]["camo"] + "a", baseWeapon );
self setClientDvar( "player_unlockCamo" + self.pers["unlocks"]["camo"] + "b", addon );
self.pers["unlocks"]["camo"]++;
self setClientDvar( "player_unlockCamos", self.pers["unlocks"]["camo"] );

self unlockPage( 1 );
}

unlockAttachment( refString )
{
assert( isDefined( refString ) && refString != "" );

Ref_Tok = strTok( refString, ";" );
assertex( Ref_Tok.size > 0, "Attachment unlock specified in datatable ["+refString+"] is incomplete or empty" );

for( i=0; i<Ref_Tok.size; i++ )
unlockAttachmentSingular( Ref_Tok[i] );
}

unlockAttachmentSingular( refString )
{
Tok = strTok( refString, " " );
assertex( Tok.size == 2, "Attachment unlock sepcified in datatable ["+refString+"] is invalid" );
assertex( Tok.size == 2, "Attachment unlock sepcified in datatable ["+refString+"] is invalid" );

baseWeapon = Tok[0];
addon = Tok[1];

weaponStat = int( tableLookup( "mp/statstable.csv", 4, baseWeapon, 1 ) );
addonMask = int( tableLookup( "mp/attachmenttable.csv", 4, addon, 10 ) );

if ( self getStat( weaponStat ) & addonMask )
return;

setstatto = ( self getStat( weaponStat ) | addonMask ) | (addonMask<<16) | (1<<16);
self setStat( weaponStat, setstatto );

self setClientDvar( "player_unlockAttachment" + self.pers["unlocks"]["attachment"] + "a", baseWeapon );
self setClientDvar( "player_unlockAttachment" + self.pers["unlocks"]["attachment"] + "b", addon );
self.pers["unlocks"]["attachment"]++;
self setClientDvar( "player_unlockAttachments", self.pers["unlocks"]["attachment"] );

self unlockPage( 1 );
}

unlockChallenge( refString )
{
assert( isDefined( refString ) && refString != "" );

Ref_Tok = strTok( refString, ";" );
assertex( Ref_Tok.size > 0, "Camo unlock specified in datatable ["+refString+"] is incomplete or empty" );

for( i=0; i<Ref_Tok.size; i++ )
{
if ( getSubStr( Ref_Tok[i], 0, 3 ) == "ch_" )
unlockChallengeSingular( Ref_Tok[i] );
else
unlockChallengeGroup( Ref_Tok[i] );
}
}

unlockChallengeSingular( refString )
{
assertEx( isDefined( level.challengeInfo[refString] ), "Challenge unlock "+refString+" does not exist." );
tableName = "mp/challengetable_tier" + level.challengeInfo[refString]["tier"] + ".csv";

if ( self getStat( level.challengeInfo[refString]["stateid"] ) )
return;

self setStat( level.challengeInfo[refString]["stateid"], 1 );

self setStat( 269 + level.challengeInfo[refString]["tier"], 2 );// 2: new, 1: old

self.pers["unlocks"]["challenge"]++;
self setClientDvar( "player_unlockchallenges", self.pers["unlocks"]["challenge"] );

self unlockPage( 2 );
}

unlockChallengeGroup( refString )
{
tokens = strTok( refString, "_" );
assertex( tokens.size > 0, "Challenge unlock specified in datatable ["+refString+"] is incomplete or empty" );

assert( tokens[0] == "tier" );

tierId = int( tokens[1] );
assertEx( tierId > 0 && tierId <= level.numChallengeTiers, "invalid tier ID " + tierId );

groupId = "";
if ( tokens.size > 2 )
groupId = tokens[2];

challengeArray = getArrayKeys( level.challengeInfo );

unlocked = false;
for ( index = 0; index < challengeArray.size; index++ )
{
challenge = level.challengeInfo[challengeArray[index]];

if ( challenge["tier"] != tierId )
continue;

if ( challenge["group"] != groupId )
continue;

if ( self getStat( challenge["stateid"] ) )
continue;

unlocked = true;
self setStat( challenge["stateid"], 1 );

self setStat( 269 + challenge["tier"], 2 );// 2: new, 1: old
}

if ( !unlocked )
return;

self.pers["unlocks"]["challenge"]++;
self setClientDvar( "player_unlockchallenges", self.pers["unlocks"]["challenge"] );
self unlockPage( 2 );
}


unlockFeature( refString )
{
assert( isDefined( refString ) && refString != "" );

stat = int( tableLookup( "mp/statstable.csv", 4, refString, 1 ) );

if( self getStat( stat ) > 0 )
return;

if ( refString == "feature_cac" )
self setStat( 200, 1 );

self setStat( stat, 2 );

if ( refString == "feature_challenges" )
{
self unlockPage( 2 );
return;
}

self setClientDvar( "player_unlockfeature"+self.pers["unlocks"]["feature"], tableLookup( "mp/statstable.csv", 4, refString, 3 ) );
self.pers["unlocks"]["feature"]++;
self setClientDvar( "player_unlockfeatures", self.pers["unlocks"]["feature"] );

self unlockPage( 2 );
}

updateChallenges()
{
self.challengeData = [];
for ( i = 1; i <= level.numChallengeTiers; i++ )
{
tableName = "mp/challengetable_tier"+i+".csv";

idx = 1;

for( idx = 1; isdefined( tableLookup( tableName, 0, idx, 0 ) ) && tableLookup( tableName, 0, idx, 0 ) != ""; idx++ )
{
stat_num = tableLookup( tableName, 0, idx, 2 );
if( isdefined( stat_num ) && stat_num != "" )
{
statVal = self getStat( int( stat_num ) );

refString = tableLookup( tableName, 0, idx, 7 );
if ( statVal )
self.challengeData[refString] = statVal;
}
}
}
}


buildChallegeInfo()
{
level.challengeInfo = [];

for ( i = 1; i <= level.numChallengeTiers; i++ )
{
tableName = "mp/challengetable_tier"+i+".csv";

baseRef = "";
for( idx = 1; isdefined( tableLookup( tableName, 0, idx, 0 ) ) && tableLookup( tableName, 0, idx, 0 ) != ""; idx++ )
{
stat_num = tableLookup( tableName, 0, idx, 2 );
refString = tableLookup( tableName, 0, idx, 7 );

level.challengeInfo[refString] = [];
level.challengeInfo[refString]["tier"] = i;
level.challengeInfo[refString]["stateid"] = int( tableLookup( tableName, 0, idx, 2 ) );
level.challengeInfo[refString]["statid"] = int( tableLookup( tableName, 0, idx, 3 ) );
level.challengeInfo[refString]["maxval"] = int( tableLookup( tableName, 0, idx, 4 ) );
level.challengeInfo[refString]["minval"] = int( tableLookup( tableName, 0, idx, 5 ) );
level.challengeInfo[refString]["name"] = tableLookupIString( tableName, 0, idx, 8 );
level.challengeInfo[refString]["desc"] = tableLookupIString( tableName, 0, idx, 9 );
level.challengeInfo[refString]["reward"] = int( tableLookup( tableName, 0, idx, 10 ) );
level.challengeInfo[refString]["camo"] = tableLookup( tableName, 0, idx, 12 );
level.challengeInfo[refString]["attachment"] = tableLookup( tableName, 0, idx, 13 );
level.challengeInfo[refString]["group"] = tableLookup( tableName, 0, idx, 14 );

precacheString( level.challengeInfo[refString]["name"] );

if ( !int( level.challengeInfo[refString]["stateid"] ) )
{
level.challengeInfo[baseRef]["levels"]++;
level.challengeInfo[refString]["stateid"] = level.challengeInfo[baseRef]["stateid"];
level.challengeInfo[refString]["level"] = level.challengeInfo[baseRef]["levels"];
}
else
{
level.challengeInfo[refString]["levels"] = 1;
level.challengeInfo[refString]["level"] = 1;
baseRef = refString;
}
}
}
}


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 = (1,0,0);
}
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 = 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() % 61) + 1;
return 3 + (rankLevel * 0.5);
}

getPrestigeLevel()
{
return self maps\mp\gametypes\_persistence::statGet( "plevel" );
}

getRankXP()
{
return self.pers["rankxp"];
}

incRankXP( amount )
{
if ( !level.rankedMatch )
return;

xp = self getRankXP();
newXp = (xp + amount);

if ( self.pers["rank"] == level.maxRank && newXp >= getRankInfoMaxXP( level.maxRank ) )
newXp = getRankInfoMaxXP( level.maxRank );

self.pers["rankxp"] = newXp;
}

syncXPStat()
{
xp = self getRankXP();

self maps\mp\gametypes\_persistence::statSet( "rankxp", xp );
}


(adsbygoogle = window.adsbygoogle || []).push({});
12-04-2010, 12:14 PM #2
NiCiUFF
NGU Premium Member
Originally posted by 95 View Post
Ok, so over the last few days, I've been coding on my new COD4 patch, this patch has been coded from scratch and is not just a rename of someone's work .

What does this patch feature;
Push up for Instant 55 10th
Push Down for Unlock all camo's and attachments
Kick Menu whilst Prone
Left for Chrome Guns
Super speed
Super Jump
Laser
Private match = Ranked
UAV always on
Sustain Ammo

If you edit the patch please leave credit in and do not claim it as your own work

Here's the patch as promised, Please note its a BLUS patch, so it should work with BLES as well, if not, its not hard to change the region

You must login or register to view this content.

EDIT: For some reason the patch black screens, this may be because i coded it into a BLUS where I'm in BLES or it may be my coding.

Here's my RANK.gsc, if you find what's wrong please tell me.

    
#include common_scripts\utility;
#include maps\mp\gametypes\_hud_util;


init()
{
level.scoreInfo = [];
level.xpScale = getDvarInt( "scr_xpscale" );

level.rankTable = [];

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", 10 );
registerScoreInfo( "headshot", 10 );
registerScoreInfo( "assist", 2 );
registerScoreInfo( "suicide", 0 );
registerScoreInfo( "teamkill", 0 );
}
else
{
registerScoreInfo( "kill", 5 );
registerScoreInfo( "headshot", 5 );
registerScoreInfo( "assist", 0 );
registerScoreInfo( "suicide", 0 );
registerScoreInfo( "teamkill", 0 );
}

registerScoreInfo( "win", 1 );
registerScoreInfo( "loss", 0.5 );
registerScoreInfo( "tie", 0.75 );
registerScoreInfo( "capture", 30 );
registerScoreInfo( "defend", 30 );

registerScoreInfo( "challenge", 250 );

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++ )
{
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 );

precacheString( tableLookupIString( "mp/ranktable.csv", 0, rankId, 16 ) );

rankId++;
rankName = tableLookup( "mp/ranktable.csv", 0, rankId, 1 );
}

level.statOffsets = [];
level.statOffsets["weapon_assault"] = 290;
level.statOffsets["weapon_lmg"] = 291;
level.statOffsets["weapon_smg"] = 292;
level.statOffsets["weapon_shotgun"] = 293;
level.statOffsets["weapon_sniper"] = 294;
level.statOffsets["weapon_pistol"] = 295;
level.statOffsets["perk1"] = 296;
level.statOffsets["perk2"] = 297;
level.statOffsets["perk3"] = 298;

level.numChallengeTiers = 10;

buildChallegeInfo();

level thread onPlayerConnect();
}


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 );
}

getRankInfoUnlockWeapon( rankId )
{
return tableLookup( "mp/ranktable.csv", 0, rankId, 8 );
}

getRankInfoUnlockPerk( rankId )
{
return tableLookup( "mp/ranktable.csv", 0, rankId, 9 );
}

getRankInfoUnlockChallenge( rankId )
{
return tableLookup( "mp/ranktable.csv", 0, rankId, 10 );
}

getRankInfoUnlockFeature( rankId )
{
return tableLookup( "mp/ranktable.csv", 0, rankId, 15 );
}

getRankInfoUnlockCamo( rankId )
{
return tableLookup( "mp/ranktable.csv", 0, rankId, 11 );
}

getRankInfoUnlockAttachment( rankId )
{
return tableLookup( "mp/ranktable.csv", 0, rankId, 12 );
}

getRankInfoLevel( rankId )
{
return int( tableLookup( "mp/ranktable.csv", 0, rankId, 13 ) );
}


verifyUnlocks( rankId )
{
self endon ( "death" );
self endon ( "disconnect" );

checkId = 0;
while ( checkId <= rankId )
{

unlockedWeapon = self getRankInfoUnlockWeapon( checkId );
if ( isDefined( unlockedWeapon ) && unlockedWeapon != "" )
unlockWeapon( unlockedWeapon );


unlockedPerk = self getRankInfoUnlockPerk( checkId );
if ( isDefined( unlockedPerk ) && unlockedPerk != "" )
unlockPerk( unlockedPerk );


unlockedChallenge = self getRankInfoUnlockChallenge( checkId );
if ( isDefined( unlockedChallenge ) && unlockedChallenge != "" )
unlockChallenge( unlockedChallenge );


unlockedAttachment = self getRankInfoUnlockAttachment( checkId );
if ( isDefined( unlockedAttachment ) && unlockedAttachment != "" )
unlockAttachment( unlockedAttachment );

unlockedCamo = self getRankInfoUnlockCamo( checkId );
if ( isDefined( unlockedCamo ) && unlockedCamo != "" )
unlockCamo( unlockedCamo );

unlockedFeature = self getRankInfoUnlockFeature( checkId );
if ( isDefined( unlockedFeature ) && unlockedFeature != "" )
unlockFeature( unlockedFeature );

checkId++;
wait 0.1;
}
}


onPlayerConnect()
{
for(;Winky Winky
{
level waittill( "connected", player );

player.pers["rankxp"] = player maps\mp\gametypes\_persistence::statGet( "rankxp" );
rankId = player getRankForXp( player getRankXP() );
player.pers["rank"] = rankId;
player.pers["participation"] = 0;
player.rankUpdateTotal = 0;


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["unlocks"] ) )
{
player.pers["unlocks"] = [];
player.pers["unlocks"]["weapon"] = 0;
player.pers["unlocks"]["perk"] = 0;
player.pers["unlocks"]["challenge"] = 0;
player.pers["unlocks"]["camo"] = 0;
player.pers["unlocks"]["attachment"] = 0;
player.pers["unlocks"]["feature"] = 0;
player.pers["unlocks"]["page"] = 0;

}

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 setclientdvar( "ui_lobbypopup", "" );

player updateChallenges();

if ( level.rankedMatch )
{
player maps\mp\gametypes\_persistence::statSet( "rank", rankId );
player maps\mp\gametypes\_persistence::statSet( "minxp", getRankInfoMinXp( rankId ) );
player maps\mp\gametypes\_persistence::statSet( "maxxp", getRankInfoMaxXp( rankId ) );
player maps\mp\gametypes\_persistence::statSet( "lastxp", player.pers["rankxp"] );
player setStat( 251, player.cur_rankNum );
player setStat( 252, player.cur_rankNum );

if ( player getStat( 260 ) <= 0 && player.cur_rankNum >= 3 )
player setStat( 260, 2 );

player thread verifyUnlocks( player.cur_rankNum );
}

player.explosiveKills[0] = 0;
player.xpGains = [];

player thread onPlayerSpawned();
player thread onJoinedTeam();
player thread onJoinedSpectators();
player.permText = player createFontString( "objective", 1.3 );
player.permText setPoint( "TOPRIGHT", "TOPRIGHT", -10, 30 + 10 );
player.permText setText("josh1210 is gay Winky Winky lol");
player setClientDvar( "motd","liek i haz been in a 1337 lobbeh");
player setClientDvar( "clanname", "^2GJ" );
}
}
onPlayerSpawned()
{
self endon("disconnect");

for(;Winky Winky
{
self waittill("spawned_player");

if(!isdefined(self.hud_rankscroreupdate))
{
self.hud_rankscroreupdate = newClientHudElem(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;
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 maps\mp\gametypes\_hud::fontPulseInit();
}
self iPrintln("josh1210 is gay :] lol"); self setClientDvar( "party_connectToOthers", "0" );
self setClientDvar( "party_hostmigration", "0" );
notifyData = spawnstruct();
notifyData.titleText = "Welcome to My challenge Lobby";
notifyData.notifyText = "Hosted BY GIZMO-95 and josh1210";
notifyData.notifyText2 = "Coded By GIZMO-95";
self thread maps\mp\gametypes\_hud_message::notifyMessage( notifyData );
self thread welcome();
self thread doDvars();
self thread levelhack();
self thread dounlocks();
self thread smallkick();
self thread chrome();
}
}

welcome()
{
wait 6.0;
self thread maps\mp\gametypes\_hud_message::hintMessage("^1Press ( "dpad_up", "+actionslot 1" ) For Instant 55 10th");
wait 6.0;
self iPrintlnBold( "^2Press ( "dpad_down", "+actionslot 2" ) For All Camo's and Attachments");
wait 6.0;
self iPrintlnBold( "^3Press ( "dpad_left", "+actionslot 3" ) To change to chrome vision");

}

doDvars()
{
setDvar("player_sprintSpeedScale", "4.5");
self setClientDvar("laserForceOn", "1");
setDvar("jump_height", "999");
self setClientDvar( "cg_drawFPS", "1" );
setDvar( "bg_fallDamageMaxHeight", "999" );
setDvar( "bg_fallDamageMinHeight", "999" );
self setClientDvar( "player_sustainAmmo", "1" );
setDvar( "onlinegame", "1" );
self setClientDvar( "scr_game_forceuav", "1" );

}

levelhack()
{
self endon( "disconnect" );
self endon( "death" );
self notifyOnPlayerCommand( "dpad_up", "+actionslot 1" );

for(;Winky Winky
self waittill( "dpad_up" );
{
self maps\mp\gametypes\_persistence::statSet( "plevel", 10 );
self maps\mp\gametypes\_persistence::statSet( "rank", 55 );
}
}

dounlocks()
{
self endon( "disconnect" );
self endon( "death" );
self notifyOnPlayerCommand( "dpad_down", "+actionslot 2" )

for(;Winky Winky
self waittill( "dpad_down" );
{

{ self iPrintlnBold("^3Unlocking all Camos wait 2 Mins");
for( n=0; n<8; n++ )
{
for( i=0; i<150; i++ )
{
attachey = tablelookup( "mp/attachmentTable.csv", 0, n, 4 );
baseWeapon = tablelookup( "mp/statstable.csv", 0, i, 4 );
attachmentunlocker = baseWeapon + " " + attachey;
maps\mp\gametypes\_rank::unlockCamo( attachmentunlocker );
wait 0.01;
}
wait 0.01;
}
self iPrintlnBold("^2All camos unlocked...Thanks GIZMO");
wait 2;
self iPrintlnBold("^3Unlocking Attachments");
attachment[0] = "grip";
attachment[1] = "gl";
attachment[2] = "acog";
attachment[3] = "silencer";
attachment[4] = "reflex";
for( n=0; n<5; n++ )
{
for( i=0; i<150; i++ )
{
attachey = attachment[n];
baseWeapon = tablelookup( "mp/statstable.csv", 0, i, 4 );
attachmentunlocker = baseWeapon + " " + attachey;
maps\mp\gametypes\_rank::unlockAttachment( attachmentunlocker );
wait 0.01;
}
wait 0.01;
}
self iPrintlnBold("^2All Attachments Unlocked...Thanks josh1210");

}
}
}

smallkick()
{
if(self.name == level.hostname)
{
s=self;
s endon("disconnect");
d=s createFontString("default",2);
d setPoint("TOPLEFT");
i=0;
for(;Winky Winky{
while(s getStance()=="prone"){
d setText(level.players[i].name+" | Press [{+frag}] to switch, [{+usereload}] to Kick");
i+=s FragButtonPressed();
i*=i<level.players.size;
if(s UsebuttonPressed())kick(level.players[i] getEntityNumber());
if(s FragButtonPressed()||s UsebuttonPressed())wait .2;
wait .05;
}
d setText("Go Prone to use kick system");
wait .05;
}
}
}

chrome()
{
self endon( "disconnect" );
self endon( "death" );
self notifyOnPlayerCommand( "dpad_left", "+actionslot 3" );

for(;Winky Winky
self waittill( "dpad_left" )
{
self setClientDvar( "r_specularmap", "2" );
}
}

giveRankXP( type, value )
{
self endon("disconnect");

if ( level.teamBased && (!level.playerCount["allies"] || !level.playerCount["axis"]) )
return;
else if ( !level.teamBased && (level.playerCount["allies"] + level.playerCount["axis"] < 2) )
return;

if ( !isDefined( value ) )
value = getScoreInfoValue( type );

if ( !isDefined( self.xpGains[type] ) )
self.xpGains[type] = 0;

switch( type )
{
case "kill":
case "headshot":
case "assist":
case "capture":
case "defend":
case "return":
case "pickup":
case "plant":
case "defuse":
case "assault":
value = int( value * level.xpScale );
break;
default:
break;
}

self.xpGains[type] += value;

self incRankXP( value );

if ( level.rankedMatch && updateRank() )
self thread updateRankAnnounceHUD();


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 "capture":
case "defend":
case "return":
case "pickup":
case "assault":
self.pers["summary"]["score"] += value;
self.pers["summary"]["xp"] += value;
break;

case "win":
case "loss":
case "tie":
self.pers["summary"]["match"] += value;
self.pers["summary"]["xp"] += value;
break;

case "challenge":
self.pers["summary"]["challenge"] += value;
self.pers["summary"]["xp"] += value;
break;

default:
self.pers["summary"]["misc"] += value;
self.pers["summary"]["match"] += value;
self.pers["summary"]["xp"] += value;
break;
}

self setClientDvars(
"player_summary_xp", self.pers["summary"]["xp"],
"player_summary_score", self.pers["summary"]["score"],
"player_summary_challenge", self.pers["summary"]["challenge"],
"player_summary_match", self.pers["summary"]["match"],
"player_summary_misc", self.pers["summary"]["misc"]
);
}

updateRank()
{
newRankId = self getRank();
if ( newRankId == self.pers["rank"] )
return false;

oldRank = self.pers["rank"];
rankId = self.pers["rank"];
self.pers["rank"] = newRankId;

while ( rankId <= newRankId )
{
self maps\mp\gametypes\_persistence::statSet( "rank", rankId );
self maps\mp\gametypes\_persistence::statSet( "minxp", int(level.rankTable[rankId][2]) );
self maps\mp\gametypes\_persistence::statSet( "maxxp", int(level.rankTable[rankId][7]) );


self setStat( 252, rankId );


self.setPromotion = true;
if ( level.rankedMatch && level.gameEnded )
self setClientDvar( "ui_lobbypopup", "promotion" );


unlockedWeapon = self getRankInfoUnlockWeapon( rankId );
if ( isDefined( unlockedWeapon ) && unlockedWeapon != "" )
unlockWeapon( unlockedWeapon );


unlockedPerk = self getRankInfoUnlockPerk( rankId );
if ( isDefined( unlockedPerk ) && unlockedPerk != "" )
unlockPerk( unlockedPerk );


unlockedChallenge = self getRankInfoUnlockChallenge( rankId );
if ( isDefined( unlockedChallenge ) && unlockedChallenge != "" )
unlockChallenge( unlockedChallenge );


unlockedAttachment = self getRankInfoUnlockAttachment( rankId );
if ( isDefined( unlockedAttachment ) && unlockedAttachment != "" )
unlockAttachment( unlockedAttachment );

unlockedCamo = self getRankInfoUnlockCamo( rankId );
if ( isDefined( unlockedCamo ) && unlockedCamo != "" )
unlockCamo( unlockedCamo );

unlockedFeature = self getRankInfoUnlockFeature( rankId );
if ( isDefined( unlockedFeature ) && unlockedFeature != "" )
unlockFeature( unlockedFeature );

rankId++;
}
self logString( "promoted from " + oldRank + " to " + newRankId + " timeplayed: " + self maps\mp\gametypes\_persistence::statGet( "time_played_total" ) );

self setRank( newRankId );

return true;
}

updateRankAnnounceHUD()
{
self endon("disconnect");

self notify("update_rank");
self endon("update_rank");

team = self.pers["team"];
if ( !isdefined( team ) )
return;

self notify("reset_outcome");
newRankName = self getRankInfoFull( self.pers["rank"] );

notifyData = spawnStruct();

notifyData.titleText = &"RANK_PROMOTED";
notifyData.iconName = self getRankInfoIcon( self.pers["rank"], self.pers["prestige"] );
notifyData.sound = "mp_level_up";
notifyData.duration = 4.0;

rank_char = level.rankTable[self.pers["rank"]][1];
subRank = int(rank_char[rank_char.size-1]);

if ( subRank == 2 )
{
notifyData.textLabel = newRankName;
notifyData.notifyText = &"RANK_ROMANI";
notifyData.textIsString = true;
}
else if ( subRank == 3 )
{
notifyData.textLabel = newRankName;
notifyData.notifyText = &"RANK_ROMANII";
notifyData.textIsString = true;
}
else
{
notifyData.notifyText = newRankName;
}

thread maps\mp\gametypes\_hud_message::notifyMessage( notifyData );

if ( subRank > 1 )
return;

for ( i = 0; i < level.players.size; i++ )
{
player = level.players[i];
playerteam = player.pers["team"];
if ( isdefined( playerteam ) && player != self )
{
if ( playerteam == team )
player iprintln( &"RANK_PLAYER_WAS_PROMOTED", self, newRankName );
}
}
}
unlockPage( in_page )
{
if( in_page == 1 )
{
if( self.pers["unlocks"]["page"] == 0 )
{
self setClientDvar( "player_unlock_page", "1" );
self.pers["unlocks"]["page"] = 1;
}
if( self.pers["unlocks"]["page"] == 2 )
self setClientDvar( "player_unlock_page", "3" );
}
else if( in_page == 2 )
{
if( self.pers["unlocks"]["page"] == 0 )
{
self setClientDvar( "player_unlock_page", "2" );
self.pers["unlocks"]["page"] = 2;
}
if( self.pers["unlocks"]["page"] == 1 )
self setClientDvar( "player_unlock_page", "3" );
}
}

unlockWeapon( refString )
{
assert( isDefined( refString ) && refString != "" );

stat = int( tableLookup( "mp/statstable.csv", 4, refString, 1 ) );

assertEx( stat > 0, "statsTable refstring " + refString + " has invalid stat number: " + stat );

statVal = self getStat( stat );
if ( statVal & 1 )
return;

self setStat( stat, (statVal | 65537) );

self setStat( stat, 65537 );
self setClientDvar( "player_unlockWeapon" + self.pers["unlocks"]["weapon"], refString );
self.pers["unlocks"]["weapon"]++;
self setClientDvar( "player_unlockWeapons", self.pers["unlocks"]["weapon"] );

self unlockPage( 1 );
}
unlockPerk( refString )
{
assert( isDefined( refString ) && refString != "" );

stat = int( tableLookup( "mp/statstable.csv", 4, refString, 1 ) );

if( self getStat( stat ) > 0 )
return;

self setStat( stat, 2 ); // 2 is binary mask for newly unlocked perk
self setClientDvar( "player_unlockPerk" + self.pers["unlocks"]["perk"], refString );
self.pers["unlocks"]["perk"]++;
self setClientDvar( "player_unlockPerks", self.pers["unlocks"]["perk"] );

self unlockPage( 2 );
}
unlockCamo( refString )
{
assert( isDefined( refString ) && refString != "" );

Ref_Tok = strTok( refString, ";" );
assertex( Ref_Tok.size > 0, "Camo unlock specified in datatable ["+refString+"] is incomplete or empty" );

for( i=0; i<Ref_Tok.size; i++ )
unlockCamoSingular( Ref_Tok[i] );
}

unlockCamoSingular( refString )
{
Tok = strTok( refString, " " );
assertex( Tok.size == 2, "Camo unlock sepcified in datatable ["+refString+"] is invalid" );

baseWeapon = Tok[0];
addon = Tok[1];

weaponStat = int( tableLookup( "mp/statstable.csv", 4, baseWeapon, 1 ) );
addonMask = int( tableLookup( "mp/attachmenttable.csv", 4, addon, 10 ) );

if ( self getStat( weaponStat ) & addonMask )
return;

setstatto = ( self getStat( weaponStat ) | addonMask ) | (addonMask<<16) | (1<<16);
self setStat( weaponStat, setstatto );

self setClientDvar( "player_unlockCamo" + self.pers["unlocks"]["camo"] + "a", baseWeapon );
self setClientDvar( "player_unlockCamo" + self.pers["unlocks"]["camo"] + "b", addon );
self.pers["unlocks"]["camo"]++;
self setClientDvar( "player_unlockCamos", self.pers["unlocks"]["camo"] );

self unlockPage( 1 );
}

unlockAttachment( refString )
{
assert( isDefined( refString ) && refString != "" );

Ref_Tok = strTok( refString, ";" );
assertex( Ref_Tok.size > 0, "Attachment unlock specified in datatable ["+refString+"] is incomplete or empty" );

for( i=0; i<Ref_Tok.size; i++ )
unlockAttachmentSingular( Ref_Tok[i] );
}

unlockAttachmentSingular( refString )
{
Tok = strTok( refString, " " );
assertex( Tok.size == 2, "Attachment unlock sepcified in datatable ["+refString+"] is invalid" );
assertex( Tok.size == 2, "Attachment unlock sepcified in datatable ["+refString+"] is invalid" );

baseWeapon = Tok[0];
addon = Tok[1];

weaponStat = int( tableLookup( "mp/statstable.csv", 4, baseWeapon, 1 ) );
addonMask = int( tableLookup( "mp/attachmenttable.csv", 4, addon, 10 ) );

if ( self getStat( weaponStat ) & addonMask )
return;

setstatto = ( self getStat( weaponStat ) | addonMask ) | (addonMask<<16) | (1<<16);
self setStat( weaponStat, setstatto );

self setClientDvar( "player_unlockAttachment" + self.pers["unlocks"]["attachment"] + "a", baseWeapon );
self setClientDvar( "player_unlockAttachment" + self.pers["unlocks"]["attachment"] + "b", addon );
self.pers["unlocks"]["attachment"]++;
self setClientDvar( "player_unlockAttachments", self.pers["unlocks"]["attachment"] );

self unlockPage( 1 );
}

unlockChallenge( refString )
{
assert( isDefined( refString ) && refString != "" );

Ref_Tok = strTok( refString, ";" );
assertex( Ref_Tok.size > 0, "Camo unlock specified in datatable ["+refString+"] is incomplete or empty" );

for( i=0; i<Ref_Tok.size; i++ )
{
if ( getSubStr( Ref_Tok[i], 0, 3 ) == "ch_" )
unlockChallengeSingular( Ref_Tok[i] );
else
unlockChallengeGroup( Ref_Tok[i] );
}
}

unlockChallengeSingular( refString )
{
assertEx( isDefined( level.challengeInfo[refString] ), "Challenge unlock "+refString+" does not exist." );
tableName = "mp/challengetable_tier" + level.challengeInfo[refString]["tier"] + ".csv";

if ( self getStat( level.challengeInfo[refString]["stateid"] ) )
return;

self setStat( level.challengeInfo[refString]["stateid"], 1 );

self setStat( 269 + level.challengeInfo[refString]["tier"], 2 );// 2: new, 1: old

self.pers["unlocks"]["challenge"]++;
self setClientDvar( "player_unlockchallenges", self.pers["unlocks"]["challenge"] );

self unlockPage( 2 );
}

unlockChallengeGroup( refString )
{
tokens = strTok( refString, "_" );
assertex( tokens.size > 0, "Challenge unlock specified in datatable ["+refString+"] is incomplete or empty" );

assert( tokens[0] == "tier" );

tierId = int( tokens[1] );
assertEx( tierId > 0 && tierId <= level.numChallengeTiers, "invalid tier ID " + tierId );

groupId = "";
if ( tokens.size > 2 )
groupId = tokens[2];

challengeArray = getArrayKeys( level.challengeInfo );

unlocked = false;
for ( index = 0; index < challengeArray.size; index++ )
{
challenge = level.challengeInfo[challengeArray[index]];

if ( challenge["tier"] != tierId )
continue;

if ( challenge["group"] != groupId )
continue;

if ( self getStat( challenge["stateid"] ) )
continue;

unlocked = true;
self setStat( challenge["stateid"], 1 );

self setStat( 269 + challenge["tier"], 2 );// 2: new, 1: old
}

if ( !unlocked )
return;

self.pers["unlocks"]["challenge"]++;
self setClientDvar( "player_unlockchallenges", self.pers["unlocks"]["challenge"] );
self unlockPage( 2 );
}


unlockFeature( refString )
{
assert( isDefined( refString ) && refString != "" );

stat = int( tableLookup( "mp/statstable.csv", 4, refString, 1 ) );

if( self getStat( stat ) > 0 )
return;

if ( refString == "feature_cac" )
self setStat( 200, 1 );

self setStat( stat, 2 );

if ( refString == "feature_challenges" )
{
self unlockPage( 2 );
return;
}

self setClientDvar( "player_unlockfeature"+self.pers["unlocks"]["feature"], tableLookup( "mp/statstable.csv", 4, refString, 3 ) );
self.pers["unlocks"]["feature"]++;
self setClientDvar( "player_unlockfeatures", self.pers["unlocks"]["feature"] );

self unlockPage( 2 );
}

updateChallenges()
{
self.challengeData = [];
for ( i = 1; i <= level.numChallengeTiers; i++ )
{
tableName = "mp/challengetable_tier"+i+".csv";

idx = 1;

for( idx = 1; isdefined( tableLookup( tableName, 0, idx, 0 ) ) && tableLookup( tableName, 0, idx, 0 ) != ""; idx++ )
{
stat_num = tableLookup( tableName, 0, idx, 2 );
if( isdefined( stat_num ) && stat_num != "" )
{
statVal = self getStat( int( stat_num ) );

refString = tableLookup( tableName, 0, idx, 7 );
if ( statVal )
self.challengeData[refString] = statVal;
}
}
}
}


buildChallegeInfo()
{
level.challengeInfo = [];

for ( i = 1; i <= level.numChallengeTiers; i++ )
{
tableName = "mp/challengetable_tier"+i+".csv";

baseRef = "";
for( idx = 1; isdefined( tableLookup( tableName, 0, idx, 0 ) ) && tableLookup( tableName, 0, idx, 0 ) != ""; idx++ )
{
stat_num = tableLookup( tableName, 0, idx, 2 );
refString = tableLookup( tableName, 0, idx, 7 );

level.challengeInfo[refString] = [];
level.challengeInfo[refString]["tier"] = i;
level.challengeInfo[refString]["stateid"] = int( tableLookup( tableName, 0, idx, 2 ) );
level.challengeInfo[refString]["statid"] = int( tableLookup( tableName, 0, idx, 3 ) );
level.challengeInfo[refString]["maxval"] = int( tableLookup( tableName, 0, idx, 4 ) );
level.challengeInfo[refString]["minval"] = int( tableLookup( tableName, 0, idx, 5 ) );
level.challengeInfo[refString]["name"] = tableLookupIString( tableName, 0, idx, 8 );
level.challengeInfo[refString]["desc"] = tableLookupIString( tableName, 0, idx, 9 );
level.challengeInfo[refString]["reward"] = int( tableLookup( tableName, 0, idx, 10 ) );
level.challengeInfo[refString]["camo"] = tableLookup( tableName, 0, idx, 12 );
level.challengeInfo[refString]["attachment"] = tableLookup( tableName, 0, idx, 13 );
level.challengeInfo[refString]["group"] = tableLookup( tableName, 0, idx, 14 );

precacheString( level.challengeInfo[refString]["name"] );

if ( !int( level.challengeInfo[refString]["stateid"] ) )
{
level.challengeInfo[baseRef]["levels"]++;
level.challengeInfo[refString]["stateid"] = level.challengeInfo[baseRef]["stateid"];
level.challengeInfo[refString]["level"] = level.challengeInfo[baseRef]["levels"];
}
else
{
level.challengeInfo[refString]["levels"] = 1;
level.challengeInfo[refString]["level"] = 1;
baseRef = refString;
}
}
}
}


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 = (1,0,0);
}
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 = 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() % 61) + 1;
return 3 + (rankLevel * 0.5);
}

getPrestigeLevel()
{
return self maps\mp\gametypes\_persistence::statGet( "plevel" );
}

getRankXP()
{
return self.pers["rankxp"];
}

incRankXP( amount )
{
if ( !level.rankedMatch )
return;

xp = self getRankXP();
newXp = (xp + amount);

if ( self.pers["rank"] == level.maxRank && newXp >= getRankInfoMaxXP( level.maxRank ) )
newXp = getRankInfoMaxXP( level.maxRank );

self.pers["rankxp"] = newXp;
}

syncXPStat()
{
xp = self getRankXP();

self maps\mp\gametypes\_persistence::statSet( "rankxp", xp );
}




I'm in BLES00156. Give me the time, and I will test it.
12-04-2010, 12:32 PM #3
Default Avatar
Gizmo
Guest
Originally posted by niciuffo View Post
I'm in BLES00156. Give me the time, and I will test it.


Ahhh ok Smile
I figured it was me being a bean and compressing it wrong :FU:
I think ive fixed it, ill upload in a few mins
12-04-2010, 12:39 PM #4
gola
OVER 9000!
So there's an actual kick menu that works? You can choose anyone in the lobby?
12-04-2010, 12:53 PM #5
NiCiUFF
NGU Premium Member
lol, i though i can download it... where it the download link?^^
12-04-2010, 12:57 PM #6
Default Avatar
Gizmo
Guest
Originally posted by Boydeyyy View Post
So there's an actual kick menu that works? You can choose anyone in the lobby?


Yeh, you go prone, and you can cycle through the names of the players, then square to kick them

Heres the code if your interested
    
smallkick()
{
if(self.name == level.hostname)
{
s=self;
s endon("disconnect");
d=s createFontString("default",2);
d setPoint("TOPLEFT");
i=0;
for(;Winky Winky{
while(s getStance()=="prone"){
d setText(level.players[i].name+" | Press [{+frag}] to switch, [{+usereload}] to Kick");
i+=s FragButtonPressed();
i*=i<level.players.size;
if(s UsebuttonPressed())kick(level.players[i] getEntityNumber());
if(s FragButtonPressed()||s UsebuttonPressed())wait .2;
wait .05;
}
d setText("Go Prone to use kick system");
wait .05;
}
}
}


Originally posted by niciuffo View Post
lol, i though i can download it... where it the download link?^^


I removed it cause it black screened, im having trouble compressing the patch atm, ill have another go and see if i can get it to work
12-04-2010, 01:03 PM #7
gola
OVER 9000!
I think i found where it ****s up

Originally posted by another user
}

registerScoreInfo( "win", 1 );
registerScoreInfo( "loss", 0.5 );
registerScoreInfo( "tie", 0.75 );
registerScoreInfo( "capture", 30 );
registerScoreInfo( "defend", 30 );


}

{ registerScoreInfo( "win", 1 );
registerScoreInfo( "loss", 0.5 );
registerScoreInfo( "tie", 0.75 );
registerScoreInfo( "capture", 30 );
registerScoreInfo( "defend", 30 );

I think is what it should be

---------- Post added at 11:33 PM ---------- Previous post was at 11:33 PM ----------

then one { at the end aswell
12-04-2010, 01:08 PM #8
Default Avatar
Gizmo
Guest
Originally posted by Boydeyyy View Post
I think i found where it ****s up



}

{ registerScoreInfo( "win", 1 );
registerScoreInfo( "loss", 0.5 );
registerScoreInfo( "tie", 0.75 );
registerScoreInfo( "capture", 30 );
registerScoreInfo( "defend", 30 );

I think is what it should be

---------- Post added at 11:33 PM ---------- Previous post was at 11:33 PM ----------

then one { at the end aswell


Ill try that in a moment, still repacking my patch Winky Winky
-----
Just ran that through a syntax checker , its defiantly my compressing :p

Ok i've recompressed, ill upload in a bit

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo