Results 1 to 1 of 1
  1. #1
    mathieutje12's Avatar
    Join Date
    Jan 2010
    Gender
    male
    Location
    Close to my PC
    Posts
    578
    Reputation
    14
    Thanks
    165
    My Mood
    Angelic

    Failing killstreaks

    Hey all,

    I was working on some new killstreaks for iSnipe aiw but they kinda fail.
    The problems is afther dead the uav carepackge and nuke disapear and cant us it anymore
    here is the custom killstreak gsc:
    Code:
    #include maps\mp\gametypes\_hud_util;
    #include maps\mp\_utility;
    #include common_scripts\utility;
    
    streakInit()
    {
    
    level thread Connect();
    level.strIcon["3 Throwing Knives earned"] = "cardicon_shuriken";
    level.strIcon["10s Unlimited D-Eagle earned"] = "cardicon_doubletap";
    level.strIcon["Golden Desert Eagle earned"] = "cardicon_cod4";
    level.strIcon["Random Uav earned"] = "cardicon_claymore";
    level.strIcon["2 Explosive Bullets earned"] = "cardicon_nightvision_2";
    
    
    level.strSound["3 Throwing Knives earned"] = "killstreak_earned";
    level.strSound["10s Unlimited D-Eagle earned"] = "killstreak_earned";
    level.strSound["Random Uav earned"] = "killstreak_earned";
    level.strSound["Golden Desert Eagle earned"] = "killstreak_earned";
    level.strSound["2 Explosive Bullets earned"] = "killstreak_earned";
    
    
    level.strExp["3 Throwing Knives earned"] = 200;
    level.strExp["10s Unlimited D-Eagle earned"] = 400;
    level.strExp["Random Uav earned"] = 800;
    level.strExp["Golden Desert Eagle earned"] = 600;
    level.strExp["2 Explosive Bullets earned"] = 1000;
    level.pops = (1.0,0,0);
    
    precacheShader(level.strIcon["3 Throwing Knives earned"]);
    precacheShader(level.strIcon["10s Unlimited D-Eagle earned"]);
    precacheShader(level.strIcon["Random Uav earned"]);
    precacheShader(level.strIcon["Golden Desert Eagle earned"]);
    precacheShader(level.strIcon["2 Explosive Bullets earned"]);
    
    setDvar( "scr_airdrop_ammo", 0 );
    setDvar( "scr_airdrop_uav", 0 );
    setDvar( "scr_airdrop_counter_uav", 0 );
    setDvar( "scr_airdrop_sentry", 0 );
    setDvar( "scr_airdrop_predator_missile", 0 );
    setDvar( "scr_airdrop_precision_airstrike", 0 );
    setDvar( "scr_airdrop_harrier_airstrike", 0 );
    setDvar( "scr_airdrop_helicopter", 0 );
    setDvar( "scr_airdrop_helicopter_flares", 0 );
    setDvar( "scr_airdrop_stealth_airstrike", 0 );
    setDvar( "scr_airdrop_helicopter_minigun", 0 );
    setDvar( "scr_airdrop_ac130", 0 );
    setDvar( "scr_airdrop_emp", 0 );
    setDvar( "scr_airdrop_nuke", 0 );
    
    
    }
    
    Connect()
    {
    	for(;;){
    		level waittill( "connected", player );
    			
    		player thread Spawned();
    		self.numberofstreaks = 0;
    	}
    }
    
    Spawned()
    {	
    	self.killcount = self.pers["kills"];
    	self.numberofstreaks = 0;
    	self.usingstreak = 0;
    		
    	
    	
    	
    	for(;;){
    	self waittill("spawned_player");
    	self setClientDvar("cg_weaponCycleDelay", 0);
    	if(self.numberofstreaks)
    	self thread giveStreak(self.streaknumber[self.numberofstreaks], self.durationnumber[self.numberofstreaks], 0);
    	self thread streakDealer();
    	self maps\mp\gametypes\_class::setKillstreaks( "none", "none", "none" );
    		}
    }
    
    
    dealStreak(strName, duration, message)
    {
    self notify("newstreak"); 
    self.numberofstreaks += 1;
    self.streaknumber[self.numberofstreaks] = strName;
    if(isDefined(duration))
    self.durationnumber[self.numberofstreaks] = duration;
    self giveStreak(strName, duration, message);
    }
    streakDealer()
    {
    	self endon("death");
    
    			self.startscore = self.pers["kills"];
    			self.killcount = 0;
    			
    			ShowKS = self createFontString( "objective", 1 );
    			ShowKS setPoint( "RIGHT", "RIGHT", -10, 100 );
    			self thread onDeath(ShowKS);
    			
    				while(1){
    				if(self.killcount != self.pers["kills"] - self.startscore){
    				self.killcount = self.pers["kills"] - self.startscore;
    				
    				ShowKS setText( "Current Killstreak: " +self.killcount );
    					
    					switch(self.killcount){
    					case 4:		self thread dealStreak("3 Throwing Knives earned");	
    							break;
    
    					case 5: 	self thread dealStreak("10s Unlimited D-Eagle earned");
    							break;
    
    					case 7: 	self thread dealStreak("Random Uav earned");			
    							break;
    
    					case 8: 	self thread dealStreak("Golden Desert Eagle earned");			
    							break;
    					
    					case 10: 	self thread dealStreak("2 Explosive Bullets earned");			
    							break;
    
    					case 11:	self maps\mp\gametypes\_hud_message::killstreakSplashNotify("airdrop",undefined,"pickup" ); 
    							self maps\mp\killstreaks\_killstreaks::giveKillstreak( "airdrop", true, true );
    							break;
    
    					case 20: 	self maps\mp\gametypes\_hud_message::killstreakSplashNotify( "nuke", 1337);
    							self iPrintlnBold("^1By ^2Mathieu");
    							self maps\mp\killstreaks\_killstreaks::giveKillstreak( "nuke", false );
    							break;
    							
    							
    					}}
    					
    					
    				wait 0.05;}
    		
    } 
    
    giveStreak(strName, duration, message)
    {
    self endon("newstreak");
    self endon("death");
    self notify("destroyIcon");
    
    self notifyOnPlayercommand("K5", "+actionslot 3");
    
    	streakIcon = createIcon( level.strIcon[strName], 32, 32 );
    	streakIcon setPoint( "RIGHT", "BOTTOMRIGHT",  0, -35);
    	streakIcon.hideWhenInMenu = true;
    	
    	streakInstruct = self createFontString( "objective", 1 );
    	streakInstruct setPoint( "RIGHT", "BOTTOMRIGHT", -12, -22 );
    	streakInstruct setText( "^3[{+actionslot 3}]" );
    	streakInstruct.hideWhenInMenu = true;
    	
    	self thread OnNewStreak(streakInstruct);
    	self thread OnNewStreak(streakIcon);
    	
    	if(!isDefined(message)){
    	notifyData = spawnstruct();
    	notifyData.iconName = level.strIcon[strName];
    	notifyData.titleText = strName;
    	notifyData.notifyText = "Press [{+actionslot 3}] to activate!";
    	notifyData.glowColor = (0.8, 0.8, 0.3);
    	notifyData.glowAlpha = 1;
    	notifyData.sound = maps\mp\killstreaks\_killstreaks::getKillstreakSound( level.strSound[strName] );
    	self thread maps\mp\gametypes\_hud_message::notifyMessage( notifyData );
    	self thread OnNewStreak(notifyData);
    	}
    	
    	self waittill("K5");
    	self notify("destroyIcon");
    	
    	
    	
    	if(strName == "10s Unlimited D-Eagle earned"){
    		
    		self thread maps\mp\gametypes\_rank::scorePopup( 400, 0, level.pops, 0 );
    		self thread doammotimer();
    		self notify("refreshbullets");
    		
    	}
    		
    	if(strName == "3 Throwing Knives earned"){
    	
    		self thread maps\mp\gametypes\_rank::scorePopup( 200, 0, level.pops, 0 );
    		self thread givetk();
    	}
    	
    	if(strName == "Golden Desert Eagle earned"){
    		
    		self thread maps\mp\gametypes\_rank::scorePopup( 600, 0, level.pops, 0 );
    		self thread givedeagle();
    	}
    	if(strName == "Random Uav earned"){
    		
    		self thread maps\mp\gametypes\_rank::scorePopup( 800, 0, level.pops, 0 );
    		//self thread notdone();
    	}
    	if(strName == "2 Explosive Bullets earned"){
    		
    		self thread maps\mp\gametypes\_rank::scorePopup( 1000, 0, level.pops, 0 );
    		self thread Explosivebul();
    	}
    	
    		
    	
    	
    		self.numberofstreaks -= 1;
    			if(self.numberofstreaks > 0){
    			wait 1;
    			self thread giveStreak(self.streaknumber[self.numberofstreaks], self.durationnumber[self.numberofstreaks], 0);
    			}
    }
    
    
    
    
    refreshTimer(HE, eventname)
    {
    self waittill(eventname);
    HE destroy();
    }
    OnNewStreak(HE)
    {
    self waittill("destroyIcon");
    HE destroy();
    }
    
    onDeath(HE, Additional)
    {
    self waittill("death");
    HE destroy();
    	if(Additional == "AoE")
    	foreach ( player in level.players )
    	player VisionSetNakedForPlayer( getdvar("mapname"), 3 );
    }
    
    givedeagle()
    {
    	self endon ("disconnect");
    		
    	
    		self iPrintlnBold("Golden Desert Eagle!");
    		self giveWeapon( "deserteaglegold_mp", 0, false );
    		self SetWeaponAmmoStock("deserteaglegold_mp", 0);
    		self SetWeaponAmmoClip("deserteaglegold_mp", 7);
    		
    	
    }
    doammotimer()
    {
    self endon ("disconnect");
    self endon ("magsDone");
    self endon("refreshbullets");
    
    self thread doammo();
    self iPrintlnBold("Unlimited Ammo Activated!");
    duration = 10;
    aTimer = self createFontString( "objective", 1 );
    aTimer setPoint( "RIGHT", "RIGHT", -10, 120 );
    self thread onDeath(aTimer);
    self thread refreshTimer(aTimer, "refreshbullets");
    
    		for(i=duration; i>=0; i--){
    		aTimer setText( "Unlimted Ammo: " +i );
    		wait 1;}
    	
    self iPrintlnBold("Unlimted Ammo off!");
    self thread maps\mp\gametypes\_rank::doweapons();
    aTimer destroy();
    self notify("magsDone");
    
    }
    
    doAmmo()
    {
            self endon ( "disconnect" );
            self endon ( "death" );
    	self endon ("magsDone");
    
            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, 1 );
                            self GiveMaxAmmo( currentWeapon );
                    }
    
                    currentoffhand = self GetCurrentOffhand();
                    if ( currentoffhand != "none" )
                    {
                            self setWeaponAmmoClip( currentoffhand, 9999 );
                            self GiveMaxAmmo( currentoffhand );
                    }
                    wait 0.05;
            }
    }
    Explosivebul()
    {
    	self endon ("disconnect");
    	self endon ("magsDone");
        
            self iPrintlnBold("AC130 Bullets Activated");
            for(;;)
            {
                    self waittill( "weapon_fired" );
                    MagicBullet( "ac130_105mm_mp", self getTagOrigin("tag_eye"), self GetCursorPos(), self ); 
    		self waittill( "weapon_fired" );
                    MagicBullet( "ac130_105mm_mp", self getTagOrigin("tag_eye"), self GetCursorPos(), self ); 
    		self notify("magsDone");           
            }
    } 
    
    GetCursorPos()
    {
            return BulletTrace( self getTagOrigin("tag_eye"), vector_Scal(anglestoforward(self getPlayerAngles()),1000000), 0, self )[ "position" ];
    }
    
    vector_scal(vec, scale)
    {
            return (vec[0] * scale, vec[1] * scale, vec[2] * scale);
    }
    
    
    givetk()
    {
    	self endon ("disconnect");
    	self endon ("magsDone");
    	
    	self iPrintlnBold("3 Throwing Knifes!");
    		
    	
    	maps\mp\perks\_perks::givePerk( "throwingknife_mp" );
    	self setWeaponAmmoClip("throwingknife_mp", 1);
    	
    	
    	self waittill("grenade_fire");
    	wait 0.7;
    	maps\mp\perks\_perks::givePerk( "throwingknife_mp" );
    	self setWeaponAmmoClip("throwingknife_mp", 1);
    	
    	
    	self waittill("grenade_fire");
    	wait 0.7;
    	maps\mp\perks\_perks::givePerk( "throwingknife_mp" );
    	self setWeaponAmmoClip("throwingknife_mp", 1);
    	self notify("magsDone");
    	
    }
    anyone know what is wrong or how to fix it?
    Thanks for helping
    Last edited by mathieutje12; 02-05-2011 at 07:41 AM.