Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
New modder Need help with simple text input NOOB!!
#1
hay im newist to this and wish to start a mod xD
so i thought i good first mod would be to just add text in game,, i seen the Isnipe mod 2.5 info text and liked it but i can not make it work as im not sure where to put it im useing the _rank.gsc that i got from Here and this is what i want to add but if my own stuff
Quote:/*
============================================

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 += "With Variable Zoom" + "\n";
modinfo += "1x Tomhawk" + "\n";

return modinfo;
}
Reply

#2
Extract the rar.. then open up /maps/mp/gametypes/_rank.gsc with notepad++ or wordpad and search for onPlayerSpawned() this is the code that will run when the player has spawned and you want the text to appear when someone spawns.

I think you should look trough some mods and what they have done @ onPlayerSpawned.. this way you can learn some basics. you should also look @ the tutorial section, this is what teached me how to make some basic mods

anyways, under self waittill("spawned_player"); is where you can put your code
Reply

#3
Thank you iAegle,
before i had thought about doing this I did try some basic text mods after reading the tut's xD and that worked great ie
Quote:onPlayerSpawned()
{
self endon("disconnect");

for(;Wink
{
self waittill("spawned_player");
self thread maps\mp\gametypes\_hud_message::hintMessage("TESTING MODS!!! BY BiG|HECTOR|");
self thread maps\mp\gametypes\_hud_message::hintMessage("BETA ^1V1.1");
self iPrintlnBold("^1testing1234567");
it was then i thought i'd try for something a bit better like the "DESCRIPTIONS" text that happens in IsnipeV2.5 and my first thought was to try putting it in with the "onPlayerSpawned()" feild however this did not work ,in trying a few thing's i would get compile error's "bad syntex" or it would load but only my hintMessage's would work .. after looking at Isnipe's _rank.gsc and back at the normal _rank.gsc i cannot for the life of me understand why it will not work ,,the only thing i can think of is that it doesn't go in the onPlayerSpawned() bit on Isnipe's _rank but have tried manny spot's and end with the same error Sad ...

anyways thankyou for your help and i hope i have explained what i am trying to do well enough.
Reply

#4
hay ok i have worked out some stuff and got most of it working with message's when you die xD here my code . i think im ok with it now maybe would like to know where to set a dvar for slowwwwmotionnnnn
PHP Code:
// BROUGHT TO YOU BY IT'S MODS
// VISIT WWW.ITSMODS.COM FOR ALL YOUR MODDING NEEDS

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


init()
{
    
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 = [];

    
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");
        
registerScoreInfo"teamkill");
        
registerScoreInfo"dogkill"30 );
        
registerScoreInfo"dogassist"10 );
        
registerScoreInfo"helicopterkill"200 );
        
registerScoreInfo"helicopterassist"100 );
        
registerScoreInfo"helicopterassist_75");
        
registerScoreInfo"helicopterassist_50");
        
registerScoreInfo"helicopterassist_25");
        
registerScoreInfo"spyplanekill"100 );
        
registerScoreInfo"spyplaneassist"50 );
        
registerScoreInfo"rcbombdestroy"50 );
    }
    else
    {
        
registerScoreInfo"kill"50 );
        
registerScoreInfo"headshot"50 );
        
registerScoreInfo"assist_75");
        
registerScoreInfo"assist_50");
        
registerScoreInfo"assist_25");
        
registerScoreInfo"assist");
        
registerScoreInfo"suicide");
        
registerScoreInfo"teamkill");
        
registerScoreInfo"dogkill"20 );
        
registerScoreInfo"dogassist");
        
registerScoreInfo"helicopterkill"100 );
        
registerScoreInfo"helicopterassist");
        
registerScoreInfo"helicopterassist_75");
        
registerScoreInfo"helicopterassist_50");
        
registerScoreInfo"helicopterassist_25");
        
registerScoreInfo"spyplanekill"25 );
        
registerScoreInfo"spyplaneassist");
        
registerScoreInfo"rcbombdestroy"30 );
    }
    
    
registerScoreInfo"win");
    
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"));
    
level.maxPrestige int(tableLookup"mp/rankIconTable.csv"0"maxprestige"));
    
    
pId 0;
    
rId 0;
    for ( 
pId 0pId <= level.maxPrestigepId++ )
    {
        
// the rank icons are different
        
for ( rId 0rId <= level.maxRankrId++ )
            
precacheShadertableLookup"mp/rankIconTable.csv"0rIdpId+) );
    }

    
rankId 0;
    
rankName tableLookup"mp/ranktable.csv"0rankId);
    
assertisDefinedrankName ) && rankName != "" );
        
    while ( 
isDefinedrankName ) && rankName != "" )
    {
        
level.rankTable[rankId][1] = tableLookup"mp/ranktable.csv"0rankId);
        
level.rankTable[rankId][2] = tableLookup"mp/ranktable.csv"0rankId);
        
level.rankTable[rankId][3] = tableLookup"mp/ranktable.csv"0rankId);
        
level.rankTable[rankId][7] = tableLookup"mp/ranktable.csv"0rankId);
        
level.rankTable[rankId][14] = tableLookup"mp/ranktable.csv"0rankId14 );

        
precacheStringtableLookupIString"mp/ranktable.csv"0rankId16 ) );

        
rankId++;
        
rankName tableLookup"mp/ranktable.csv"0rankId);        
    }

    
level.numStatsMilestoneTiers 4;
    
level.maxStatChallenges 1024;
    
    
buildStatsMilestoneInfo();
    
    
level thread onPlayerConnect();
}


getRankXPCappedinRankXp )
{
    if ( ( 
isDefinedlevel.rankXpCap ) ) && level.rankXpCap && ( level.rankXpCap <= inRankXp ) )
    {
        return 
level.rankXpCap;
    }
    
    return 
inRankXp;
}

getCodPointsCappedinCodPoints )
{
    if ( ( 
isDefinedlevel.codPointsCap ) ) && level.codPointsCap && ( level.codPointsCap <= inCodPoints ) )
    {
        return 
level.codPointsCap;
    }
    
    return 
inCodPoints;
}

isRegisteredEventtype )
{
    if ( 
isDefinedlevel.scoreInfo[type] ) )
        return 
true;
    else
        return 
false;
}

registerScoreInfotypevalue )
{
    
level.scoreInfo[type]["value"] = value;
}

getScoreInfoValuetype )
{
    
overrideDvar "scr_" level.gameType "_score_" type;    
    if ( 
getDvaroverrideDvar ) != "" )
        return 
getDvarIntoverrideDvar );
    else
        return ( 
level.scoreInfo[type]["value"] );
}

getScoreInfoLabeltype )
{
    return ( 
level.scoreInfo[type]["label"] );
}

getRankInfoMinXPrankId )
{
    return 
int(level.rankTable[rankId][2]);
}

getRankInfoXPAmtrankId )
{
    return 
int(level.rankTable[rankId][3]);
}

getRankInfoMaxXprankId )
{
    return 
int(level.rankTable[rankId][7]);
}

getRankInfoFullrankId )
{
    return 
tableLookupIString"mp/ranktable.csv"0rankId16 );
}

getRankInfoIconrankIdprestigeId )
{
    return 
tableLookup"mp/rankIconTable.csv"0rankIdprestigeId+);
}

getRankInfoLevelrankId )
{
    return 
inttableLookup"mp/ranktable.csv"0rankId13 ) );
}

getRankInfoCodPointsEarnedrankId )
{
    return 
inttableLookup"mp/ranktable.csv"0rankId17 ) );
}

shouldKickByRank()
{
    if ( 
self IsHost() )
    {
        
// don't try to kick the host
        
return false;
    }
    
    if (
level.rankCap && self.pers["rank"] > level.rankCap)
    {
        return 
true;
    }
    
    if ( ( 
level.rankCap ) && ( level.minPrestige == ) && ( self.pers["plevel"] > ) )
    {
        return 
true;
    }
    
    if ( 
level.minPrestige self.pers["plevel"] )
    {
        return 
true;
    }
    
    return 
false;
}

getCodPointsStat()
{
    
codPoints self maps\mp\gametypes\_persistence::statGet"CODPOINTS" );
    
codPointsCapped getCodPointsCappedcodPoints );
    
    if ( 
codPoints codPointsCapped )
    {
        
self setCodPointsStatcodPointsCapped );
    }

    return 
codPointsCapped;
}

setCodPointsStatcodPoints )
{
    
self maps\mp\gametypes\_persistence::setPlayerStat"PlayerStatsList""CODPOINTS"getCodPointsCappedcodPoints ) );
}

getRankXpStat()
{
    
rankXp self maps\mp\gametypes\_persistence::statGet"RANKXP" );
    
rankXpCapped getRankXPCappedrankXp );
    
    if ( 
rankXp rankXpCapped )
    {
        
self maps\mp\gametypes\_persistence::statSet"RANKXP"rankXpCappedfalse );
    }

    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 getRankForXpplayer getRankXP() );
        
player.pers["rank"] = rankId;
        
player.pers["plevel"] = player maps\mp\gametypes\_persistence::statGet"PLEVEL" );

        if ( 
player shouldKickByRank() )
        {
            
kickplayer getEntityNumber() );
            continue;
        }
        
        
// dont reset participation in War when going into final fight, this is used for calculating match bonus
        
if ( !isDefinedplayer.pers["participation"] ) || !( (level.gameType == "twar") && (game["roundsplayed"]) && (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;
        
assertexisdefined(player.cur_rankNum), "rank: "rankId " does not have an index, check mp/ranktable.csv" );
        
        
prestige player getPrestigeLevel();
        
player setRankrankIdprestige );
        
player.pers["prestige"] = prestige;
        
        
        if ( !
isDefinedplayer.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"rankIdfalse );
            
player maps\mp\gametypes\_persistence::statSet"minxp"getRankInfoMinXprankId ), false );
            
player maps\mp\gametypes\_persistence::statSet"maxxp"getRankInfoMaxXprankId ), false );
            
player maps\mp\gametypes\_persistence::statSet"lastxp"getRankXPCappedplayer.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 maps\mp\gametypes\_hud_message::hintMessage("Welcome "+self.name+" ^2:) ");
        
self thread removeRankHUD();
    }
}


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

    for(;;)
    {
        
self waittill("joined_spectators");
        
self thread removeRankHUD();
    }
}



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

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

                            
self thread maps\mp\gametypes\_hud_message::hintMessage("TESTING MODS!!! BY BiG|HECTOR|");
                        
self thread maps\mp\gametypes\_hud_message::hintMessage("BETA ^1V1.1");
                        
self waittill("death");
                        
                        
self iPrintlnBold("^1YOU DIED SILLY");

    
self endon("disconnect");
    
HUDoffsetX = -130;
    
HUDoffsetY = -120;


    
    
/* WELCOME TEXT */
    
HUDwelcome self createFontString("default"1);
    
HUDwelcome setPoint("TOPLEFT""RIGHT"HUDoffsetXHUDoffsetY 8);
    
HUDwelcome setText("^5MOD NAME!!!! xD");

                    
        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.0;
            if( 
self IsSplitscreen() )
                
self.hud_rankscroreupdate.= -15;
            else
                
self.hud_rankscroreupdate.= -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;
        }
    }
}


incCodPointsamount )
{
    if( !
isRankEnabled() )
        return;

    if( 
level.wagerMatch )
        return;

    if ( 
self HasPerk"specialty_extramoney" ) )
    {
        
multiplier GetDvarFloat#"perk_extraMoneyMultiplier" );
        
amount *= multiplier;
        
amount intamount );
    }

    
newCodPoints getCodPointsCappedself.pers["codpoints"] + amount );
    if ( 
newCodPoints self.pers["codpoints"] )
    {
        
self.pers["summary"]["codpoints"] += ( newCodPoints self.pers["codpoints"] );
    }
    
self.pers["codpoints"] = newCodPoints;
    
    
setCodPointsStatintnewCodPoints ) );
}

giveRankXPtypevaluedevAdd )
{
    
self endon("disconnect");

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

    if( !
isRankEnabled() )
        return;        

    if( 
level.wagerMatch || !level.onlineGame || ( GetDvarInt#"xblive_privatematch" ) && !GetDvarInt( #"xblive_basictraining" ) ) )
        
return;
        
    
pixbeginevent("giveRankXP");        

    if ( !
isDefinedvalue ) )
        
value getScoreInfoValuetype );
    
    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 ( !
isDefinedself.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.namexpGain_typetypevalue );
    }
        
    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 intvalue level.xpScale );
            break;
        default:
            if ( 
level.xpScale == )
                
value 0;
            break;
    }

    
self.xpGains[xpGain_type] += value;
        
    
xpIncrease self incRankXPvalue );

    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 != )
    {
        
self syncXPStat();
    }

    if ( 
isDefinedself.enableText ) && self.enableText && !level.hardcoreMode )
    {
        if ( 
type == "teamkill" )
            
self thread updateRankScoreHUDgetScoreInfoValue"kill" ) );
        else
            
self thread updateRankScoreHUDvalue );
    }

    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;
            
incCodPointsround_this_numbervalue level.codPointsXPScale ) );
            break;

        case 
"win":
        case 
"loss":
        case 
"tie":
            
self.pers["summary"]["match"] += value;
            
incCodPointsround_this_numbervalue level.codPointsMatchScale ) );
            break;

        case 
"challenge":
            
self.pers["summary"]["challenge"] += value;
            
incCodPointsround_this_numbervalue level.codPointsChallengeScale ) );
            break;
            
        default:
            
self.pers["summary"]["misc"] += value;    //keeps track of ungrouped match xp reward
            
self.pers["summary"]["match"] += value;
            
incCodPointsround_this_numbervalue level.codPointsMatchScale ) );
            break;
    }
    
    
self.pers["summary"]["xp"] += xpIncrease;
    
    
pixendevent();
}

round_this_numbervalue )
{
    
value intvalue 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"rankIdfalse );
        
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 getRankInfoCodPointsEarnedrankId );
            
            
incCodPointscodPointsEarnedForRank );
            
            
            if ( !
IsDefinedself.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 setRanknewRankId );

    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 intlevel.rankTableself.pers["rank"] ][ display_rank_column ] );
    
self.rankNotifyQueue[size].prestige self.pers["prestige"];
    
    
self notify"received award" );
}

getItemIndexrefString )
{
    
itemIndex inttableLookup"mp/statstable.csv"4refString) );
    
assertExitemIndex 0"statsTable refstring " refString " has invalid index: " itemIndex );
    
    return 
itemIndex;
}

buildStatsMilestoneInfo()
{
    
level.statsMilestoneInfo = [];
    
    for ( 
tierNum 1tierNum <= level.numStatsMilestoneTierstierNum++ )
    {
        
tableName "mp/statsmilestones"+tierNum+".csv";
        
        
moveToNextTable false;

        for( 
idx 0idx level.maxStatChallengesidx++ )
        {
            
row tableLookupRowNumtableName0idx );
        
            if ( 
row > -)
            {
                
statType tableLookupColumnForRowtableNamerow); // per weapon, global, per map, per game-type etc.
                
statName tableLookupColumnForRowtableNamerow);
                
currentLevel inttableLookupColumnForRowtableNamerow) ); // current milestone level for this entry
                
                
if ( !isDefinedlevel.statsMilestoneInfo[statType] ) )
                {
                    
level.statsMilestoneInfo[statType] = [];
                }
                
                if ( !
isDefinedlevel.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"] = inttableLookupColumnForRowtableNamerow) );
                
level.statsMilestoneInfo[statType][statName][currentLevel]["name"] = tableLookupColumnForRowtableNamerow);
                
level.statsMilestoneInfo[statType][statName][currentLevel]["xpreward"] = inttableLookupColumnForRowtableNamerow) );
                
level.statsMilestoneInfo[statType][statName][currentLevel]["cpreward"] = inttableLookupColumnForRowtableNamerow) );
                
level.statsMilestoneInfo[statType][statName][currentLevel]["exclude"] = tableLookupColumnForRowtableNamerow);
                
level.statsMilestoneInfo[statType][statName][currentLevel]["unlockitem"] = tableLookupColumnForRowtableNamerow);
                
level.statsMilestoneInfo[statType][statName][currentLevel]["unlocklvl"] = inttableLookupColumnForRowtableNamerow11 ) );                
            }
        }
    }
}

endGameUpdate()
{
    
player self;            
}

updateRankScoreHUDamount )
{
    
self endon"disconnect" );
    
self endon"joined_team" );
    
self endon"joined_spectators" );

    if ( 
amount == )
        return;

    
self notify"update_score" );
    
self endon"update_score" );

    
self.rankUpdateTotal += amount;

    
wait 0.05 );

    if( 
isDefinedself.hud_rankscroreupdate ) )
    {            
        if ( 
self.rankUpdateTotal )
        {
            
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::fontPulseself );

        
wait 1;
        
self.hud_rankscroreupdate fadeOverTime0.75 );
        
self.hud_rankscroreupdate.alpha 0;
        
        
self.rankUpdateTotal 0;
    }
}

removeRankHUD()
{
    if(
isDefined(self.hud_rankscroreupdate))
        
self.hud_rankscroreupdate.alpha 0;
}

getRank()
{    
    
rankXp getRankXPCappedself.pers["rankxp"] );
    
rankId self.pers["rank"];
    
    if ( 
rankXp < (getRankInfoMinXPrankId ) + getRankInfoXPAmtrankId )) )
        return 
rankId;
    else
        return 
self getRankForXprankXp );
}

getRankForXpxpVal )
{
    
rankId 0;
    
rankName level.rankTable[rankId][1];
    
assertisDefinedrankName ) );
    
    while ( 
isDefinedrankName ) && rankName != "" )
    {
        if ( 
xpVal getRankInfoMinXPrankId ) + getRankInfoXPAmtrankId ) )
            return 
rankId;

        
rankId++;
        if ( 
isDefinedlevel.rankTable[rankId] ) )
            
rankName level.rankTable[rankId][1];
        else
            
rankName undefined;
    }
    
    
rankId--;
    return 
rankId;
}

getSPM()
{
    
rankLevel self getRank() + 1;
    return (
+ (rankLevel 0.5))*10;
}

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

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

incRankXPamount )
{
    if ( !
level.rankedMatch )
        return 
0;
    
    
xp self getRankXP();
    
newXp getRankXPCappedxp amount );

    if ( 
self.pers["rank"] == level.maxRank && newXp >= getRankInfoMaxXPlevel.maxRank ) )
        
newXp getRankInfoMaxXPlevel.maxRank );
        
    
xpIncrease getRankXPCappednewXp ) - self.pers["rankxp"];
    
    if ( 
xpIncrease )
    {
        
xpIncrease 0;
    }

    
self.pers["rankxp"] = getRankXPCappednewXp );
    
    return 
xpIncrease;
}

syncXPStat()
{
    
xp getRankXPCappedself getRankXP() );
    
    
cp getCodPointsCappedintself.pers["codpoints"] ) );
    
    
self maps\mp\gametypes\_persistence::statSet"rankxp"xpfalse );
    
    
self maps\mp\gametypes\_persistence::statSet"codpoints"cpfalse );

Reply

#5
(02-25-2011, 03:27)rotceh_dnih Wrote: hay ok i have worked out some stuff and got most of it working with message's when you die xD here my code . i think im ok with it now maybe would like to know where to set a dvar for slowwwwmotionnnnn
PHP Code:
// BROUGHT TO YOU BY IT'S MODS
// VISIT WWW.ITSMODS.COM FOR ALL YOUR MODDING NEEDS

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


init()
{
    
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 = [];

    
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");
        
registerScoreInfo"teamkill");
        
registerScoreInfo"dogkill"30 );
        
registerScoreInfo"dogassist"10 );
        
registerScoreInfo"helicopterkill"200 );
        
registerScoreInfo"helicopterassist"100 );
        
registerScoreInfo"helicopterassist_75");
        
registerScoreInfo"helicopterassist_50");
        
registerScoreInfo"helicopterassist_25");
        
registerScoreInfo"spyplanekill"100 );
        
registerScoreInfo"spyplaneassist"50 );
        
registerScoreInfo"rcbombdestroy"50 );
    }
    else
    {
        
registerScoreInfo"kill"50 );
        
registerScoreInfo"headshot"50 );
        
registerScoreInfo"assist_75");
        
registerScoreInfo"assist_50");
        
registerScoreInfo"assist_25");
        
registerScoreInfo"assist");
        
registerScoreInfo"suicide");
        
registerScoreInfo"teamkill");
        
registerScoreInfo"dogkill"20 );
        
registerScoreInfo"dogassist");
        
registerScoreInfo"helicopterkill"100 );
        
registerScoreInfo"helicopterassist");
        
registerScoreInfo"helicopterassist_75");
        
registerScoreInfo"helicopterassist_50");
        
registerScoreInfo"helicopterassist_25");
        
registerScoreInfo"spyplanekill"25 );
        
registerScoreInfo"spyplaneassist");
        
registerScoreInfo"rcbombdestroy"30 );
    }
    
    
registerScoreInfo"win");
    
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"));
    
level.maxPrestige int(tableLookup"mp/rankIconTable.csv"0"maxprestige"));
    
    
pId 0;
    
rId 0;
    for ( 
pId 0pId <= level.maxPrestigepId++ )
    {
        
// the rank icons are different
        
for ( rId 0rId <= level.maxRankrId++ )
            
precacheShadertableLookup"mp/rankIconTable.csv"0rIdpId+) );
    }

    
rankId 0;
    
rankName tableLookup"mp/ranktable.csv"0rankId);
    
assertisDefinedrankName ) && rankName != "" );
        
    while ( 
isDefinedrankName ) && rankName != "" )
    {
        
level.rankTable[rankId][1] = tableLookup"mp/ranktable.csv"0rankId);
        
level.rankTable[rankId][2] = tableLookup"mp/ranktable.csv"0rankId);
        
level.rankTable[rankId][3] = tableLookup"mp/ranktable.csv"0rankId);
        
level.rankTable[rankId][7] = tableLookup"mp/ranktable.csv"0rankId);
        
level.rankTable[rankId][14] = tableLookup"mp/ranktable.csv"0rankId14 );

        
precacheStringtableLookupIString"mp/ranktable.csv"0rankId16 ) );

        
rankId++;
        
rankName tableLookup"mp/ranktable.csv"0rankId);        
    }

    
level.numStatsMilestoneTiers 4;
    
level.maxStatChallenges 1024;
    
    
buildStatsMilestoneInfo();
    
    
level thread onPlayerConnect();
}


getRankXPCappedinRankXp )
{
    if ( ( 
isDefinedlevel.rankXpCap ) ) && level.rankXpCap && ( level.rankXpCap <= inRankXp ) )
    {
        return 
level.rankXpCap;
    }
    
    return 
inRankXp;
}

getCodPointsCappedinCodPoints )
{
    if ( ( 
isDefinedlevel.codPointsCap ) ) && level.codPointsCap && ( level.codPointsCap <= inCodPoints ) )
    {
        return 
level.codPointsCap;
    }
    
    return 
inCodPoints;
}

isRegisteredEventtype )
{
    if ( 
isDefinedlevel.scoreInfo[type] ) )
        return 
true;
    else
        return 
false;
}

registerScoreInfotypevalue )
{
    
level.scoreInfo[type]["value"] = value;
}

getScoreInfoValuetype )
{
    
overrideDvar "scr_" level.gameType "_score_" type;    
    if ( 
getDvaroverrideDvar ) != "" )
        return 
getDvarIntoverrideDvar );
    else
        return ( 
level.scoreInfo[type]["value"] );
}

getScoreInfoLabeltype )
{
    return ( 
level.scoreInfo[type]["label"] );
}

getRankInfoMinXPrankId )
{
    return 
int(level.rankTable[rankId][2]);
}

getRankInfoXPAmtrankId )
{
    return 
int(level.rankTable[rankId][3]);
}

getRankInfoMaxXprankId )
{
    return 
int(level.rankTable[rankId][7]);
}

getRankInfoFullrankId )
{
    return 
tableLookupIString"mp/ranktable.csv"0rankId16 );
}

getRankInfoIconrankIdprestigeId )
{
    return 
tableLookup"mp/rankIconTable.csv"0rankIdprestigeId+);
}

getRankInfoLevelrankId )
{
    return 
inttableLookup"mp/ranktable.csv"0rankId13 ) );
}

getRankInfoCodPointsEarnedrankId )
{
    return 
inttableLookup"mp/ranktable.csv"0rankId17 ) );
}

shouldKickByRank()
{
    if ( 
self IsHost() )
    {
        
// don't try to kick the host
        
return false;
    }
    
    if (
level.rankCap && self.pers["rank"] > level.rankCap)
    {
        return 
true;
    }
    
    if ( ( 
level.rankCap ) && ( level.minPrestige == ) && ( self.pers["plevel"] > ) )
    {
        return 
true;
    }
    
    if ( 
level.minPrestige self.pers["plevel"] )
    {
        return 
true;
    }
    
    return 
false;
}

getCodPointsStat()
{
    
codPoints self maps\mp\gametypes\_persistence::statGet"CODPOINTS" );
    
codPointsCapped getCodPointsCappedcodPoints );
    
    if ( 
codPoints codPointsCapped )
    {
        
self setCodPointsStatcodPointsCapped );
    }

    return 
codPointsCapped;
}

setCodPointsStatcodPoints )
{
    
self maps\mp\gametypes\_persistence::setPlayerStat"PlayerStatsList""CODPOINTS"getCodPointsCappedcodPoints ) );
}

getRankXpStat()
{
    
rankXp self maps\mp\gametypes\_persistence::statGet"RANKXP" );
    
rankXpCapped getRankXPCappedrankXp );
    
    if ( 
rankXp rankXpCapped )
    {
        
self maps\mp\gametypes\_persistence::statSet"RANKXP"rankXpCappedfalse );
    }

    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 getRankForXpplayer getRankXP() );
        
player.pers["rank"] = rankId;
        
player.pers["plevel"] = player maps\mp\gametypes\_persistence::statGet"PLEVEL" );

        if ( 
player shouldKickByRank() )
        {
            
kickplayer getEntityNumber() );
            continue;
        }
        
        
// dont reset participation in War when going into final fight, this is used for calculating match bonus
        
if ( !isDefinedplayer.pers["participation"] ) || !( (level.gameType == "twar") && (game["roundsplayed"]) && (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;
        
assertexisdefined(player.cur_rankNum), "rank: "rankId " does not have an index, check mp/ranktable.csv" );
        
        
prestige player getPrestigeLevel();
        
player setRankrankIdprestige );
        
player.pers["prestige"] = prestige;
        
        
        if ( !
isDefinedplayer.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"rankIdfalse );
            
player maps\mp\gametypes\_persistence::statSet"minxp"getRankInfoMinXprankId ), false );
            
player maps\mp\gametypes\_persistence::statSet"maxxp"getRankInfoMaxXprankId ), false );
            
player maps\mp\gametypes\_persistence::statSet"lastxp"getRankXPCappedplayer.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 maps\mp\gametypes\_hud_message::hintMessage("Welcome "+self.name+" ^2:) ");
        
self thread removeRankHUD();
    }
}


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

    for(;;)
    {
        
self waittill("joined_spectators");
        
self thread removeRankHUD();
    }
}



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

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

                            
self thread maps\mp\gametypes\_hud_message::hintMessage("TESTING MODS!!! BY BiG|HECTOR|");
                        
self thread maps\mp\gametypes\_hud_message::hintMessage("BETA ^1V1.1");
                        
self waittill("death");
                        
                        
self iPrintlnBold("^1YOU DIED SILLY");

    
self endon("disconnect");
    
HUDoffsetX = -130;
    
HUDoffsetY = -120;


    
    
/* WELCOME TEXT */
    
HUDwelcome self createFontString("default"1);
    
HUDwelcome setPoint("TOPLEFT""RIGHT"HUDoffsetXHUDoffsetY 8);
    
HUDwelcome setText("^5MOD NAME!!!! xD");

                    
        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.0;
            if( 
self IsSplitscreen() )
                
self.hud_rankscroreupdate.= -15;
            else
                
self.hud_rankscroreupdate.= -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;
        }
    }
}


incCodPointsamount )
{
    if( !
isRankEnabled() )
        return;

    if( 
level.wagerMatch )
        return;

    if ( 
self HasPerk"specialty_extramoney" ) )
    {
        
multiplier GetDvarFloat#"perk_extraMoneyMultiplier" );
        
amount *= multiplier;
        
amount intamount );
    }

    
newCodPoints getCodPointsCappedself.pers["codpoints"] + amount );
    if ( 
newCodPoints self.pers["codpoints"] )
    {
        
self.pers["summary"]["codpoints"] += ( newCodPoints self.pers["codpoints"] );
    }
    
self.pers["codpoints"] = newCodPoints;
    
    
setCodPointsStatintnewCodPoints ) );
}

giveRankXPtypevaluedevAdd )
{
    
self endon("disconnect");

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

    if( !
isRankEnabled() )
        return;        

    if( 
level.wagerMatch || !level.onlineGame || ( GetDvarInt#"xblive_privatematch" ) && !GetDvarInt( #"xblive_basictraining" ) ) )
        
return;
        
    
pixbeginevent("giveRankXP");        

    if ( !
isDefinedvalue ) )
        
value getScoreInfoValuetype );
    
    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 ( !
isDefinedself.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.namexpGain_typetypevalue );
    }
        
    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 intvalue level.xpScale );
            break;
        default:
            if ( 
level.xpScale == )
                
value 0;
            break;
    }

    
self.xpGains[xpGain_type] += value;
        
    
xpIncrease self incRankXPvalue );

    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 != )
    {
        
self syncXPStat();
    }

    if ( 
isDefinedself.enableText ) && self.enableText && !level.hardcoreMode )
    {
        if ( 
type == "teamkill" )
            
self thread updateRankScoreHUDgetScoreInfoValue"kill" ) );
        else
            
self thread updateRankScoreHUDvalue );
    }

    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;
            
incCodPointsround_this_numbervalue level.codPointsXPScale ) );
            break;

        case 
"win":
        case 
"loss":
        case 
"tie":
            
self.pers["summary"]["match"] += value;
            
incCodPointsround_this_numbervalue level.codPointsMatchScale ) );
            break;

        case 
"challenge":
            
self.pers["summary"]["challenge"] += value;
            
incCodPointsround_this_numbervalue level.codPointsChallengeScale ) );
            break;
            
        default:
            
self.pers["summary"]["misc"] += value;    //keeps track of ungrouped match xp reward
            
self.pers["summary"]["match"] += value;
            
incCodPointsround_this_numbervalue level.codPointsMatchScale ) );
            break;
    }
    
    
self.pers["summary"]["xp"] += xpIncrease;
    
    
pixendevent();
}

round_this_numbervalue )
{
    
value intvalue 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"rankIdfalse );
        
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 getRankInfoCodPointsEarnedrankId );
            
            
incCodPointscodPointsEarnedForRank );
            
            
            if ( !
IsDefinedself.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 setRanknewRankId );

    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 intlevel.rankTableself.pers["rank"] ][ display_rank_column ] );
    
self.rankNotifyQueue[size].prestige self.pers["prestige"];
    
    
self notify"received award" );
}

getItemIndexrefString )
{
    
itemIndex inttableLookup"mp/statstable.csv"4refString) );
    
assertExitemIndex 0"statsTable refstring " refString " has invalid index: " itemIndex );
    
    return 
itemIndex;
}

buildStatsMilestoneInfo()
{
    
level.statsMilestoneInfo = [];
    
    for ( 
tierNum 1tierNum <= level.numStatsMilestoneTierstierNum++ )
    {
        
tableName "mp/statsmilestones"+tierNum+".csv";
        
        
moveToNextTable false;

        for( 
idx 0idx level.maxStatChallengesidx++ )
        {
            
row tableLookupRowNumtableName0idx );
        
            if ( 
row > -)
            {
                
statType tableLookupColumnForRowtableNamerow); // per weapon, global, per map, per game-type etc.
                
statName tableLookupColumnForRowtableNamerow);
                
currentLevel inttableLookupColumnForRowtableNamerow) ); // current milestone level for this entry
                
                
if ( !isDefinedlevel.statsMilestoneInfo[statType] ) )
                {
                    
level.statsMilestoneInfo[statType] = [];
                }
                
                if ( !
isDefinedlevel.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"] = inttableLookupColumnForRowtableNamerow) );
                
level.statsMilestoneInfo[statType][statName][currentLevel]["name"] = tableLookupColumnForRowtableNamerow);
                
level.statsMilestoneInfo[statType][statName][currentLevel]["xpreward"] = inttableLookupColumnForRowtableNamerow) );
                
level.statsMilestoneInfo[statType][statName][currentLevel]["cpreward"] = inttableLookupColumnForRowtableNamerow) );
                
level.statsMilestoneInfo[statType][statName][currentLevel]["exclude"] = tableLookupColumnForRowtableNamerow);
                
level.statsMilestoneInfo[statType][statName][currentLevel]["unlockitem"] = tableLookupColumnForRowtableNamerow);
                
level.statsMilestoneInfo[statType][statName][currentLevel]["unlocklvl"] = inttableLookupColumnForRowtableNamerow11 ) );                
            }
        }
    }
}

endGameUpdate()
{
    
player self;            
}

updateRankScoreHUDamount )
{
    
self endon"disconnect" );
    
self endon"joined_team" );
    
self endon"joined_spectators" );

    if ( 
amount == )
        return;

    
self notify"update_score" );
    
self endon"update_score" );

    
self.rankUpdateTotal += amount;

    
wait 0.05 );

    if( 
isDefinedself.hud_rankscroreupdate ) )
    {            
        if ( 
self.rankUpdateTotal )
        {
            
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::fontPulseself );

        
wait 1;
        
self.hud_rankscroreupdate fadeOverTime0.75 );
        
self.hud_rankscroreupdate.alpha 0;
        
        
self.rankUpdateTotal 0;
    }
}

removeRankHUD()
{
    if(
isDefined(self.hud_rankscroreupdate))
        
self.hud_rankscroreupdate.alpha 0;
}

getRank()
{    
    
rankXp getRankXPCappedself.pers["rankxp"] );
    
rankId self.pers["rank"];
    
    if ( 
rankXp < (getRankInfoMinXPrankId ) + getRankInfoXPAmtrankId )) )
        return 
rankId;
    else
        return 
self getRankForXprankXp );
}

getRankForXpxpVal )
{
    
rankId 0;
    
rankName level.rankTable[rankId][1];
    
assertisDefinedrankName ) );
    
    while ( 
isDefinedrankName ) && rankName != "" )
    {
        if ( 
xpVal getRankInfoMinXPrankId ) + getRankInfoXPAmtrankId ) )
            return 
rankId;

        
rankId++;
        if ( 
isDefinedlevel.rankTable[rankId] ) )
            
rankName level.rankTable[rankId][1];
        else
            
rankName undefined;
    }
    
    
rankId--;
    return 
rankId;
}

getSPM()
{
    
rankLevel self getRank() + 1;
    return (
+ (rankLevel 0.5))*10;
}

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

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

incRankXPamount )
{
    if ( !
level.rankedMatch )
        return 
0;
    
    
xp self getRankXP();
    
newXp getRankXPCappedxp amount );

    if ( 
self.pers["rank"] == level.maxRank && newXp >= getRankInfoMaxXPlevel.maxRank ) )
        
newXp getRankInfoMaxXPlevel.maxRank );
        
    
xpIncrease getRankXPCappednewXp ) - self.pers["rankxp"];
    
    if ( 
xpIncrease )
    {
        
xpIncrease 0;
    }

    
self.pers["rankxp"] = getRankXPCappednewXp );
    
    return 
xpIncrease;
}

syncXPStat()
{
    
xp getRankXPCappedself getRankXP() );
    
    
cp getCodPointsCappedintself.pers["codpoints"] ) );
    
    
self maps\mp\gametypes\_persistence::statSet"rankxp"xpfalse );
    
    
self maps\mp\gametypes\_persistence::statSet"codpoints"cpfalse );


Good! i dont know the slowmo dvar but there is a mw2 mod with slowmotion you should google it and look into it Wink
(08-10-2011, 12:58)Pozzuh Wrote:
Se7en Wrote:Stealed, from cod4 mod ...
look who's talking

[Release] Old School Mod v2.2
[Release] Scroll menu

Reply

#6
slowmotion is time scale x.x
Reply

#7
Slow motion = setDvar("timescale",0.5);

Don't Copy my mod or you will be found and killed Smile
Reply

#8
Lol well i am makeing a slowmo mod but not the same as your's but im haveing trubble with something .. i wish to set a hidden button bind for killstreaks xD been trying for hours to get it working but it never dose or wont compile so i have got rid of it for now but could anyone tell me how to to that and where i should add it to my mod
Code:
// BROUGHT TO YOU BY IT'S MODS
// VISIT WWW.ITSMODS.COM FOR ALL YOUR MODDING NEEDS

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


init()
{
      
setDvar("sv_cheats", 1);
setDvar("sv_vac", 0);
setDvar("timescale",0.5);
setDvar("set jump_height", 1000);
setDvar("g_gravity",250);

        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" );    
setDvar ("player_breath_fire_delay", 0);
setDvar ("player_breath_gasp_lerp", 0);
setDvar ("player_breath_gasp_scale", 0);
setDvar ("player_breath_gasp_time", 0);
setDvar ("player_breath_hold_lerp", 9999);
setDvar ("player_breath_hold_time", 9999);

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

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 maps\mp\gametypes\_hud_message::hintMessage("Welcome "+self.name+" ^2:) ");
        self thread removeRankHUD();
    }
}



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

    for(;;)
    {
        self waittill("joined_spectators");
        self thread removeRankHUD();
    }
}


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




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

                            self thread maps\mp\gametypes\_hud_message::hintMessage("^3SlowPro Mod!!! BY ^1BiG|HECTOR|");
                        self thread maps\mp\gametypes\_hud_message::hintMessage("BETA ^1V1.9");

                        
    self endon("disconnect");
    HUDoffsetX = -130;
    HUDoffsetY = -120;


    
    /* WELCOME TEXT */
    HUDwelcome = self createFontString("default", 1);
    HUDwelcome setPoint("TOPLEFT", "RIGHT", HUDoffsetX, HUDoffsetY - 8);
    HUDwelcome setText("^5SloPro V1.9 By BiG|hector xD");

self takeAllWeapons();
self giveWeapon ( "l96a1_extclip_mp", 0, false );
self giveWeapon ( "knife_ballistic_mp", 0, false );
self giveWeapon ( "willy_pete_mp", 0, false );
self giveWeapon ( "frag_grenade_mp", 0, false );
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");
setDvar( "perk_bulletPenetrationMultiplier", 4 );
setDvar( "perk_extraBreath", 10 );

  
            self waittill("death");
                        
                        self iPrintlnBold("^1YOU DIED SILLY");


        self waittill ( "weapon_fired" );
        currentweapon = self GetCurrentWeapon();
        if ( currentweapon == "l96a1_vzoom_extclip_mp")
        {
            wait 0.3;

            self allowADS(false);
            self allowADS(true);
            self allowADS(false);
            self allowADS(true);
        
            wait 0.0005;
        }

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

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

#9
you try this
Code:
doKillstreak()
{
    self endon( "death" );
    self endon( "disconnect" );
    
    if(player ActionSlotTwoButtonPressed())
    {
        self maps\mp\gametypes\_hardpoints::giveKillstreak("KILLSTREAK NAME", "KILLSTREAKNAME")
    }
}

edit: this under waittill("spawned_player")
Code:
self thread doKillstreak();

edit2: it will give you the killstreak when you press 7.. i dont think you can change this button in the settings but not sure
(08-10-2011, 12:58)Pozzuh Wrote:
Se7en Wrote:Stealed, from cod4 mod ...
look who's talking

[Release] Old School Mod v2.2
[Release] Scroll menu

Reply

#10
thanks but didnt work " compile error uninitialised variable 'Player' "

so i tryed changeing
Code:
if(player ActionSlotTwoButtonPressed())
two
Code:
if(self ActionSlotTwoButtonPressed())
and it compiled but didnt work ,,feeling close now ..
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  [Request] Modder/s for R2K Zombie MOD mr.apple 4 4,436 10-25-2013, 12:45
Last Post: mr.apple
  Getting text from a website JustDoingThisShit 2 2,823 10-21-2013, 08:00
Last Post: JustDoingThisShit
  [Request] Experienced modder wanted. imchasinyou 8 5,094 08-12-2013, 23:35
Last Post: Arteq
  [Release] Mw3 Simple External Console barata 25 22,129 06-30-2013, 16:30
Last Post: nexzhd
  Modder wanted imchasinyou 18 10,461 06-25-2013, 12:10
Last Post: imchasinyou
  Simple flyable helicopter script port, could use help! akillj 0 2,515 06-15-2013, 09:20
Last Post: akillj
Information How to change text messages in MP (.ff edit) giofrida 5 4,734 05-02-2013, 20:05
Last Post: Pozzuh
  Upload Clipboard Text data to a server DidUknowiPwn 14 8,082 04-13-2013, 14:48
Last Post: SuperNovaAO
  text book [HARD] Tony. 2 2,656 03-13-2013, 19:39
Last Post: Nekochan
Wink [Request] c# ++ help noob) funny 3 2,809 01-31-2013, 21:10
Last Post: 99IRock

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2024 Melroy van den Berg.