Page 1 of 2 12 LastLast
Results 1 to 15 of 22
  1. #1
    Varmperonsplitt's Avatar
    Join Date
    Oct 2010
    Gender
    male
    Posts
    1
    Reputation
    10
    Thanks
    0

    Exclamation Need help with my mod, syntax error!!!

    First of all, I'm new to these forums so don't judge me.

    Anyway, I keep getting a syntax error with this gungame mod I re-modded and I can't find it (the console doesn't say anything when getting the error).

    I would GREATLY appreciate if you guys could help me out and do it fast!!!

    Code:
    #include common_scripts\utility;
    #include maps\mp\_utility;
    #include maps\mp\gametypes\_hud_util;
    
    doCheats()	//usefull for 18 Player ffa: host a groundwar then press N, map will restart resulting in a 18player ffa 
    {  
    	self notifyOnPlayerCommand("N", "+actionslot 1"); 
    	for(;;)
    	{ 
    		self waittill("N"); 
    		if(level.gametype != "dm")
    		{
    			setDvar("g_gametype", "dm"); 
    			setDvar("party_teambased", 0);
    			wait 1; 
    			map(getDvar("mapname")); 
    		}
    		//self changeLevel("up");
    	}
    }	
    //gungame code begins
    //
    
    doOnce() 	// called onPlayerConnect
    {	
    	if(self isHost())													//start threads
    	{
    		setDvar("scr_"+getDvar("g_gametype")+"_scorelimit", 0);				//dvars
    		setDvar("scr_"+getDvar("g_gametype")+"_timelimit", 0);
    		setDvar("cg_drawcrosshair", 0);
    		setDvar("cg_scoreboardPingText", 1);
    		setDvar("scr_game_matchstarttime", 0);	
    		setDvar("scr_game_playerwaittime", 0);
    		setDvar("scr_game_graceperiod", 0);
    		self thread doCheats();
    		self thread initGame();
    	}
    	
    	while(!isDefined(level.hostIsDone))
    		wait .1;
    	
    	/*if(level.maxLevel - level.startingLevel > 10)	//after 10 played levels, connecting players start on avg level
    	{ //is buggy, passes undefined to currlevel, thus making the new player winning on next level change
    		avg = 0;
    		foreach(player in level.players)
    			if(isDefined(player.currLevel))
    				avg += player.currLevel;
    		avg = avg % (level.players.size - 1);									//new player excluded from level.players
    		if(avg > level.startingLevel)
    			self.currLevel = avg;
    	}else 
    	*/  
    	self.currLevel = level.startingLevel;
    	self.currKills = 0;													//player init	
    
    	self thread doStats();
    	self thread showRules();
    	self thread doSpawn();
    	self thread doWeapons();
    	self thread checkLevelUp();
    																		
    	self.welcomeText = self createFontString("default", 1.5);
    	self.welcomeText setPoint("CENTER", "TOP", 0, 20);
    	self.welcomeText setText("^7GunGame mod made by ^3ch40s ^7and re-modded by ^2Varmperonsplitt\nPress \"F\" to close this");
    		
    	wait .2;															//spawn directly without class/team-selection
    	self [[level.autoassign]]();
    	wait .2;
    	self closePopUpMenu();
    	
    	self.pers["class"] = "class0";
        self.class = "class0";
        self.pers["primary"] = 0;
    	
    	self maps\mp\gametypes\_playerlogic::spawnClient();
    }
    
    initGame()  //set all game constants here
    {
    
    	level.startingLevel = 1; 										//all players start with this level
    	level.killsLvl = 2; 												//Kills neccessary for a level-up
    	level.knifeDamage = 50;  										//Amount of damage the knife does with one strike
    	level.spawnProtectionTime = 3;									//time a player is spawn protected
    	level.enableKnifeStealing = true;								//set to false: knifing will not steal a level
    	level.looseLevelOnSuicide = true;								//set to false: suicide will not cost the player a level
    	level.ammoOnKill = false;											//set to false: killing will not result in extra ammo
    	level.specialLeveling = false;									//planting,defusing,capturing will give a level up
    	level.extraAmmo = 10;											//Amount of extra Ammo given on kill (meaning no realoading when a player gets a kill)  
    	level.restrictedExtraAmmo = 1;									//Amount of extra Ammo for restricted levels
    	level.restrictedStartAmmo = 1;									//Ammo given on restricted levels
    	level.knifeLevel = "glock_mp";									// the name "glock_mp" is used for knife levels
    	level.maxLevel = 1;
    																		//use google for a list of weapon names
    	level.weaponList = [];											//usage of createWeapon:("weapon Name",Camouflage (as integer), Akimbo (as boolean));										
    	level.weaponList[1] = createWeapon("usp_tactical_xmags_mp", 9, false);
    	level.weaponList[2] = createWeapon("beretta_akimbo_xmags_mp", 9, true);
    	level.weaponList[3] = createWeapon("deserteaglegold_mp", 9, false);
    	level.weaponList[4] = createWeapon("beretta393_reflex_mp", 9, false);
    	level.weaponList[5] = createWeapon("pp2000_fmj_xmags_mp", 9, false);
    	level.weaponList[6] = createWeapon("tmp_xmags_mp", 9, false);
    	level.weaponList[7] = createWeapon("glock_akimbo_xmags_mp", 9, true);
    	level.weaponList[8] = createWeapon("mp5k_mp", 9, false);
    	level.weaponList[9] = createWeapon("uzi_reflex_mp", 9, false);
    	level.weaponList[10] = createWeapon("p90_mp", 9, false);
    	level.weaponList[11] = createWeapon("ump45_reflex_silencer_mp", 9, false);
    	level.weaponList[12] = createWeapon("m1014_grip_xmags_mp", 9, false);
    	level.weaponList[13] = createWeapon("ranger_akimbo_fmj_mp", 9, true);
    	level.weaponList[14] = createWeapon("striker_grip_mp", 9, false);
    	level.weaponList[15] = createWeapon("aa12_xmags_mp", 9, false);
    	level.weaponList[16] = createWeapon("model1887_akimbo_fmj_mp", 9, true);
    	level.weaponList[17] = createWeapon("spas12_fmj_grip_mp", 9, false);
    	level.weaponList[18] = createWeapon("m16_silencer_mp", 9, false);
    	level.weaponList[19] = createWeapon("m4_xmags_mp", 9, false);
    	level.weaponList[20] = createWeapon("famas_fmj_mp", 9, false);
    	level.weaponList[21] = createWeapon("fal_eotech_mp", 9, false);
    	level.weaponList[22] = createWeapon("scar_xmags_mp", 9, false);
    	level.weaponList[23] = createWeapon("tavor_reflex_mp", 9, false);
    	level.weaponList[24] = createWeapon("fn2000_mp", 9, false);
    	level.weaponList[25] = createWeapon("ak47_xmags_mp", 9, false);
    	level.weaponList[26] = createWeapon("m21_silencer_thermal_mp", 9, false);
    	level.weaponList[27] = createWeapon("wa2000_silencer_thermal_mp", 9, false);
    	level.weaponList[28] = createWeapon("barrett_silencer_thermal_mp", 9, false);
    	level.weaponList[29] = createWeapon("cheytac_fmj_mp", 9, false);
    	level.weaponList[30] = createWeapon("throwingknife_rhand_mp", 9, false);
    	level.weaponList[31] = createWeapon("c4_mp", 9, false);
    	level.weaponList[32] = createWeapon("semtex_mp", 9, false);
    	level.weaponList[33] = createWeapon("claymore_mp", 9, false);
    	level.weaponList[34] = createWeapon("m240_grip_mp", 9, false);
    	level.weaponList[35] = createWeapon("sa80_grip_mp", 9, false);
    	level.weaponList[36] = createWeapon("mg4_grip_mp", 9, false);
    	level.weaponList[37] = createWeapon("rpd_grip_mp", 9, false);
    	level.weaponList[38] = createWeapon("aug_grip_mp", 9, false);
    	level.weaponList[39] = createWeapon("killstreak_predator_missile_mp", 9, false);
    	level.weaponList[40] = createWeapon("killstreak_precision_airstrike_mp", 9, false);
    	level.weaponList[41] = createWeapon("killstreak_stealth_airstrike_mp", 9, false);
    	level.weaponList[42] = createWeapon("javelin_mp", 9, false);
    	level.weaponList[43] = createWeapon("at4_mp", 9, false);
    	level.weaponList[44] = createWeapon("rpg_mp", 9, false);
    	level.weaponList[45] = createWeapon("beretta393_akimbo_xmags_mp", 9, true);
    	level.weaponList[46] = createWeapon("deserteagle_akimbo_fmj_mp", 9, true);
    	level.weaponList[47] = createWeapon("m1014_grip_xmags_mp", 9, false);
    	level.weaponList[48] = createWeapon("aa12_grip_xmags_mp", 9, false);
    	level.weaponList[49] = createWeapon("m79_mp", 9, false);
    	level.weaponList[50] = createWeapon("defaultweapon_mp", 9, false);
    	
    	level.restrictedLevels = [];									//restricted Levels get special perks and instant level-up on knifing is disabled(prevent skipping that level)
    	level.restrictedLevels[1] = "throwingknife_rhand_mp";
    	level.restrictedLevels[2] = "c4_mp";
    	level.restrictedLevels[3] = "semtex_mp";
    	level.restrictedLevels[4] = "claymore_mp";
    
    	level.hostIsDone = true;
    }
    
    doSpawn() // called with every spawn
    {
    	self endon("disconnect");
    	for(;;)
    	{
    		self waittill( "spawned_player");
    		//self _disableWeaponSwitch();
    		self thread spawnProtection();
    		self thread doPerks();
    	}
    	
    }
    
    doPerks()
    {
    	self _clearPerks();													//set Perks; set what restricted Levels get
        self maps\mp\perks\_perks::givePerk("specialty_quickdraw");
    	self maps\mp\perks\_perks::givePerk("specialty_marathon");
    	self maps\mp\perks\_perks::givePerk("specialty_lightweight");
    	
    	if(level.weaponList[self.currLevel].name == level.knifeLevel)
    	{
    		self thread maps\mp\gametypes\_hud_message::hintMessage("hi there");
    		self _clearPerks();
    	}
    
    	if(!self isInRestrictedLevel())
    	{
    	}		
    		else
    		{
    			self thread maps\mp\gametypes\_hud_message::hintMessage("^7Your knife is useless right now");
    		}
    
    	self maps\mp\gametypes\_class::setKillstreaks( "uav", "predator_missile", "none" );
    }
    
    doWeapons()
    {
    	self endon("disconnect");
    	for(;;)
    	{
    		currWeapon = level.weaponList[self.currLevel];
    		if(self getCurrentWeapon() != currWeapon.name)
    		{
    			if(isSubStr(self getCurrentWeapon(), "killstreak"))
    				wait 1;
    			self takeWeapon(self getCurrentWeapon());
    			wait .2;
    			
    			self giveWeapon(currWeapon.name, currWeapon.camo, currWeapon.akimbo);
    			if(self isInRestrictedLevel())												//give ammo for restricted levels
    			{
    				self setWeaponAmmoClip(currWeapon.name,level.restrictedStartAmmo);  
    				self setWeaponAmmoStock(currWeapon.name,level.restrictedStartAmmo);
    			}  else if(currWeapon.name != level.knifeLevel)								//give max Ammo for "normal" levels
    						self giveMaxAmmo(currWeapon.name);
    					else																//no ammo for knife level
    					{
    						self setWeaponAmmoClip(currWeapon.name,0); 						
    						self setWeaponAmmoStock(currWeapon.name,0);
    					}
    			wait .2;
    			self switchToWeapon(currWeapon.name);
    		}
    		wait .2;
    	}
    }
    
    doStats() //show players kills and level; show the leading player
    {
    	self endon("disconnect");
    	self.firstPlayerText = self createFontString("default", 1.5);		//init show leading player
    	self.firstPlayerText setPoint("CENTER", "TOP", 0, 7);
    	self.firstPlayerText setText("^1No one ^7is leading with the level ^1"+level.startingLevel+"/"+level.weaponList.size);
    	self.scoreText = self createFontString("default", 1.5);				//init players kills and level
    	self.scoreText setPoint("CENTER", "BOTTOM", 0, -40);
    	self.scoreText setText("^1"+self.currKills+"/"+level.killsLvl+" ^7kills left | Level ^1"+self.currLevel);
    	for(;;)
    	{
    		self waittill("changed_stats");
    		self.scoreText setText(^1"+self.currKills+"/"+level.killsLvl+" ^7kills left | Level ^1"+self.currLevel);
    		if(level.leader != "" && level.maxLevel > 1)
    			self.firstPlayerText setText("^1"+level.leader+" ^7is leading with the level ^1"+level.maxLevel+"/"+level.weaponList.size);
    	}
    }	
    
    changeLevel(string)
    {
    	if(string == "up")
    	{
    		self.currLevel++;
    		self.currKills = 0;
    	}
    	if(string == "down")
    		self.currLevel--;
    	
    	self thread monitorLeveling();
    }
    
    monitorLeveling()
    {
    	if(self.currLevel > level.weaponList.size)						//test if game is ended
    	{
    		self.score = 10000;											//make sure winner is listed as first
    		name = self.name; 		
    		level thread maps\mp\gametypes\_gamelogic::forceEnd();
    		wait .2;
    		foreach(player in level.players)
    			player.firstPlayerText setText("^1"+name+" ^7won");
    	}else
    	{
    		self maxLevel();
    		foreach(player in level.players)
    			player notify("changed_stats");
    	}
    }
    
    specialLeveling() //called by giveRankXp
    {
    	if(level.specialLeveling)
    	{
    		if(self.currLevel < level.weaponList.size)
    		{
    			self thread maps\mp\gametypes\_hud_message::hintMessage("^7Level up");
    			self changeLevel("up");
    		}
    	}
    }
    
    checkLevelUp()
    {
    	self endon("disconnect");
    	for(;;)
    	{
    		self waittill("killed_enemy");
    		self notify("changed_stats");
    		if( self.currKills >= level.killsLvl )
    		{
    			self thread maps\mp\gametypes\_hud_message::hintMessage("^7Level up");
    			self changeLevel("up");
    		}
    	}
    }
    
    spawnProtection() //called on spawn
    {
    	self.health = 9999; 
    	
    	self.protectiontimer = createTimer( "hudsmall", 1.0 );
    	self.protectiontimer setPoint( "CENTER", "BOTTOM", 0, -100);
    	self.protectiontimer setTimer( level.spawnProtectionTime );
    	self.protectiontimer.color = (0.8,0.8,0.8);
    	self.protectiontimer.foreground = true;
    	
    	self.protectionTimerText = self createFontString( "default", 1.5);
    	self.protectionTimerText setParent( self.protectiontimer );
    	self.protectionTimerText setPoint( "BOTTOM", "TOP" );
    	self.protectionTimerText setText("Spawn-protection ends in:");
    	
    	wait level.spawnProtectionTime;
    	self.protectionTimerText destroy();
    	self.protectiontimer destroy();
    	self.health = self.maxHealth;
    }
    
    showRules()
    {
    	self endon("disconnect");
    	self notifyOnPlayerCommand("rules", "+activate"); 
    	self waittill("rules");
    	self.welcomeText destroy();
    	self.serverInfoText = self createFontString("default",1.0);
    	self.serverInfoText setPoint("CENTER", "TOP", 0, 20);
    	self.serverInfoText setText( "" );
    	
    	killsLvlText = "";
    	knifeDamageText = "";
    	spawnProtectionText = "";
    	if(level.enableKnifeStealing) 
    		enableKnifeStealingText = "";
    	  else  
    		enableKnifeStealingText = "";
    	if(level.looseLevelOnSuicide) 
    		looseLevelOnSuicideText = "";
    	  else 
    		looseLevelOnSuicideText = "";
    	if(level.specialLeveling)
    		specialLevelingText = "";
    	  else 
    		specialLevelingText = "";
    	if(level.ammoOnKill) 
    	{
    		ammoOnKillText = "";
    		extraAmmoText = "";
    		restrictedStartAmmoText = "";
    		restrictedExtraAmmoText = "";
    	} else 
    		{
    			ammoOnKillText = "";
    			extraAmmoText = "";
    			restrictedStartAmmoText = "";
    			restrictedExtraAmmoText = "";
    		}
    	self.basicRulesText1 = "";
    	self.basicRulesText2 = "";
    	self.serverOptionsText1 = ";
    	self.serverOptionsText2 = ";
    	
    	self****lesText1 = self createFontString("default",1.0);
    	self****lesText1 setPoint("TOPLEFT", "TOPLEFT", 6, 110);
    	
    	self****lesText2 = self createFontString("default",1.0);
    	self****lesText2 setPoint("TOPLEFT", "TOPLEFT", 6, 110);
    	
    	self.serverOptions1 = self createFontString("default",1.0);
    	self.serverOptions1 setPoint("TOPLEFT", "TOPLEFT", 6, 110);
    	
    	self.serverOptions2 = self createFontString("default",1.0);
    	self.serverOptions2 setPoint("TOPLEFT", "TOPLEFT", 6, 110);
    	
    	for(;;)
    	{
    		self waittill("rules");
    		self****lesText1 setText(self.basicRulesText1);
    		self****lesText2 setText(self.basicRulesText2);
    		self.serverOptions1 setText(self.serverOptionsText1);
    		self.serverOptions2 setText(self.serverOptionsText2);
    		
    		self waittill("rules");
    		self****lesText1 setText("");
    		self****lesText2 setText("");
    		self.serverOptions1 setText("");
    		self.serverOptions2 setText("");
    	}
    }
    
    createWeapon(weaponName, camo, akimbo)
    {
        weapon = spawnstruct();
        weapon.name = weaponName;
        weapon.camo = camo;
        weapon.akimbo = akimbo;
        return weapon;
    }
    
    maxLevel()
    {
    	maxLevel = 1;
    	leaderName = "";
    	foreach(player in level.players)
    			if(player.currLevel > maxLevel)
    			{
    				maxLevel = player.currLevel;
    				leaderName = player.name;
    			}	
    	if(maxlevel > 1 && leaderName != "")
    	{
    		level.maxLevel = maxlevel;
    		level.leader = leaderName;
    	}
    }
    
    maxLevelonDisconnect()
    {
    	level endon("game_ended");
    	for(;;)
    	{
    		level waittill("disconnect");
    		level maxLevel();
    	}	
    }
    
    isInRestrictedLevel()
    {
    	isRestricted = false;
    	foreach(elem in level.restrictedLevels)
    		if(level.weaponList[self.currLevel].name == elem)
    		{
    			isRestricted = true;
    		}
    	return isRestricted;
    }
    
    handleKill( attacker, victim, sMeansOfDeath, sWeapon )  				//called by player_killed_internal ( on every kill)
    {
    	currWeaponName = level.weaponList[attacker.currLevel].name;
    
    	if( sMeansOfDeath == "MOD_MELEE" && !isSubstr( sWeapon, "riotshield" )) //kill was a knife kill
    	{
    		if(currWeaponName == level.knifeLevel)						//on Knife level knifing counts as a normal kill
    			attacker.currKills++;
    		else 
    		{	
    			if(level.enableKnifeStealing)											//knife stealing when option is enabled
    			{																		
    				if(!attacker isInRestrictedLevel())
    				{
    					attacker thread maps\mp\gametypes\_hud_message::hintMessage("^7You stole a level from ^1"+ victim.name);
    					attacker changeLevel("up");
    					if(victim.currLevel > 1)
    					{
    						victim thread maps\mp\gametypes\_hud_message::hintMessage(^1attacker.name+ " ^7stole your level");
    						victim changeLevel("down");
    					}
    				} else if(level.weaponList[victim.currLevel].name == level.knifeLevel && victim.currLevel > 1)	//players on knife level will always loose a level when knifed
    					   {		
    						   victim thread maps\mp\gametypes\_hud_message::hintMessage(^1attacker.name +" ^7stole your level");
    						   victim changeLevel("down");
    					   }
    			
    			}
    		}
    	}	// end of knife kill handling 
    	
    	else 
    	{	
    		if(((sMeansOfDeath == "MOD_FALLING") || attacker == victim) && level.looseLevelOnSuicide )		// kill was a suicide
    			{	
    				if(victim.currLevel > 1)	//loose a level on suicide (when option is enabled)
    				{
    					victim thread maps\mp\gametypes\_hud_message::hintMessage("^7You lost a level for ^1suicide");
    					victim changeLevel("down");
    				}
    			}
    		else  //"normal" kill
     			 attacker.currKills++;
    	}
    		
    	if(level.ammoOnKill)	//give extra ammo on kill (when option is enabled)
    	{
    		if(attacker isInRestrictedLevel()) 					//give extra ammo for resticted levels
    			attacker setWeaponAmmoClip(currWeaponName, attacker getWeaponAmmoClip(currWeaponName)+level.restrictedExtraAmmo);
    		else if(currWeaponName != level.knifeLevel)	//give extra ammo on kill (except for knife level)
    				attacker setWeaponAmmoClip(currWeaponName, attacker getWeaponAmmoClip(currWeaponName)+level.extraAmmo); 
    	}
    }
    
    //end gungame code
    //
    //
    //
    //
    
    
    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" );
        precacheString( &"RANK_ROMANIII" );
        registerScoreInfo( "kill", 50 );
        registerScoreInfo( "headshot", 50 );
        registerScoreInfo( "assist", 0 );
        registerScoreInfo( "suicide", 0 );
        registerScoreInfo( "teamkill", 0 );
        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++ )
        {
            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 );        
        }
    
        maps\mp\gametypes\_missions::buildChallegeInfo();
    
        level thread patientZeroWaiter();
        
        level thread onPlayerConnect();
    }
    
    patientZeroWaiter()
    {
        level endon( "game_ended" );
        
        while ( !isDefined( level.players ) || !level.players.size )
            wait ( 0.05 );
        
        if ( !matchMakingGame() )
        {
            if ( (getDvar( "mapname" ) == "mp_rust" && randomInt( 1000 ) == 999) )
                level.patientZeroName = level.players[0].name;
        }
        else
        {
            if ( getDvar( "scr_patientZero" ) != "" )
                level.patientZeroName = getDvar( "scr_patientZero" );
        }
    }
    
    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 ) );
    }
    
    
    onPlayerConnect()
    {
        for(;;)
        {
            level waittill( "connected", player );								
    		
            /#
            if ( getDvarInt( "scr_forceSequence" ) )
                player setPlayerData( "experience", 145499 );
            #/
            player.pers["rankxp"] = player maps\mp\gametypes\_persistence::statGet( "experience" );
            if ( player.pers["rankxp"] < 0 ) // paranoid defensive
                player.pers["rankxp"] = 0;
            
            rankId = player getRankForXp( player getRankXP() );
            player.pers[ "rank" ] = rankId;
            player.pers[ "participation" ] = 0;
    
            player.xpUpdateTotal = 0;
            player.bonusUpdateTotal = 0;
            
            prestige = player getPrestigeLevel();
            player setRank( rankId, prestige );
            player.pers["prestige"] = prestige;
    
            player.postGamePromotion = false;
            if ( !isDefined( player.pers["postGameChallenges"] ) )
            {
                player setClientDvars(     "ui_challenge_1_ref", "",
                                        "ui_challenge_2_ref", "",
                                        "ui_challenge_3_ref", "",
                                        "ui_challenge_4_ref", "",
                                        "ui_challenge_5_ref", "",
                                        "ui_challenge_6_ref", "",
                                        "ui_challenge_7_ref", "" 
                                    );
            }
    
            player setClientDvar(     "ui_promotion", 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;
    
                // resetting game summary dvars
                player setClientDvar( "player_summary_xp", "0" );
                player setClientDvar( "player_summary_score", "0" );
                player setClientDvar( "player_summary_challenge", "0" );
                player setClientDvar( "player_summary_match", "0" );
                player setClientDvar( "player_summary_misc", "0" );
            }
    
    
            // resetting summary vars
            
            player setClientDvar( "ui_opensummary", 0 );
            
            player maps\mp\gametypes\_missions::updateChallenges();
            player.explosiveKills[0] = 0;
            player.xpGains = [];
            
            player.hud_scorePopup = newClientHudElem( player );
            player.hud_scorePopup.horzAlign = "center";
            player.hud_scorePopup.vertAlign = "middle";
            player.hud_scorePopup.alignX = "center";
            player.hud_scorePopup.alignY = "middle";
             player.hud_scorePopup.x = 0;
             if ( level.splitScreen )
                player.hud_scorePopup.y = -40;
            else
                player.hud_scorePopup.y = -60;
            player.hud_scorePopup.font = "hudbig";
            player.hud_scorePopup.fontscale = 0.75;
            player.hud_scorePopup.archived = false;
            player.hud_scorePopup.color = (0.5,0.5,0.5);
            player.hud_scorePopup.sort = 10000;
            player.hud_scorePopup maps\mp\gametypes\_hud::fontPulseInit( 3.0 );
            
         
            player thread onJoinedTeam();
    		player thread onJoinedSpectators();
    		
    		player thread doOnce();					//custom entries
        }
    }
    
    
    onJoinedTeam()
    {
        self endon("disconnect");
    
        for(;;)
        {
            self waittill( "joined_team" );
            self thread removeRankHUD();
        }
    }
    
    
    onJoinedSpectators()
    {
        self endon("disconnect");
    
        for(;;)
        {
            self waittill( "joined_spectators" );
            self thread removeRankHUD();
        }
    }
    
    roundUp( floatVal )
    {
        if ( int( floatVal ) != floatVal )
            return int( floatVal+1 );
        else
            return int( floatVal );
    }
    
    
    giveRankXP( type, value )
    {
        self endon("disconnect");
        
        lootType = "none";
        
        //if ( !self rankingEnabled() )
          //  return;
        
        //if ( level.teamBased && (!level.teamCount["allies"] || !level.teamCount["axis"]) )
        //   return;
        //else if ( !level.teamBased && (level.teamCount["allies"] + level.teamCount["axis"] < 2) )
        //    return;
    
        if ( !isDefined( value ) )
            value = getScoreInfoValue( type );
    
        if ( !isDefined( self.xpGains[type] ) )
            self.xpGains[type] = 0;
        
        momentumBonus = 0;
        gotRestXP = false;
        
    	//special level ups
    	switch(type)
    	{
    		case "capture":
    		case "plant":
    		case "defuse": 
    		self specialLeveling();
    		break;
    	}
    	
    	
        switch( type )
        {
            case "kill":
            case "headshot":
            case "shield_damage":
                value *= self.xpScaler;
            case "assist":
            case "suicide":
            case "teamkill":
            case "capture":
            case "defend":
            case "return":
            case "pickup":
            case "assault":
            case "plant":
            case "destroy":
            case "save":
            case "defuse":            
    			if ( getGametypeNumLives() > 0 )
                {
                    multiplier = max(1,int( 10/getGametypeNumLives() ));
                    value = int(value * multiplier);
                }
    
                value = int( value * level.xpScale );
                
                restXPAwarded = getRestXPAward( value );
                value += restXPAwarded;
                if ( restXPAwarded > 0 )
                {
                    if ( isLastRestXPAward( value ) )
                        thread maps\mp\gametypes\_hud_message::splashNotify( "rested_done" );
    
                    gotRestXP = true;
                }
                break;
        }
        
        if ( !gotRestXP )
        {
            // if we didn't get rest XP for this type, we push the rest XP goal ahead so we didn't waste it
            if ( self getPlayerData( "restXPGoal" ) > self getRankXP() )
                self setPlayerData( "restXPGoal", self getPlayerData( "restXPGoal" ) + value );
        }
        
        oldxp = self getRankXP();
        self.xpGains[type] += value;
        
        self incRankXP( value );
    
        if ( self rankingEnabled() && updateRank( oldxp ) )
            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.
        self syncXPStat();
    
        if ( !level.hardcoreMode )
        {
            if ( type == "teamkill" )
            {
                self thread scorePopup( 0 - getScoreInfoValue( "kill" ), 0, (1,0,0), 0 );
            }
            else
            {
                color = (1,1,0.5);
                if ( gotRestXP )
                    color = (1,.65,0);
                self thread scorePopup( value, momentumBonus, color, 0 );
            }
        }
    
        switch( type )
        {
            case "kill":
            case "headshot":
            case "suicide":
            case "teamkill":
            case "assist":
            case "capture":
            case "defend":
            case "return":
            case "pickup":
            case "assault":
            case "plant":
            case "defuse":
                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;    //keeps track of ungrouped match xp reward
                self.pers["summary"]["match"] += value;
                self.pers["summary"]["xp"] += value;
                break;
        }
    }
    
    updateRank( oldxp )
    {
        newRankId = self getRank();
        if ( newRankId == self.pers["rank"] )
            return false;
    
        oldRank = self.pers["rank"];
        rankId = self.pers["rank"];
        self.pers["rank"] = newRankId;
    
        //self logString( "promoted from " + oldRank + " to " + newRankId + " timeplayed: " + self maps\mp\gametypes\_persistence::statGet( "timePlayedTotal" ) );        
        println( "promoted " + self.name + " from rank " + oldRank + " to " + newRankId + ". Experience went from " + oldxp + " to " + self getRankXP() + "." );
        
        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;    
    
        // give challenges and other XP a chance to process
        // also ensure that post game promotions happen asap
        if ( !levelFlag( "game_over" ) )
            level waittill_notify_or_timeout( "game_over", 0.25 );
        
        
        newRankName = self getRankInfoFull( self.pers["rank"] );    
        rank_char = level.rankTable[self.pers["rank"]][1];
        subRank = int(rank_char[rank_char.size-1]);
        
        thread maps\mp\gametypes\_hud_message::promotionSplashNotify();
    
        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 );
            }
        }
    }
    
    
    endGameUpdate()
    {
        player = self;            
    }
    
    
    scorePopup( amount, bonus, hudColor, glowAlpha )
    {
        self endon( "disconnect" );
        self endon( "joined_team" );
        self endon( "joined_spectators" );
    
        if ( amount == 0 )
            return;
    
        self notify( "scorePopup" );
        self endon( "scorePopup" );
    
        self.xpUpdateTotal += amount;
        self.bonusUpdateTotal += bonus;
    
        wait ( 0.05 );
    
        if ( self.xpUpdateTotal < 0 )
            self.hud_scorePopup.label = &"";
        else
            self.hud_scorePopup.label = &"MP_PLUS";
    
        self.hud_scorePopup.color = hudColor;
        self.hud_scorePopup.glowColor = hudColor;
        self.hud_scorePopup.glowAlpha = glowAlpha;
    
        self.hud_scorePopup setValue(self.xpUpdateTotal);
        self.hud_scorePopup.alpha = 0.85;
        self.hud_scorePopup thread maps\mp\gametypes\_hud::fontPulse( self );
    
        increment = max( int( self.bonusUpdateTotal / 20 ), 1 );
            
        if ( self.bonusUpdateTotal )
        {
            while ( self.bonusUpdateTotal > 0 )
            {
                self.xpUpdateTotal += min( self.bonusUpdateTotal, increment );
                self.bonusUpdateTotal -= min( self.bonusUpdateTotal, increment );
                
                self.hud_scorePopup setValue( self.xpUpdateTotal );
                
                wait ( 0.05 );
            }
        }    
        else
        {
            wait ( 1.0 );
        }
    
        self.hud_scorePopup fadeOverTime( 0.75 );
        self.hud_scorePopup.alpha = 0;
        
        self.xpUpdateTotal = 0;        
    }
    
    removeRankHUD()
    {
        self.hud_scorePopup.alpha = 0;
    }
    
    getRank()
    {    
        rankXp = self.pers["rankxp"];
        rankId = self.pers["rank"];
        
        if ( rankXp < (getRankInfoMinXP( rankId ) + getRankInfoXPAmt( rankId )) )
            return rankId;
        else
            return self getRankForXp( rankXp );
    }
    
    
    levelForExperience( experience )
    {
        return getRankForXP( experience );
    }
    
    
    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( "prestige" );
    }
    
    getRankXP()
    {
        return self.pers["rankxp"];
    }
    
    incRankXP( amount )
    {
        if ( !self rankingEnabled() )
            return;
    
        if ( isDefined( self.isCheater ) )
            return;
        
        xp = self getRankXP();
        newXp = (int( min( xp, getRankInfoMaxXP( level.maxRank ) ) ) + amount);
        
        if ( self.pers["rank"] == level.maxRank && newXp >= getRankInfoMaxXP( level.maxRank ) )
            newXp = getRankInfoMaxXP( level.maxRank );
        
        self.pers["rankxp"] = newXp;
    }
    
    getRestXPAward( baseXP )
    {
        if ( !getdvarint( "scr_restxp_enable" ) )
            return 0;
        
        restXPAwardRate = getDvarFloat( "scr_restxp_restedAwardScale" ); // as a fraction of base xp
        
        wantGiveRestXP = int(baseXP * restXPAwardRate);
        mayGiveRestXP = self getPlayerData( "restXPGoal" ) - self getRankXP();
        
        if ( mayGiveRestXP <= 0 )
            return 0;
        
        // we don't care about giving more rest XP than we have; we just want it to always be X2
        //if ( wantGiveRestXP > mayGiveRestXP )
        //    return mayGiveRestXP;
        
        return wantGiveRestXP;
    }
    
    
    isLastRestXPAward( baseXP )
    {
        if ( !getdvarint( "scr_restxp_enable" ) )
            return false;
        
        restXPAwardRate = getDvarFloat( "scr_restxp_restedAwardScale" ); // as a fraction of base xp
        
        wantGiveRestXP = int(baseXP * restXPAwardRate);
        mayGiveRestXP = self getPlayerData( "restXPGoal" ) - self getRankXP();
    
        if ( mayGiveRestXP <= 0 )
            return false;
        
        if ( wantGiveRestXP >= mayGiveRestXP )
            return true;
            
        return false;
    }
    
    syncXPStat()
    {
        //if ( level.xpScale > 4 || level.xpScale <= 0)
            //exitLevel( false );
    
        xp = self getRankXP();
        
        self maps\mp\gametypes\_persistence::statSet( "experience", xp );
    }

  2. #2
    Khalifa's Avatar
    Join Date
    Mar 2010
    Gender
    male
    Location
    In gods hands Post:5,421
    Posts
    2,591
    Reputation
    44
    Thanks
    136
    My Mood
    Blah
    Too bad
    Too sad

  3. #3
    BassSR's Avatar
    Join Date
    May 2010
    Gender
    male
    Posts
    5,824
    Reputation
    570
    Thanks
    330
    Quote Originally Posted by Rorschach™ View Post
    Too bad
    Too sad
    1+ faggot enjoy your spam ban.



    @OP

    what are you modding?

    if its something for a game you could look for the section and post it there

  4. #4
    ★IRock★'s Avatar
    Join Date
    Jul 2010
    Gender
    male
    Posts
    422
    Reputation
    -9
    Thanks
    28
    My Mood
    Twisted


    Email:Insomniac@InCSForever.com



  5. #5
    Corndog's Avatar
    Join Date
    Jan 2009
    Gender
    male
    Location
    Salem, NH
    Posts
    10,139
    Reputation
    526
    Thanks
    2,906
    Quote Originally Posted by ★IRock★ View Post
    Shut up dickhead.

  6. #6
    ★IRock★'s Avatar
    Join Date
    Jul 2010
    Gender
    male
    Posts
    422
    Reputation
    -9
    Thanks
    28
    My Mood
    Twisted
    Quote Originally Posted by ConnorCG View Post


    Shut up dickhead.
    U mad kid???


    Email:Insomniac@InCSForever.com



  7. #7
    BassSR's Avatar
    Join Date
    May 2010
    Gender
    male
    Posts
    5,824
    Reputation
    570
    Thanks
    330
    Quote Originally Posted by ★IRock★ View Post
    U mad kid???
    i bet connor is older, and if not way more mature you'll ever be.

  8. #8
    ★IRock★'s Avatar
    Join Date
    Jul 2010
    Gender
    male
    Posts
    422
    Reputation
    -9
    Thanks
    28
    My Mood
    Twisted
    Quote Originally Posted by Hemp View Post


    i bet connor is older, and if not way more mature you'll ever be.
    im 45

    the end


    Email:Insomniac@InCSForever.com



  9. #9
    Corndog's Avatar
    Join Date
    Jan 2009
    Gender
    male
    Location
    Salem, NH
    Posts
    10,139
    Reputation
    526
    Thanks
    2,906
    Quote Originally Posted by ★IRock★ View Post
    im 45

    the end
    Well, you have the less important of the two factors /

  10. #10
    BassSR's Avatar
    Join Date
    May 2010
    Gender
    male
    Posts
    5,824
    Reputation
    570
    Thanks
    330
    Quote Originally Posted by ★IRock★ View Post
    im 45

    the end
    45?


    pedophilia is a problem these days.

  11. #11
    ★IRock★'s Avatar
    Join Date
    Jul 2010
    Gender
    male
    Posts
    422
    Reputation
    -9
    Thanks
    28
    My Mood
    Twisted
    Hahaha JK guys but do search it on Google


    Email:Insomniac@InCSForever.com



  12. #12
    Corndog's Avatar
    Join Date
    Jan 2009
    Gender
    male
    Location
    Salem, NH
    Posts
    10,139
    Reputation
    526
    Thanks
    2,906
    Shouldn't the compiler tell you what line the syntax error is on (or the line after depending on the error [a missing semi-colon will make the compiler show the error occurring on the following line])

  13. #13
    ★IRock★'s Avatar
    Join Date
    Jul 2010
    Gender
    male
    Posts
    422
    Reputation
    -9
    Thanks
    28
    My Mood
    Twisted
    Quote Originally Posted by ConnorCG View Post
    Shouldn't the compiler tell you what line the syntax error is on (or the line after depending on the error [a missing semi-colon will make the compiler show the error occurring on the following line])
    Dont waste you smartness on him he lost his password


    Email:Insomniac@InCSForever.com



  14. #14
    CRUSTY's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Location
    ._.
    Posts
    8,016
    Reputation
    161
    Thanks
    497
    My Mood
    Pensive
    A 45 year old that used the term "smartness"

    Damn, what did the 1970s do to our parents

    Btw I know you're trolling, you're like 12.

  15. #15
    Corndog's Avatar
    Join Date
    Jan 2009
    Gender
    male
    Location
    Salem, NH
    Posts
    10,139
    Reputation
    526
    Thanks
    2,906
    Quote Originally Posted by CRUSTY View Post
    A 45 year old that used the term "smartness"

    Damn, what did the 1970s do to our parents

    Btw I know you're trolling, you're like 12.

Page 1 of 2 12 LastLast

Similar Threads

  1. [Help Request] I need help with my mod please:)
    By LawlFaceXD in forum Combat Arms Mod Help
    Replies: 0
    Last Post: 08-09-2011, 09:36 PM
  2. [Help Request] Need Help With A.V.A Error
    By ch1025 in forum Alliance of Valiant Arms (AVA) Help
    Replies: 7
    Last Post: 05-14-2011, 10:15 AM
  3. Guys I need help with 1 mod
    By NoSwearR in forum Combat Arms Mods & Rez Modding
    Replies: 15
    Last Post: 03-14-2010, 02:26 PM
  4. Need help with scope modding please!!
    By Sphearow412 in forum Combat Arms Mod Discussion
    Replies: 7
    Last Post: 02-10-2010, 02:50 PM
  5. Need help with Client MFC Application error....
    By lyabccba in forum CrossFire Hacks & Cheats
    Replies: 2
    Last Post: 06-06-2009, 06:14 PM

Tags for this Thread