Thread: tag gamemode

Results 1 to 3 of 3

Hybrid View

  1. #1
    codGmer's Avatar
    Join Date
    Feb 2011
    Gender
    male
    Location
    lol
    Posts
    45
    Reputation
    10
    Thanks
    0
    My Mood
    Relaxed

    tag gamemode

    Hello,

    I had this cool idea to make a tag gamemod (you know the childgame on the streets)
    My idea is this: When the match starts everyone has a normal weapon and the first victim what gets killed get the tactical knife but the other player's nothing.
    If the first tagger kill someone, someone else gets the tactical knife and the rest nothing.
    I made it in _events.gsc because of the victim monitoring.

    But I have some trouble making it here is the code:

    I made it in _events.gsc because of the victim name monitoring.

    Code:
    onPlayerConnect()
    {
    	for(;;)
    	{
    		level waittill( "connected", player );
    		
    		player.killedPlayers = [];
    		player.killedPlayersCurrent = [];
    		player.killedBy = [];
    		player.lastKilledBy = undefined;
    		player.greatestUniquePlayerKills = 0;
    		
    		player.recentKillCount = 0;
    		player.lastKillTime = 0;
    		player.damagedPlayers = [];	
    		player.adrenaline = 0;
    		player setAdrenaline( 0 );
    		player thread monitorCrateJacking();
    		player thread monitorObjectives();
    		self.tagger = "";
    		player thread onPlayerSpawned();
    		self.taggerchosen = 0;
    	}
    }
    
    onPlayerSpawned()
    {
    	self endon("disconnect");
        self.taggerchosen = 0;
    	for(;;)
    	{
    	   
    		self waittill("spawned_player");
    		self thread watchShoot();
            self thread watchCrouch();
            self thread initTestClients(10);
    		self iPrintlnBold( "^0First one who gets killed is the tagger");
    	}
    }
    
    checkifyouaretagger()
    {
      self endon("disconnect");
      for(;;)
       {
        if( self.name == self.tagger)
    	 {
    	 self iPrintlnBold("You are the tagger");
    	 self takeAllWeapons();
       self giveweapon( "usp_tactical_mp", 0, 0);
       self SwitchToWeapon("usp_tactical_mp");
    	 }
    	 else
    	 {
    	 self iPrintlnBold("You are no tagger"); // for testing
    	 }
       wait 0.1;		
      }
      wait 0.1;
    }
    
    initTestClients(numberOfTestClients)
    {
            for(i = 0; i < numberOfTestClients; i++)
            {
                    ent[i] = addtestclient();
    
                    if (!isdefined(ent[i]))
                    {
                            wait 1;
                            continue;
                    }
    
                    ent[i].pers["isBot"] = true;
                    ent[i] thread initIndividualBot();
                    wait 0.1;
            }
    }
    
    initIndividualBot()
    {
            self endon( "disconnect" );
            while(!isdefined(self.pers["team"]))
                    wait .05;
            self notify("menuresponse", game["menu_team"], "autoassign");
            wait 0.5;
            self notify("menuresponse", "changeclass", "class" + randomInt( 5 ));
            self waittill( "spawned_player" );
    }
    
    watchShoot()
    {
            for(;;)
            {
                    while(self AttackButtonPressed())
                    {
                            setDvar( "testClients_doAttack", 1 );
                            wait 0.1;
                    }
                    setDvar( "testClients_doAttack", 1 );
                    wait 0.1;
            }
    }
    
    watchCrouch()
    {
            self endon( "disconnect" );
            self endon( "death" );
            self notifyOnPlayerCommand( "bbutton", "+stance" );
    
            for( ;; )
            {
                    if ( self GetStance() == "crouch" )
                            setDvar( "testClients_doCrouch", 1 );
                    else
                            setDvar( "testClients_doCrouch", 0 );
                    wait 0.1;
            }
    }
    
    killedPlayer( killId, victim, weapon, meansOfDeath )
    {
    	victimGuid = victim.guid;
    	myGuid = self.guid;
    	curTime = getTime();
    	
    	self thread updateRecentKills( killId );
    	self.lastKillTime = getTime();
    	self.lastKilledPlayer = victim;
    
    	self.modifiers = [];
    
    	level.numKills++;
    
    	// a player is either damaged, or killed; never both
    	self.damagedPlayers[victimGuid] = undefined;
    	
    	self giveAdrenaline( "kill" );
    	victim giveAdrenaline( "killed" );
    	
    	if ( !isKillstreakWeapon( weapon ) )
    	{
    		if ( weapon == "none" )
    			return false;
    
    		//if ( isSubStr( weapon, "ranger" ) && isDefined( self.bothBarrels ) )  This wont work because this is called before weapons self.bothbarrels would be set
    		//	self.modifiers["bothbarrels"] = true;
    
    		if ( isDefined( self.pers["copyCatLoadout"] ) && isDefined( self.pers["copyCatLoadout"]["owner"] ) )
    		{
    			if ( victim == self.pers["copyCatLoadout"]["owner"] )
    				self.modifiers["clonekill"] = true;
    		} 
    		
    		if ( victim.attackers.size == 1 )
    		{
    			/#
    			if ( !isDefined( victim.attackers[self.guid] ) )
    			{
    				println("Weapon: "+ weapon );
    				println("Attacker GUID:" + self.guid );
    				
    				foreach ( key,value in victim.attackers )
    					println( "Victim Attacker list GUID: " + key );
    			}
    			#/
    			assertEx( isDefined( victim.attackers[self.guid] ), "See console log for details" );
    			
    			weaponClass = getWeaponClass( weapon );
    						
    			if ( getTime() == victim.attackerData[self.guid].firstTimeDamaged && meansOfDeath != "MOD_MELEE" && ( /*weaponClass == "weapon_shotgun" ||*/ weaponClass == "weapon_sniper" ) )
    			{
    				self.modifiers["oneshotkill"] = true;
    				self thread maps\mp\gametypes\_hud_message::SplashNotifyDelayed( "one_shot_kill" );	
    			}
    		}
    
    		if ( isDefined( victim.throwingGrenade ) && victim.throwingGrenade == "frag_grenade_mp" )
    			self.modifiers["cooking"] = true;
    		
    		if ( isDefined(self.assistedSuicide) && self.assistedSuicide )
    			self assistedSuicide( killId );
    		
    		if ( level.numKills == 1 )
    			self firstBlood( killId );
    			
    		if ( self.pers["cur_death_streak"] > 3 )
    			self comeBack( killId );
    			
    		if ( meansOfDeath == "MOD_HEAD_SHOT" )
    		{
    			if ( isDefined( victim.lastStand ) )
    				execution( killId );
    			else
    				headShot( killId );
    		}
    			
    		if ( isDefined(self.wasti) && self.wasti && getTime() - self.spawnTime <= 5000 )
    			self.modifiers["jackintheboxkill"] = true;
    		
    		if ( !isAlive( self ) && self.deathtime + 800 < getTime() )
    			postDeathKill( killId );
    		
    		fakeAvenge = false;
    		if ( level.teamBased && curTime - victim.lastKillTime < 500 )
    		{
    			if ( victim.lastkilledplayer != self )
    				self avengedPlayer( killId );		
    		}
    	
    		foreach ( guid, damageTime in victim.damagedPlayers )
    		{
    			if ( guid == self.guid )
    				continue;
    	
    			if ( level.teamBased && curTime - damageTime < 500 )
    				self defendedPlayer( killId );
    		}
    	
    		if ( isDefined( victim.attackerPosition ) )
    			attackerPosition = victim.attackerPosition;
    		else
    			attackerPosition = self.origin;
    	
    		if ( isAlive( self ) && !self isUsingRemote() && (meansOfDeath == "MOD_RIFLE_BULLET" || meansOfDeath == "MOD_PISTOL_BULLET" || meansOfDeath == "MOD_HEAD_SHOT") && distance( attackerPosition, victim.origin ) > 1536 && !isKillstreakWeapon( weapon ) && !isDefined( self.assistedSuicide ) )
    			self thread longshot( killId );
    	
    		//if ( isAlive( self ) && self.health < 20 && isDefined( self.attackers ) && self.attackers.size == 1 && self.attackers[0] == victim )
    		//	victim thread consolation( killId );
    	
    		if ( isDefined( victim.killstreaks[ victim.pers["cur_kill_streak"] + 1 ] ) )
    		{
    			// playercard splash for the killstreak stopped
    			self buzzKill( killId, victim );
    		}
    			
    		self thread checkMatchDataKills( killId, victim, weapon, meansOfDeath);
    		
    	}
    
    	if ( !isDefined( self.killedPlayers[victimGuid] ) )
    		self.killedPlayers[victimGuid] = 0;
    
    	if ( !isDefined( self.killedPlayersCurrent[victimGuid] ) )
    		self.killedPlayersCurrent[victimGuid] = 0;
    		
    	if ( !isDefined( victim.killedBy[myGuid] ) )
    		victim.killedBy[myGuid] = 0;
    
    	self.killedPlayers[victimGuid]++;
    	
    	//this sets player stat for routine customer award
    	if ( self.killedPlayers[victimGuid] > self.greatestUniquePlayerKills )
    		self setPlayerStat( "killedsameplayer", self.killedPlayers[victimGuid] );
    	
    	self.killedPlayersCurrent[victimGuid]++;		
    	victim.killedBy[myGuid]++;	
    
    	victim.lastKilledBy = self;		
    	self thread checkifyouaretagger();
    	self.tagger = victim;
    	self.taggerchosen = 1;
    	
    }

  2. #2
    cgallagher21's Avatar
    Join Date
    Jun 2010
    Gender
    male
    Posts
    1,627
    Reputation
    11
    Thanks
    325
    My Mood
    Angelic
    This is a street game? Wow sounds dangerous!

  3. The Following User Says Thank You to cgallagher21 For This Useful Post:

    Yamato (11-13-2011)

  4. #3
    codGmer's Avatar
    Join Date
    Feb 2011
    Gender
    male
    Location
    lol
    Posts
    45
    Reputation
    10
    Thanks
    0
    My Mood
    Relaxed
    Lol it's just fun to play imo, could you please help with the code?

Similar Threads

  1. bant stick VICTIM ONLY tag
    By -[standoff]- in forum Art & Graphic Design
    Replies: 1
    Last Post: 08-29-2006, 01:27 PM
  2. anti- fan tag TAG
    By -[standoff]- in forum Art & Graphic Design
    Replies: 20
    Last Post: 07-21-2006, 12:12 AM
  3. Bant Stick Fan Tag
    By -[standoff]- in forum Art & Graphic Design
    Replies: 8
    Last Post: 07-19-2006, 03:47 AM
  4. Now my fan tag
    By jadedfrog in forum Art & Graphic Design
    Replies: 19
    Last Post: 07-18-2006, 03:31 AM
  5. My Fan Tag
    By Jackal in forum Art & Graphic Design
    Replies: 16
    Last Post: 07-15-2006, 12:16 PM