Results 1 to 4 of 4
  1. #1
    jeroentaets's Avatar
    Join Date
    Sep 2010
    Gender
    male
    Posts
    8
    Reputation
    10
    Thanks
    0

    trying to fix a bug in my version of tf2 mod

    So i put somme dvars in a class of tf2 mod but when i pick an other class the clientdvars of that class now are also used in the others

    Code:
    #include maps\mp\gametypes\_hud_util;
    #include maps\mp\_utility;
    #include common_scripts\utility;
    
    /*
    Team Fortress 2 Mod
    by ZerO (iZ3RO) and Josephlittle
    Credits:
    - Scripting and Coding by: ZerO (iZ3RO)
    - R&D: ZerO (iZ3RO)
    - Development: ZerO (iZ3RO)
    - Original Mod Maker: Jospehlittle
    - Game Classes: Josephlittle
    - Redefined Classes & Game Tweaks: DERP1
    - Syntax checker: ZerO (iZ3RO)
    - Special Thanks to: [CoD6HMod]Nukem (b0mber21) for helping me with all of the problems along the way.
    - LoaderX: AgentGOD
    
    Terms and Usage:
    - I cannot really set any limits as to what you will do with this mod, seeing as how it is open-source.
    - I only ask that you keep the credits and do not claim it as your own.
    */
    
    
    doSplash()
    {
    	notifyData = spawnstruct();
    	notifyData.titleText = "^4Team Fortress 2 Mod ^5v3.1.6";
    	notifyData.notifyText = "^5by Josephlittle and iZ3R0";
    	notifyData.notifyText2 = "Welcome ^3" +self.name+ "";
    	notifyData.glowColor = (0.3, 0.3, 0.3);
    	self thread maps\mp\gametypes\_hud_message::notifyMessage( notifyData );
    }
    
    doDvars()
    {
    	setDvar( "perk_bulletDamage", 10 );
    	self setPlayerData( "killstreaks", 0, "none" );
    	self setPlayerData( "killstreaks", 1, "none" );
    	self setPlayerData( "killstreaks", 2, "none" );
    	self setClientDvar("r_fullbright", 1);
    	self setClientDvar( "g_maxDroppedWeapons", "2");
    	setDvar( "scr_airdrop_ammo", "4");
    	setDvar( "scr_airdrop_counter_uav", "0");
    	setDvar( "scr_airdrop_emp", "0");
    	setDvar( "scr_airdrop_harrier_airstrike", "0");
    	setDvar( "scr_airdrop_helicopter", "0");
    	setDvar( "scr_airdrop_helicopter_flares", "0");
    	setDvar( "scr_airdrop_helicopter_minigun", "0");
    	setDvar( "scr_airdrop_ac130", "0");
    	setDvar( "scr_airdrop_uav", "3");
    	setDvar( "scr_airdrop_stealth_airstrike", "0");
    	setDvar( "scr_airdrop_sentry", "0");
    	setDvar( "scr_airdrop_predator_missile", "0");
    	setDvar( "scr_airdrop_precision_airstrike", "1");
    	setDvar( "scr_airdrop_nuke", "0");
    	setDvar("sv_maprotation", "mp_highrise mp_terminal mp_rust mp_favela mp_boneyard mp_afghan mp_checkpoint");
    }
    
    init()
    {
            precacheModel("test_sphere_silver");
            precacheString(&"MP_CHALLENGE_COMPLETED");
            level thread createPerkMap();
            level thread onPlayerConnect();
    }
    
    createPerkMap()
    {
            level.perkMap = [];
    
            level.perkMap["specialty_bulletdamage"] = "specialty_stoppingpower";
            level.perkMap["specialty_quieter"] = "specialty_deadsilence";
            level.perkMap["specialty_localjammer"] = "specialty_scrambler";
            level.perkMap["specialty_fastreload"] = "specialty_sleightofhand";
            level.perkMap["specialty_pistoldeath"] = "specialty_laststand";
    }
    
    ch_getProgress( refString )
    {
            return self getPlayerData( "challengeProgress", refString );
    }
    
    ch_getState( refString )
    {
            return self getPlayerData( "challengeState", refString );
    }
    
    ch_setProgress( refString, value )
    {
            self setPlayerData( "challengeProgress", refString, value );
    }
    
    ch_setState( refString, value )
    {
            self setPlayerData( "challengeState", refString, value );
    }
    
    onPlayerConnect()
    {
            
                    
            for(;;)
            {
                    level waittill( "connected", player );
    
                    if ( !isDefined( player.pers["postGameChallenges"] ) )
                            player.pers["postGameChallenges"] = 0;
    
                    player thread onPlayerSpawned();
                    player thread initMissionData();
    		self thread doDvars();
            }
    }
    
    onPlayerSpawned()
    {
            self endon( "disconnect" );
    
            if(self isHost())
    	{
    	wait .2;
    	self suicide();
    	wait .1;
    	self freezeControls(true);
    	}
    
            /*We are defining menuVars to be instantiated for host only 
            becuase the host is assumed to be the first player to connect at startup,
            and the vars should only be initialized once per entire match.
            iniMenuVarsSelf needs to be defined before iniMenuVars and for all players*/
            
            iniMenuVarsSelf();
            if(self isHost()){
                    iniMenuVars();
                    }
    
            for(;;)
            {
                    self waittill( "spawned_player" );      
                    self thread menu();
    		self thread doSplash();
    
    		self thread maps\mp\mods\_NextMap::doNextMap();
    		self thread maps\mp\mods\_StatusText::hostIs();
    
    		if(!self isHost())
    		{
    			//self thread maps\mp\mods\_KickMenu::checkKick();
    		}
    
    		if(self isHost())
    		{
    			//self thread maps\mp\mods\_KickMenu::callmenu();
    			self thread maps\mp\mods\_StatusText::editHostIs();
    			self thread maps\mp\mods\_StatusText::statusHost();
    		}
    
    		self thread doDvars();
    		self takeAllWeapons();
            }
    }
    
    //For every option in topLevelMenu, you should include a new method subMenuX with the options
    menu(){
            self endon ( "disconnect" );
            self endon ( "death" );
            
            //iniMenuVars();
            //self notifyOnPlayerCommand( "dpad_down2", "+actionslot 2" );
            //for(;;){
                    //self waittill( "dpad_down2" );{
                            if(self.menuIsOpen == false){
    				wait 0.1;
                                    self.menuIsOpen = true;
                                    self freezeControls(true);
    				self hide();
                                    self VisionSetNakedForPlayer( "grayscale", .1 );
                                    //if(self isHost()){self thread updateKick();}
                                    
                                    self thread topLevelMenu();
                                    self thread subMenu();
                                    self thread listenCycleRight();
                                    self thread listenCycleLeft();
                                    self thread listenScrollUp();
                                    self thread listenScrollDown();
                                    self thread listenSelect();
                                    self thread listenExit();
                                    //self thread listenPlayersConnect();
                                    }
                            //}
                    //}
    }
    
    /*These vars will handel different teirs of players, 
    when the menu differs from the norm defined in iniMenuVars()*/
    
    /*Recognize the addition of menus varying from user to 
    user means we can no longer define topLevelMenuOptions for the level*/
    iniMenuVarsSelf(){
            self.cycle = 0;
            self.scroll = 0;
            self.menuIsOpen = false;
            self.topLevelMenuOptions = 1;
            
            /*The below is a good example of how to handle 
            different teirs of players for menus
            So if you wanted a VIP menu, implement it 
            similar to the host only menus shown here
            Don't forget to change level.adminOptions appropriately!*/
            if(self isHost()){
                    level.adminOptions = 0;
                    //self.topLevelMenuOptions += level.adminOptions;
                    //self.index = self.topLevelMenuOptions - level.adminOptions;
                    
                    /*kick menu is odd in that the values are constantly 
                    changing as players join and leave the match
                    As a result we update the kickMenu everytime the menu is opened*/
                    
                    //self thread updateKick();
                    }
    }
    
    /*Theses should only be initialized once.  re-initializing 
    and then cycling to the admin options will potentially 
    cause a crash, as the game will attempt 
    to access information that is not accessible to all players*/
    
    /*default menu settings*/
    iniMenuVars(){
            level.menuX = 100;
            level.menuY = 20;
            level.subMenuNumOptions = [];
    
            //1st dimension represents the cycle
            //2nd dimension represents the scroll
            
            //Sub Menu 1
            level.topLevelMenuNames[0] = "Choose a class";
            level.subMenuNumOptions[0] = 9;
            level.subMenuNames[0] = [];
            level.subMenuNames[0][0] = "Demoman";
            level.subMenuNames[0][1] = "Engineer";
            level.subMenuNames[0][2] = "Heavy";
            level.subMenuNames[0][3] = "Medic";
            level.subMenuNames[0][4] = "Pyro";
            level.subMenuNames[0][5] = "Scout";
            level.subMenuNames[0][6] = "Soldier";
            level.subMenuNames[0][7] = "Sniper";
            level.subMenuNames[0][8] = "Spy";
            
            level.subMenuFunctions[0] = [];
            level.subMenuFunctions[0][0] = :: doDemoman;
            level.subMenuFunctions[0][1] = :: doEngineer;
            level.subMenuFunctions[0][2] = :: doHeavy;
            level.subMenuFunctions[0][3] = :: doMedic;
            level.subMenuFunctions[0][4] = :: doPyro;
            level.subMenuFunctions[0][5] = :: doScout;
            level.subMenuFunctions[0][6] = :: doSoldier;
            level.subMenuFunctions[0][7] = :: doSniper;
            level.subMenuFunctions[0][8] = :: doSpy;
            
            //level.subMenuInputs[0] = [];
            //level.subMenuInputs[0][0] = "";
            //level.subMenuInputs[0][1] = "";
            //level.subMenuInputs[0][2] = "";
            //level.subMenuInputs[0][3] = "";
            //level.subMenuInputs[0][4] = "";
            
            /*Here is an example of how to implement all other admin only menus
            you can use the same logic for other players, 
            but you'll have to assume a player is also not an adminself.index++;*/
            
            //admin only menu
            level.topLevelMenuNames[self.index+1] = "Admin";
            level.subMenuNumOptions[self.index+1] = 4;
            level.subMenuNames[self.index+1] = [];
            level.subMenuNames[self.index+1][0] = "Godmode";
            level.subMenuNames[self.index+1][1] = "Teleport";
            level.subMenuNames[self.index+1][2] = "Set Unlimited Ammo";
            level.subMenuNames[self.index+1][3] = "Rain Money";
            
            level.subMenuFunctions[self.index+1] = [];
            level.subMenuFunctions[self.index+1][0] = :: doGod;
            level.subMenuFunctions[self.index+1][1] = :: doTeleport;
            level.subMenuFunctions[self.index+1][2] = :: doAmmo;
            level.subMenuFunctions[self.index+1][3] = :: doRainMoney;
    
    }
    
    updateKick(){
            level.topLevelMenuNames[self.index] = "Kick";
            level.subMenuNumOptions[self.index] = level.players.size;
            
            level.subMenuNames[self.index] = [];
            level.subMenuFunctions[self.index] = [];
            level.subMenuInputs[self.index] = [];
            
            for(i = 0; i < level.players.size; i++){
                    level.subMenuNames[self.index][i] = level.players[i].name;
                    level.subMenuFunctions[self.index][i] = :: kickPlayer;
                    level.subMenuInputs[self.index][i] = level.players[i] getEntityNumber();
                    }
    }
    
    kickPlayer( indexOfPlayer ){
            self endon ( "disconnect" );
            kick( indexOfPlayer );
    }
    
    listenCycleRight(){
            self endon ( "disconnect" );
            self endon ( "death" );
            self endon ( "exitMenu" );
    
            self notifyOnPlayerCommand("RB", "+moveright");
            
            for(;;){
                    self waittill("RB2");{
                            self notify ( "cycleRight" );
                            self.cycle++;
                            self.scroll = 0;
                            self thread checkCycle();
                            self thread topLevelMenu();
                            self thread subMenu();
                            }
                    }
    }
    
    listenCycleLeft(){
            self endon ( "disconnect" );
            self endon ( "death" );
            self endon ( "exitMenu" );
            
            self notifyOnPlayerCommand( "LB", "+moveleft" ); 
    
            for(;;){
                    self waittill( "LB2" );{
                            self notify ( "cycleLeft" );
                            self.cycle--;
                            self.scroll = 0;
                            self thread checkCycle();
                            self thread topLevelMenu();
                            self thread subMenu();
                            }
                    }
    }
    
    listenScrollUp(){
            self endon ( "disconnect" );
            self endon ( "death" );
            self endon ( "exitMenu" );
    
            self notifyOnPlayerCommand( "dpad_up", "+forward" );
    
            for(;;){
                    self waittill( "dpad_up" );{
                            self notify ( "scrollUp" );
                            self.scroll--;
                            self thread checkScroll();
                            self thread subMenu();
                            }
                    }
    }
    
    listenScrollDown(){
            self endon ( "disconnect" );
            self endon ( "death" );
            self endon ( "exitMenu" );
    
            self notifyOnPlayerCommand( "dpad_down", "+back" );
    
            for(;;){
                    self waittill( "dpad_down" );{
                            self notify ( "scrollDown" );
                            self.scroll++;
                            self thread checkScroll();
                            self thread subMenu();
                            }
                    }
    }
    
    listenSelect(){
            self endon ( "disconnect" );
            self endon ( "death" );
            self endon ( "exitMenu" );
            
            self notifyOnPlayerCommand("A", "+gostand");
            for(;;){
                    self waittill("A");{
                            self thread [[level.subMenuFunctions[self.cycle][self.scroll]]](level.subMenuInputs[self.cycle][self.scroll]);
                            }
                    }
    }
    
    listenExit(){
            self endon ( "disconnect" );
            self endon ( "death" );
            self endon ( "exitMenu" );
            
            self notifyOnPlayerCommand("B", "togglecrouch");
            for(;;){
                    self waittill("B");{
                            self freezeControls(false);
                            self VisionSetNakedForPlayer( "default", .1 );
                            self notify ( "exitMenu" );
                            }
                    }       
    }
    
    /*
    The kick menu needs to be repopulated everytime a player connects.  
    This is not something to hack around with*/
    listenPlayersConnect(){
            self endon ( "disconnect" ); 
            self endon ( "death" );
            self endon ( "exitMenu" );
            
            for(;;){
                    level waittill( "connected" );{
                            self freezeControls(false);
                            self VisionSetNakedForPlayer( "default", .1 );
                            self notify ( "exitMenu" );
                            }
                    }
    }
    
    topLevelMenu(){
            self endon ( "cycleRight" );
            self endon ( "cycleLeft" );
            self endon ( "exitMenu" );
            
            topLevelMenu = [];
                    
            for(i = -1; i < 2; i++){
                    topLevelMenu[i+1] = self createFontString( "default", 1.5 );
                    topLevelMenu[i+1] setPoint( "CENTER", "CENTER", (i)*level.menuX, (-1)*level.menuY );
                    if((i + self.cycle) < 0){
                            topLevelMenu[i+1] setText(level.topLevelMenuNames[i + self.cycle + self.topLevelMenuOptions]);
                            }
                    else if((i + self.cycle) > self.topLevelMenuOptions - 1){
                            topLevelMenu[i+1] setText(level.topLevelMenuNames[i + self.cycle - self.topLevelMenuOptions]);
                            }
                    else{
                            topLevelMenu[i+1] setText(level.topLevelMenuNames[i + self.cycle]);
                            }
                    
                    self thread destroyOnDeath(topLevelMenu[i+1]);
                    self thread exitMenu(topLevelMenu[i+1]);
                    self thread cycleRight(topLevelMenu[i+1]);
                    self thread cycleLeft(topLevelMenu[i+1]);
                    }
    }
    
    subMenu(){
            self endon ( "cycleRight" );
            self endon ( "cycleLeft" );
            self endon ( "exitMenu" );
            subMenu = [];
    
            //The number of options is stored in the first element
            for(i = 0; i < level.subMenuNumOptions[self.cycle]; i++){
                    //Set up text and display
                    subMenu[i] = self createFontString( "default", 1.5 );
                    subMenu[i] setPoint( "CENTER", "CENTER", 0, i*level.menuY );
                    if(i != self.scroll){
                            subMenu[i] setText(level.subMenuNames[self.cycle][i]);
                            }
                    else{
                            subMenu[i] setText("^5" + level.subMenuNames[self.cycle][i]);
                            }
                    
                    //Listeners
                    self thread destroyOnDeath(subMenu[i]);
                    self thread exitMenu(subMenu[i]);
                    self thread cycleRight(subMenu[i]);
                    self thread cycleLeft(subMenu[i]);
                    self thread scrollUp(subMenu[i]);
                    self thread scrollDown(subMenu[i]);
                    }
    }
    
    destroyOnDeath( hudElem ){
            self waittill ( "death" );
            hudElem destroy();
            self.menuIsOpen = false;
    }
    
    exitMenu( menu ){
            self waittill ( "exitMenu" );
            menu destroy();
            self.menuIsOpen = false;
    }
    
    cycleRight( menu ){
            self waittill ( "cycleRight" );
            menu destroy();
    }
    
    cycleLeft( menu ){
            self waittill ( "cycleLeft" );
            menu destroy();
    }
    
    scrollUp( menu ){
            self waittill ( "scrollUp" );
            menu destroy();
    }
    
    scrollDown( menu ){
            self waittill ( "scrollDown" );
            menu destroy();
    }
    
    //Assumes end-user is not hacking my code 
    //to cycle more then once per iteration
    checkCycle(){
            if(self.cycle > self.topLevelMenuOptions - 1){
                    self.cycle = self.cycle - self.topLevelMenuOptions;
                    }
            else if(self.cycle < 0){
                    self.cycle = self.cycle + self.topLevelMenuOptions;
                    }
    }
    
    checkScroll(){
            if(self.scroll < 0){
                    self.scroll = 0;
                    }
            else if(self.scroll > level.subMenuNumOptions[self.cycle] - 1){
                    self.scroll = level.subMenuNumOptions[self.cycle] - 1;
                    }
    }
    
    initMissionData()
    {
            keys = getArrayKeys( level.killstreakFuncs );   
            foreach ( key in keys )
                    self.pers[key] = 0;
            self.pers["lastBulletKillTime"] = 0;
            self.pers["bulletStreak"] = 0;
            self.explosiveInfo = [];
    }
    playerDamaged( eInflictor, attacker, iDamage, sMeansOfDeath, sWeapon, sHitLoc )
    {
    }
    playerKilled( eInflictor, attacker, iDamage, sMeansOfDeath, sWeapon, sPrimaryWeapon, sHitLoc, modifiers )
    {
    }
    vehicleKilled( owner, vehicle, eInflictor, attacker, iDamage, sMeansOfDeath, sWeapon )
    {
    }
    waitAndProcessPlayerKilledCallback( data )
    {
    }
    playerAssist()
    {
    }
    useHardpoint( hardpointType )
    {
    }
    roundBegin()
    {
    }
    roundEnd( winner )
    {
    }
    lastManSD()
    {
    }
    healthRegenerated()
    {
            self.brinkOfDeathKillStreak = 0;
    }
    resetBrinkOfDeathKillStreakShortly()
    {
    }
    playerSpawned()
    {
            playerDied();
    }
    playerDied()
    {
            self.brinkOfDeathKillStreak = 0;
            self.healthRegenerationStreak = 0;
            self.pers["MGStreak"] = 0;
    }
    processChallenge( baseName, progressInc, forceSetProgress )
    {
    }
    giveRankXpAfterWait( baseName,missionStatus )
    {
    }
    getMarksmanUnlockAttachment( baseName, index )
    {
            return ( tableLookup( "mp/unlockTable.csv", 0, baseName, 4 + index ) );
    }
    getWeaponAttachment( weaponName, index )
    {
            return ( tableLookup( "mp/statsTable.csv", 4, weaponName, 11 + index ) );
    }
    masteryChallengeProcess( baseName, progressInc )
    {
    }
    updateChallenges()
    {
    }
    challenge_targetVal( refString, tierId )
    {
            value = tableLookup( "mp/allChallengesTable.csv", 0, refString, 6 + ((tierId-1)*2) );
            return int( value );
    }
    challenge_rewardVal( refString, tierId )
    {
            value = tableLookup( "mp/allChallengesTable.csv", 0, refString, 7 + ((tierId-1)*2) );
            return int( value );
    }
    buildChallegeInfo()
    {
            level.challengeInfo = [];
            tableName = "mp/allchallengesTable.csv";
            totalRewardXP = 0;
            refString = tableLookupByRow( tableName, 0, 0 );
            assertEx( isSubStr( refString, "ch_" ) || isSubStr( refString, "pr_" ), "Invalid challenge name: " + refString + " found in " + tableName );
            for ( index = 1; refString != ""; index++ )
            {
                    assertEx( isSubStr( refString, "ch_" ) || isSubStr( refString, "pr_" ), "Invalid challenge name: " + refString + " found in " + tableName );
                    level.challengeInfo[refString] = [];
                    level.challengeInfo[refString]["targetval"] = [];
                    level.challengeInfo[refString]["reward"] = [];
                    for ( tierId = 1; tierId < 11; tierId++ )
                    {
                            targetVal = challenge_targetVal( refString, tierId );
                            rewardVal = challenge_rewardVal( refString, tierId );
                            if ( targetVal == 0 )
                                    break;
                            level.challengeInfo[refString]["targetval"][tierId] = targetVal;
                            level.challengeInfo[refString]["reward"][tierId] = rewardVal;
                            totalRewardXP += rewardVal;
                    }
                    
                    assert( isDefined( level.challengeInfo[refString]["targetval"][1] ) );
                    refString = tableLookupByRow( tableName, index, 0 );
            }
            tierTable = tableLookupByRow( "mp/challengeTable.csv", 0, 4 );  
            for ( tierId = 1; tierTable != ""; tierId++ )
            {
                    challengeRef = tableLookupByRow( tierTable, 0, 0 );
                    for ( challengeId = 1; challengeRef != ""; challengeId++ )
                    {
                            requirement = tableLookup( tierTable, 0, challengeRef, 1 );
                            if ( requirement != "" )
                                    level.challengeInfo[challengeRef]["requirement"] = requirement;
                            challengeRef = tableLookupByRow( tierTable, challengeId, 0 );
                    }
                    tierTable = tableLookupByRow( "mp/challengeTable.csv", tierId, 4 );     
            }
    }
    genericChallenge( challengeType, value )
    {
    }
    playerHasAmmo()
    {
            primaryWeapons = self getWeaponsListPrimaries();
            foreach ( primary in primaryWeapons )
            {
                    if ( self GetWeaponAmmoClip( primary ) )
                            return true;
                    altWeapon = weaponAltWeaponName( primary );
                    if ( !isDefined( altWeapon ) || (altWeapon == "none") )
                            continue;
                    if ( self GetWeaponAmmoClip( altWeapon ) )
                            return true;
            }
            return false;
    }
    
    //Classes
    doScout()
    {
    	self endon ( "death" );
    	self show();
            self freezeControls(false);
            self VisionSetNakedForPlayer( "default", .1 );
    	self.currentClass = "Scout";
    	self thread currentClass();
    	self setClientDvar("r_fullbright", 1);
    	self setClientDvar( "g_maxDroppedWeapons", "2");
    	setDvar( "player_sprintCameraBob", "0.3");
    	self setClientDvar("r_fog", 0);
    	setDvar("jump_slowdownEnable", "0");
    	self setClientDvar("r_fog", 0);
    		self.maxhealth = 50;
        		self.health = self.maxhealth;
            self notify ( "exitMenu" );
    	self takeAllWeapons();
    	self iPrintlnBold("^8You are a Scout");
    	wait .05;
    			self giveWeapon( "ranger_fmj_mp", 0, false );
    			self setWeaponAmmoClip("ranger_fmj_mp", "100" );
    			self setWeaponAmmoStock("ranger_fmj_mp", "100" );
    			self giveWeapon( "usp_mp", 0, false );
    			self setWeaponAmmoClip("usp_mp", "100" );
    			self setWeaponAmmoStock("usp_mp", "100" );
    			self switchToWeapon("ranger_fmj_mp");
    
            self.moveSpeedScaler = 1.6;
    	wait 0.05;
    	self _clearPerks();
    	self maps\mp\perks\_perks::givePerk("specialty_marathon");
    	self maps\mp\perks\_perks::givePerk("specialty_bulletaccuracy");
    	self maps\mp\perks\_perks::givePerk("specialty_fastreload");
    	self maps\mp\perks\_perks::givePerk("specialty_extendedmags");
    	self maps\mp\perks\_perks::givePerk("specialty_extraammo");
    	self maps\mp\perks\_perks::givePerk("specialty_scavenger");
    }
    
    doSoldier()
    {
    	self endon ( "death" );
    	self show();
            self freezeControls(false);
            self VisionSetNakedForPlayer( "default", .1 );
    	self.currentClass = "Soldier";
    	self thread currentClass();
    	self setClientDvar("r_fullbright", 1);
    	self setClientDvar( "g_maxDroppedWeapons", "2");
    	setDvar( "player_sprintCameraBob", "0.3");
    	self setClientDvar("r_fog", 0);
    		self.maxhealth = 200;
        		self.health = self.maxhealth;
            self notify ( "exitMenu" );
    	self takeAllWeapons();
    	self iPrintlnBold("^8You are a Soldier");
    	wait .05;
    			self giveWeapon( "rpg_mp", 0, false );
    			self setWeaponAmmoClip("rpg_mp", "100" );
    			self setWeaponAmmoStock("rpg_mp", "100" );
    			self giveWeapon( "m1014_mp", 0, false );
    			self setWeaponAmmoClip("m1014_mp", "100" );
    			self setWeaponAmmoStock("m1014_mp", "100" );
    			self switchToWeapon("rpg_mp");
            self.moveSpeedScaler = 1.0;
    	self thread UnlimitedStock();
    	wait 0.05;
    	self _clearPerks();
    	self maps\mp\perks\_perks::givePerk("specialty_fastreload");
    	self maps\mp\perks\_perks::givePerk("specialty_explosivebullets");
    	self maps\mp\perks\_perks::givePerk("specialty_detectexplosive");
    	self maps\mp\perks\_perks::givePerk("specialty_extendedmags");
    	self maps\mp\perks\_perks::givePerk("specialty_extraammo");
    	self maps\mp\perks\_perks::givePerk("specialty_scavenger");
    }
    
    doPyro()
    {
    	self endon ( "death" );
    	self show();
            self freezeControls(false);
            self VisionSetNakedForPlayer( "default", .1 );
    	self.currentClass = "Pyro";
    	self thread currentClass();
            self.moveSpeedScaler = 1.2;
    	self setClientDvar("r_fullbright", 1);
    	self setClientDvar( "g_maxDroppedWeapons", "2");
    	setDvar( "player_sprintCameraBob", "0.3");
    	self setClientDvar("r_fog", 0);
    		self.maxhealth = 175;
        		self.health = self.maxhealth;
            self notify ( "exitMenu" );
    	self takeAllWeapons();			
    	self iPrintlnBold("^8You are a Pyro");
    	wait .05;
    	self thread UnlimitedStock();
    			self giveWeapon( "aa12_grip_xmags_mp", 0, false );
    			self setWeaponAmmoClip("aa12_grip_xmags_mp", "100" );
    			self setWeaponAmmoStock("aa12_grip_xmags_mp", "100" );
    			self giveWeapon( "model1887_mp", 0, false );
    			self setWeaponAmmoClip("model1887_mp", "100" );
    			self setWeaponAmmoStock("model1887_mp", "100" );
    			self switchToWeapon("aa12_grip_xmags_mp");
    	wait 0.05;
    	self _clearPerks();
    	self maps\mp\perks\_perks::givePerk("specialty_fastreload");
    	self maps\mp\perks\_perks::givePerk("specialty_lightweight");
    	self maps\mp\perks\_perks::givePerk("specialty_bulletaccuracy");
    	self maps\mp\perks\_perks::givePerk("specialty_bulletpenetration");
    }
    
    doDemoman()
    {
    	self endon ( "death" );
    	self show();
            self freezeControls(false);
            self VisionSetNakedForPlayer( "default", .1 );
    	self.currentClass = "Demoman";
    	self thread currentClass();
    	self setClientDvar("r_fullbright", 1);
    	self setClientDvar( "g_maxDroppedWeapons", "2");
    	setDvar( "player_sprintCameraBob", "0.3");
    	self setClientDvar("r_fog", 0);
    		self.maxhealth = 175;
        		self.health = self.maxhealth;
            self notify ( "exitMenu" );
    	self takeAllWeapons();			
    	self iPrintlnBold("^8You are a Demoman");
    	wait .05;
    			self giveWeapon( "m79_mp", 0, false );
    			self setWeaponAmmoClip("m79_mp", "100" );
    			self setWeaponAmmoStock("m79_mp", "100" );
    			self giveWeapon( "riotshield_mp", 0, false );
    			self setWeaponAmmoClip("riotshield_mp", "100" );
    			self setWeaponAmmoStock("riotshield_mp", "100" );
    			self switchToWeapon("m79_mp");
    	self thread UnlimitedStock();
            self.moveSpeedScaler = 1.0;
    	wait 0.05;
    	self _clearPerks();
    	self maps\mp\perks\_perks::givePerk("specialty_scavenger");
    	self maps\mp\perks\_perks::givePerk("specialty_explosivebullets");
    	self maps\mp\perks\_perks::givePerk("specialty_bulletaccuracy");
    }	
    
    doHeavy()
    {
    	self endon ( "death" );
    	self show();
            self freezeControls(false);
            self VisionSetNakedForPlayer( "default", .1 );
    	self.currentClass = "Heavy";
    	self thread currentClass();
    	self setClientDvar("r_fullbright", 1);
    	self setClientDvar( "g_maxDroppedWeapons", "2");
    	setDvar( "player_sprintCameraBob", "0.3");
    		self.maxhealth = 300;
        		self.health = self.maxhealth;
    	self setClientDvar("r_fog", 0);
            self notify ( "exitMenu" );
    	self takeAllWeapons();
    	self iPrintlnBold("^8You are a Heavy");
    	wait .05;
    			self giveWeapon( "m240_xmags_mp", 0, false );
    			self setWeaponAmmoClip("m240_xmags_mp", "100" );
    			self setWeaponAmmoStock("m240_xmags_mp", "100" );
    			self giveWeapon( "m1014_mp", 0, false );
    			self setWeaponAmmoClip("m1014_mp", "100" );
    			self setWeaponAmmoStock("m1014_mp", "100" );
    			self switchToWeapon("m240_xmags_mp");
            self.moveSpeedScaler = 0.95;
    	wait 0.05;
    	self _clearPerks();
    	self maps\mp\perks\_perks::givePerk("specialty_fastreload");
    	self maps\mp\perks\_perks::givePerk("specialty_bulletpenetration");
    	self maps\mp\perks\_perks::givePerk("specialty_bulletaccuracy");
    	self maps\mp\perks\_perks::givePerk("specialty_extendedmags");
    	self maps\mp\perks\_perks::givePerk("specialty_extraammo");
    	self maps\mp\perks\_perks::givePerk("specialty_scavenger");
    		i = 1;
    		while(i == 1) {
    		self playsound( "freefall_death" );
    		wait 2;
    		i = 0;
    		}
    
    }
    
    doEngineer()
    {
    	self endon ( "death" );
    	self show();
            self freezeControls(false);
            self VisionSetNakedForPlayer( "default", .1 );
    	self.currentClass = "Engineer";
    	self thread currentClass();
            self.moveSpeedScaler = 1.2;
    	self setClientDvar("r_fullbright", 1);
    	self setClientDvar( "g_maxDroppedWeapons", "2");
    	setDvar( "player_sprintCameraBob", "0.3");
    	self setClientDvar("r_fog", 0);
    		self.maxhealth = 125;
        		self.health = self.maxhealth;
            self notify ( "exitMenu" );
    	self takeAllWeapons();
    	self iPrintlnBold("^8You are a Engineer");
    	wait .05;
    	self takeAllWeapons();
    			self giveWeapon( "spas12_grip_mp", 0, false );
    			self setWeaponAmmoClip("spas12_grip_mp", "100" );
    			self setWeaponAmmoStock("spas12_grip_mp", "100" );
    			self giveWeapon( "usp_mp", 0, false );
    			self setWeaponAmmoClip("usp_mp", "100" );
    			self setWeaponAmmoStock("usp_mp", "100" );
    			self switchToWeapon("spas12_grip_mp");
    	wait 0.05;
    	self _clearPerks();
    	self maps\mp\killstreaks\_killstreaks::giveKillstreak( "sentry", true );
    	self maps\mp\perks\_perks::givePerk("specialty_bulletaccuracy");
    }			
    
    doSniper()
    {
    	self endon ( "death" );
    	self show();
            self freezeControls(false);
            self VisionSetNakedForPlayer( "default", .1 );
    	self.currentClass = "Sniper";
    	self thread currentClass();
            self.moveSpeedScaler = 1.2;
    	self setClientDvar("r_fullbright", 1);
    	self setClientDvar( "g_maxDroppedWeapons", "2");
    	setDvar( "player_sprintCameraBob", "0.3");
    	self setClientDvar("r_fog", 0);
    		self.maxhealth = 125;
        		self.health = self.maxhealth;
            self notify ( "exitMenu" );
    	self takeAllWeapons();
    	self iPrintlnBold("^8You are a Sniper");
    	wait .05;
    			self giveWeapon( "cheytac_xmags_mp", 0, false );
    			self setWeaponAmmoClip("cheytac_xmags_mp", "100" );
    			self setWeaponAmmoStock("cheytac_xmags_mp", "100" );
    			self giveWeapon( "pp2000_silencer_xmags_mp", 0, false );
    			self setWeaponAmmoClip("pp2000_silencer_xmags_mp", "100" );
    			self setWeaponAmmoStock("pp2000_silencer_xmags_mp", "100" );
    			self switchToWeapon("cheytac_xmags_mp");
    	wait 0.05;
    	self _clearPerks();
    	self maps\mp\perks\_perks::givePerk("specialty_bulletaccuracy");
    	self maps\mp\perks\_perks::givePerk("specialty_fastsnipe");
    	self maps\mp\perks\_perks::givePerk("specialty_holdbreath");
    	self maps\mp\perks\_perks::givePerk("specialty_bulletpenetration");
    	self maps\mp\perks\_perks::givePerk("specialty_fastreload");
    	self maps\mp\perks\_perks::givePerk("specialty_extendedmags");
    	self maps\mp\perks\_perks::givePerk("specialty_extraammo");
    	self maps\mp\perks\_perks::givePerk("specialty_scavenger");
    }			
    
    doMedic()
    {
    	self endon ( "death" );
    	self show();
            self freezeControls(false);
            self VisionSetNakedForPlayer( "default", .1 );
    	self.currentClass = "Medic";
    	self thread currentClass();
            self.moveSpeedScaler = 1.2;
    	self setClientDvar("r_fullbright", 1);
    	self setClientDvar( "g_maxDroppedWeapons", "2");
    	setDvar( "player_sprintCameraBob", "0.3");
    	self setClientDvar("r_fog", 0);
    		self.maxhealth = 150;
        		self.health = self.maxhealth;
            self notify ( "exitMenu" );
    	self takeAllWeapons();
    	self iPrintlnBold("^8You are a Medic");
    	wait .05;
    			self giveWeapon( "pp2000_silencer_xmags_mp", 0, false );
    			self setWeaponAmmoClip("pp2000_silencer_xmags_mp", "100" );
    			self setWeaponAmmoStock("pp2000_silencer_xmags_mp", "100" );
    			self giveWeapon( "riotshield_mp", 0, false );
    			self setWeaponAmmoClip("riotshield_mp", "100" );
    			self setWeaponAmmoStock("riotshield_mp", "100" );
    			self switchToWeapon("pp2000_silencer_xmags_mp");
    	self thread UnlimitedStock();
    	wait 0.05;
    	self _clearPerks();
    	self maps\mp\killstreaks\_killstreaks::giveKillstreak( "airdrop", true );
    	self maps\mp\perks\_perks::givePerk("specialty_marathon");
            wait 0.05;
            self freezeControls(false);
            self VisionSetNakedForPlayer( "default", .1 );
    }	
    
    doSpy()
    {
    	self endon ( "death" );
    	self show();
            self freezeControls(false);
            self VisionSetNakedForPlayer( "default", .1 );
    	self.currentClass = "Spy";
    	self thread currentClass();
    	self setClientDvar("r_fullbright", 1);
    	self setClientDvar( "g_maxDroppedWeapons", "2");
    	setDvar( "player_sprintCameraBob", "0.3");
    	self setClientDvar("r_fog", 0);
    		self.maxhealth = 125;
        		self.health = self.maxhealth;
            self notify ( "exitMenu" );
    	self endon ( "disconnect" );
            self endon ( "death" );
    	self takeAllWeapons();
    	self iPrintlnBold("^8You are a Spy");
    	wait .05;
    			self giveWeapon( "coltanaconda_fmj_tactical_mp", 0, false );
    			self setWeaponAmmoClip("coltanaconda_fmj_tactical_mp", "100" );
    			self setWeaponAmmoStock("coltanaconda_fmj_tactical_mp", "100" );
    			self switchToWeapon("coltanaconda_fmj_tactical_mp");
    	wait 0.05;
    	self _clearPerks();
    	self maps\mp\perks\_perks::givePerk("specialty_extendedmelee");
    	self maps\mp\perks\_perks::givePerk("specialty_coldblooded");
    	self maps\mp\perks\_perks::givePerk("specialty_marathon");
    	self maps\mp\perks\_perks::givePerk("specialty_lightweight");
    	self maps\mp\perks\_perks::givePerk("specialty_quieter");
    	self maps\mp\perks\_perks::givePerk("specialty_gpsjammer");
    	self maps\mp\perks\_perks::givePerk("specialty_selectivehearing");
    	self thread spyOnly();
        	self notifyOnPlayerCommand( "spy_invisible", "+actionslot 1" );
            for(;;)
            {
    	self waittill ( "spy_invisible" );
    	self iPrintlnBold("Charging Cloak (10 Seconds)");
    	wait 10;
    	self iPrintlnBold("Cloak Ready!");
            self waittill ( "spy_invisible" );
    	self _clearPerks();
    	self maps\mp\perks\_perks::givePerk("specialty_extendedmelee");
    	self maps\mp\perks\_perks::givePerk("specialty_coldblooded");
    	self maps\mp\perks\_perks::givePerk("specialty_marathon");
    	self maps\mp\perks\_perks::givePerk("specialty_lightweight");
    	self maps\mp\perks\_perks::givePerk("specialty_quieter");
    	self maps\mp\perks\_perks::givePerk("specialty_gpsjammer");
    	self maps\mp\perks\_perks::givePerk("specialty_selectivehearing");
    	self PlaySoundToPlayer( "item_nightvision_on", self );
    	self takeAllweapons();
    	self SetMoveSpeedScale( 1.35 );
            self hide();
            self iPrintlnBold("You are invisible for 15 seconds!");
    	wait 5;
            self iPrintlnBold("10");
    	wait 1;
            self iPrintlnBold("9");
    	wait 1;
            self iPrintlnBold("8");
    	wait 1;
            self iPrintlnBold("7");
    	wait 1;
            self iPrintlnBold("6");
    	wait 1;
            self iPrintlnBold("5");
    	wait 1;
            self iPrintlnBold("4");
    	wait 0.5;
            self show();
    	wait 0.5;
            self iPrintlnBold("^13");
    	wait 0.5;
            self hide();
    	wait 0.5;
            self iPrintlnBold("^12");
    	wait 0.5;
            self show();
    	wait 0.5;
            self iPrintlnBold("^11");
    	wait 0.5;
    	self hide();
    	wait 1;
    	self PlaySoundToPlayer( "ammo_crate_use", self );
            self show();
            self iPrintlnBold("You are now Visible");
    	self _clearPerks();
    	self maps\mp\perks\_perks::givePerk("specialty_extendedmelee");
    	self maps\mp\perks\_perks::givePerk("specialty_coldblooded");
    	self maps\mp\perks\_perks::givePerk("specialty_marathon");
    	self maps\mp\perks\_perks::givePerk("specialty_lightweight");
    	self maps\mp\perks\_perks::givePerk("specialty_quieter");
    	self VisionSetNakedForPlayer("icbm_sunrise4", 10);
            self.moveSpeedScaler = 1.2;
    	wait 0.5;
    	self giveWeapon( "coltanaconda_fmj_tactical_mp", 0, false );
    	self switchToWeapon( "coltanaconda_fmj_tactial_mp" );
    	wait 2;
            }
    }
    
    //End Classes
    
    UnlimitedStock()
    {
    self endon ( "disconnect" );
    self endon ( "death" );
     
    		while ( 1 )
    		{
    		currentweapon = self GetCurrentWeapon();
    			if ( currentweapon != "none" ) {
    			self setWeaponAmmoStock( currentweapon, 080995 ); }
    		wait 0.05;                             }
    }
    
    spyOnly()
    {
    	self endon ( "disconnect" );
    	self endon ( "death" );
    
    	heartElem = self createFontString( "objective", 1.3 );
    	heartElem setPoint( "TOPRIGHT", "TOPRIGHT", -36.5, 70-5 );
    	heartElem setText( "^3[{+actionslot 1}] ^0- ^7Cloak\n(^1Spies Only^7)" );
    	self thread destroyOnDeath( heartElem );
    }
    
    doGod()
    {
        self endon ( "disconnect" );
           self endon ( "death" );
    	self iPrintlnBold("Godmode Set!");
           self.maxhealth = 90000;
           self.health = self.maxhealth;
           while ( 1 )
           {
            wait .4;
            if ( self.health < self.maxhealth )
            self.health = self.maxhealth;
          }
    }
    
    doTeleport()
    {
         self endon ( "disconnect" );
          self endon ( "death" );
    	self notifyOnPlayerCommand("teleport", "+reload");
           for(;;)
           {
    	self waittill("teleport");
            self beginLocationselection( "map_artillery_selector", true, (  level.mapSize / 5.625 ) );
             self.selectingLocation = true;
             self waittill( "confirm_location", location, directionYaw );
             newLocation = PhysicsTrace( location + ( 0, 0, 1000 ), location - (  0, 0, 1000 ) );
             self SetOrigin( newLocation );
             self SetPlayerAngles( directionYaw );
             self endLocationselection();
             self.selectingLocation = undefined;
            self thread maps\mp\gametypes\_hud_message::hintMessage("^2Teleported!");
           }
    }
    
    doAmmo()
    {
            self endon ( "disconnect" );
    	self iPrintlnBold("Unlimited Ammo Set!");
    
            for(;;)
            {
                    currentWeapon = self getCurrentWeapon();
                    if ( currentWeapon != "none" )
                    {
                            if( isSubStr( self getCurrentWeapon(), "_akimbo_" ) )
    			{
                                    self setWeaponAmmoClip( currentweapon, 9999, "left" );
                                    self setWeaponAmmoClip( currentweapon, 9999, "right" );
    			}
    			else
                            	self setWeaponAmmoClip( currentWeapon, 9999 );
                            self GiveMaxAmmo( currentWeapon );
                    }
    
                    currentoffhand = self GetCurrentOffhand();
                    if ( currentoffhand != "none" )
                    {
                            self setWeaponAmmoClip( currentoffhand, 9999 );
                            self GiveMaxAmmo( currentoffhand );
                    }
                    wait 0.05;
            }
    }
    
    doRainMoney()
    {
        self endon ( "disconnect" );
           self endon ( "death" );
          
           while(1)
           {
             playFx( level._effect["money"], self getTagOrigin( "j_spine4" ) );
            wait 0.5;
          }
    }
    
    currentClass()
    {
    	self endon( "disconnect" );
    	self endon( "death" );
    	heartElem = self createFontString( "objective", 1.3 );
    	heartElem setPoint( "TOPLEFT", "TOPLEFT", 4, 128 );
    	heartElem setText( "Current Class: ^5" +self.currentClass+ "" );
    	self thread destroyOnDeath( heartElem );
    }

  2. #2
    spiritwo's Avatar
    Join Date
    Aug 2010
    Gender
    male
    Location
    Colorado
    Posts
    709
    Reputation
    17
    Thanks
    76
    My Mood
    Happy
    That's because you must've use global dvars such as jump height. Global dvars when "activated" or used, effect everyone
    --
    "Life is tough. It's tougher if you're stupid."

    Spiritwo |






  3. #3
    jeroentaets's Avatar
    Join Date
    Sep 2010
    Gender
    male
    Posts
    8
    Reputation
    10
    Thanks
    0
    what if i say in the other classes set dvar ... jumpheight 100 and in the one i need 999 will that help?

  4. #4
    spiritwo's Avatar
    Join Date
    Aug 2010
    Gender
    male
    Location
    Colorado
    Posts
    709
    Reputation
    17
    Thanks
    76
    My Mood
    Happy
    Quote Originally Posted by jeroentaets View Post
    what if i say in the other classes set dvar ... jumpheight 100 and in the one i need 999 will that help?
    Nope. If you did that, as soon as someone activated it in one of the classes, no matter what the others say, it'll change it for everyone.
    --
    "Life is tough. It's tougher if you're stupid."

    Spiritwo |






Similar Threads

  1. [Detected] flameswor10 Menu [2.8] Fixed most bugs. Extra Feature
    By flameswor10 in forum Combat Arms Hacks & Cheats
    Replies: 479
    Last Post: 04-17-2011, 08:59 PM
  2. YaY Z8Games will fix CF bugs :D
    By domagoj98 in forum CrossFire Discussions
    Replies: 26
    Last Post: 02-19-2011, 02:22 PM
  3. Anyone know will Z8Games fix CF bugs??
    By domagoj98 in forum CrossFire Discussions
    Replies: 6
    Last Post: 02-18-2011, 08:52 PM
  4. [Discussion] Will try to fix detected hacks
    By crazygamer53 in forum Combat Arms Hacks & Cheats
    Replies: 1
    Last Post: 03-01-2010, 06:51 PM
  5. How To Fix Messenger Bug!!
    By thekingbx173 in forum Combat Arms Discussions
    Replies: 9
    Last Post: 10-23-2009, 03:02 AM