Thread: [PI] Killstreak System 100%

Page 1 of 12 12311 ... LastLast
Results 1 to 10 of 115
  1. #1 [PI] Killstreak System 100% 
    Registered Member Kota Ko's Avatar
    Join Date
    Aug 2009
    Age
    26
    Posts
    1,040
    Thanks given
    39
    Thanks received
    61
    Rep Power
    39
    Purpose: Killstreak System
    Difficulty: 1.6/10
    Note: This is a basic Killstreak system can be implemented, if going to use please give credits.
    Credits: Me - 70%
    D R O - 25%
    Some people - 5%


    Warning: If you don't want players to kill same player over and over for killstreaks make sure you did this tutorial:

    Pk Point System(UNCHEATABLE) [Archive] - RuneLocus

    Create a file called KillingStreak.java (server.model.players.contents)

    Code:
    package server.model.players.contents;
    
    import server.model.players.Client;
    import server.Server;
    import server.model.players.PlayerHandler;
    import server.model.players.Player;
    
    /**
     * Killing Streak System
     * 
     * @author Dakota Chest
     */
    
    public class KillingStreak {
    
    		Client c;
    	
    		public KillingStreak(Client c) {
    			this.c = c;
    		}
    	
    		/**
    		* Sends the message throughout the server
    		*/
    		
    		public void yell(String msg) {
    			for (int j = 0; j < Server.playerHandler.players.length; j++) {
    				if (Server.playerHandler.players[j] != null) {
    				Client c2 = (Client)Server.playerHandler.players[j];
    				c2.sM(msg);
    				}
    			}	
    		}
    		
    		/**
    		* Add rewards to the player who died
    		* with the kill streak
    		* 
    		*/
    		
    		public void Rewards() {
    			Client o = (Client) PlayerHandler.players[c.killerId];
    			if (o.killStreak == 2) {
    					c.getItems().addItem(995,2000000);		
    			} else if (o.killStreak == 3) {
    					c.getItems().addItem(995,3000000);
    			} else if (o.killStreak == 4) {
    					c.getItems().addItem(995,4000000);
    			} else if (o.killStreak == 5) {
    					c.getItems().addItem(995,5000000);
    			} else if (o.killStreak == 6) {
    					c.getItems().addItem(995,6000000);
    			} else if (c.killStreak == 2) {
    					c.getItems().addItem(995,2000000);						
    			} else if (c.killStreak == 3) {
    					c.getItems().addItem(995,3000000);
    			} else if (c.killStreak == 4) {
    					c.getItems().addItem(995,4000000);
    			} else if (c.killStreak == 5) {
    					c.getItems().addItem(995,5000000);
    			} else if (c.killStreak == 6) {
    					c.getItems().addItem(995,6000000);							
    			}
    		}
    		
    		/**
    		* Checks the player if they have
    		* a killstreak of 2 or more
    		* can add on
    		* 
    		*/
    		
    		public void checkKillStreak() {
    			switch (c.killStreak){
    				case 2:
    					yell("@red@PvP System:@bla@ "+c.playerName+", is on a killing streak of two, Bounty: 2M!");
    					break;
    				case 3:
    					yell("@red@PvP System:@bla@ "+c.playerName+", is on a killing streak of three, Bounty: 3M!");
    					break;
    				case 4:
    					yell("@red@PvP System:@bla@ "+c.playerName+", is on a killing streak of four, Bounty: 4M!");
    					break;
    				case 5:
    					yell("@red@PvP System:@bla@ "+c.playerName+", is on a killing streak of five, Bounty: 5M!");
    					break;
    				case 6:
    					yell("@red@PvP System:@bla@ "+c.playerName+", is on a killing streak of six, Bounty: 6M!");
    					break;
    				}		
    			}
    
    		/**
    		* Checks if the player with the killstreak
    		* died add items to the killer
    		* 
    		*/	
    			
    		public void killedPlayer() {
    			Client o = (Client) PlayerHandler.players[c.killerId];
    				if (o.killStreak >= 2 || c.killerId != o.playerId) {
    					yell("@red@PvP System:@bla@ "+c.playerName+" has ended "+o.playerName+" killing streak of "+o.killStreak+", and was rewarded.");
    						Rewards();
    						}
    				  }	  
    			}
    Now close and save that.

    In Player.java add

    Code:
    killStreak,
    Now close and save that.

    In playerSave.java under
    Code:
    pc-points
    add

    Code:
    } else if (token.equals("killStreak")) {
    						p.killStreak = Integer.parseInt(token2);
    Now search pc-points again and under that add

    Code:
    characterfile.write("killStreak = ", 0, 13);
    			characterfile.write(Integer.toString(p.killStreak), 0, Integer.toString(p.killStreak).length());
    			characterfile.newLine();
    Now close and save.

    Import client.java
    Code:
    import server.model.players.contents.*;
    Still in client.java under
    Code:
    private Food food = new Food(this);
    add

    Code:
    private KillingStreak killingStreak = new KillingStreak(this);
    Still in client.java under
    Code:
    public ActionHandler getActions() {
    add

    Code:
    public KillingStreak getStreak() {
    		return killingStreak;
    	}
    Now close and save.

    Now open playerAssistant.java under
    Code:
    o.sendMessage(getKM());
    add

    Code:
    if(!PlayerKilling.hostOnList(o, c.connectedFrom) && !c.inDuelArena()) {
    					PlayerKilling.addHostToList(o, c.connectedFrom);
    						o.killStreak += 1;
    						o.getStreak().checkKillStreak();
    						o.getStreak().killedPlayer();				
    					} else {
    						o.sendMessage("You already defeated "+c.playerName +"!");
    					}
    Still in playerAssistant import

    Code:
    import server.model.players.contents.KillingStreak;
    import server.model.players.contents.*;
    That should be all.

    Also: To not get errors in cmd prompt when compiling add

    Code:
    src\server\model\players\contents\*.java

    A little rep will be appreciated

    EDIT: I REALIZED HOW TERRIBLE THIS SYSTEM WAS SO USE IT AS A BASE!
    Reply With Quote  
     

  2. Thankful users:


  3. #2  
    ~! Legit ~!

    Join Date
    Nov 2010
    Posts
    1,973
    Thanks given
    183
    Thanks received
    211
    Rep Power
    237
    nice bro and i should get 25% hahaa
    [email protected]
    Spoiler for My Vouches:
    Quote Originally Posted by mattsforeal View Post
    I paid $5 went first, he fixed my problem and it worked. 100% legit would do it again.
    Quote Originally Posted by Mythic View Post
    Vouch for him, very smooth and fast trade, purchased his last 4m. Have fun with your new membership
    Quote Originally Posted by Harlan View Post
    Vouch, trustworthy guy.
    Quote Originally Posted by iPhisher™ View Post
    Vouch for Super-Man, he is a very legit and trustable guy.
    Reply With Quote  
     

  4. #3  
    Registered Member Kota Ko's Avatar
    Join Date
    Aug 2009
    Age
    26
    Posts
    1,040
    Thanks given
    39
    Thanks received
    61
    Rep Power
    39
    Quote Originally Posted by D R O View Post
    nice bro and i should get 25% hahaa
    Lol, there , cause you did help me
    Reply With Quote  
     

  5. #4  
    Dr. Jaegon


    Join Date
    Sep 2011
    Posts
    2,132
    Thanks given
    407
    Thanks received
    441
    Rep Power
    2559
    Looks good.
    Reply With Quote  
     

  6. #5  
    ~! Legit ~!

    Join Date
    Nov 2010
    Posts
    1,973
    Thanks given
    183
    Thanks received
    211
    Rep Power
    237
    I recommend to people to use this
    [email protected]
    Spoiler for My Vouches:
    Quote Originally Posted by mattsforeal View Post
    I paid $5 went first, he fixed my problem and it worked. 100% legit would do it again.
    Quote Originally Posted by Mythic View Post
    Vouch for him, very smooth and fast trade, purchased his last 4m. Have fun with your new membership
    Quote Originally Posted by Harlan View Post
    Vouch, trustworthy guy.
    Quote Originally Posted by iPhisher™ View Post
    Vouch for Super-Man, he is a very legit and trustable guy.
    Reply With Quote  
     

  7. #6  
    Registered Member Kota Ko's Avatar
    Join Date
    Aug 2009
    Age
    26
    Posts
    1,040
    Thanks given
    39
    Thanks received
    61
    Rep Power
    39
    Quote Originally Posted by I C U P View Post
    Looks good.
    Thanks bro.
    Reply With Quote  
     

  8. #7  
    Banned
    Join Date
    Jul 2010
    Posts
    489
    Thanks given
    21
    Thanks received
    32
    Rep Power
    0
    src\server\model\content\KillingStreak.java:24: cannot find symbol
    symbol : method sM(java.lang.String)
    location: class server.model.players.Client
    c2.sM(msg);
    ^
    1 error
    Press any key to continue . . .
    Reply With Quote  
     

  9. #8  
    Registered Member Falco Fury's Avatar
    Join Date
    Jun 2010
    Posts
    118
    Thanks given
    440
    Thanks received
    14
    Rep Power
    18
    Quote Originally Posted by Quadro7 View Post
    src\server\model\content\KillingStreak.java:24: cannot find symbol
    symbol : method sM(java.lang.String)
    location: class server.model.players.Client
    c2.sM(msg);
    ^
    1 error
    Press any key to continue . . .
    Change the sM to sendMessage
    Reply With Quote  
     

  10. #9  
    Banned
    Join Date
    Jul 2010
    Posts
    489
    Thanks given
    21
    Thanks received
    32
    Rep Power
    0
    Yeah i got it...
    Reply With Quote  
     

  11. #10  
    Registered Member
    Join Date
    Sep 2011
    Posts
    31
    Thanks given
    0
    Thanks received
    17
    Rep Power
    18
    Your conventions are not the best, here you got

    Code:
    		public void yell(String msg) {
    			for (int j = 0; j < Server.playerHandler.players.length; j++) {
    				if (Server.playerHandler.players[j] != null) {
    				Client c2 = (Client)Server.playerHandler.players[j];
    				c2.sM(msg);
    				}
    			}	
    		}
    The problem with that is

    Code:
    				if (Server.playerHandler.players[j] != null) {
    				Client c2 = (Client)Server.playerHandler.players[j];
    				c2.sM(msg);
    				}
    It should be
    Code:
    			if (Server.playerHandler.players[j] != null) {
    				Client c2 = (Client)Server.playerHandler.players[j];
    				c2.sM(msg);
    			}
    And some other minor stuff but I probably am wrong and you know conventions and it's just the stupid post that ruins the conventions.

    The code can be done more simply such as the switch statement. Also you indent once before the code not twice.

    Code:
    package server.model.players.contents;
    
    import server.model.players.Client;
    import server.Server;
    import server.model.players.PlayerHandler;
    import server.model.players.Player;
    
    /**
     * Killing Streak System
     * 
     * @author Dakota Chest
     */
    
    public class KillingStreak {
    
    	/**
    	 * The player
    	 * 
    	 */
    	private Client c;
    
    	public KillingStreak(Client c) {
    		this.c = c;
    	}
    
    	/**
    	 * Max possible killstreak reward
    	 */
    	private final int MAX_KILLSTREAK = 7;
    	
    	/**
    	* Sends the message throughout the server
    	*/
    		
    	public void yell(String msg) {
    		for (int j = 0; j < Server.playerHandler.players.length; j++) {
    			if (Server.playerHandler.players[j] != null) {
    			Client c2 = (Client)Server.playerHandler.players[j];
    				c2.sM(msg);
    			}
    		}	
    	}
    		
    	/**
    	* Add rewards to the player who died
    	* with the kill streak
    	* 
    	*/
    		
    	public void Rewards() {
    		Client o = (Client) PlayerHandler.players[c.killerId];
    		if (o.killStreak > 1 && o.killStreak < MAX_KILLSTREAK) {
    			c.getItems().addItem(995, 1000000 * o.killStreak);
    		}
    	}
    		
    	/**
    	* Checks the player if they have
    	* a killstreak of 2 or more
    	* can add on
    	* 
    	*/
    		
    	public void checkKillStreak() {
    		yell("@red@PvP System:@bla@ "+c.playerName+", is on a killing streak of "+c.killStreak+", Bounty: "+c.killStreak+"M!");		
    	}
    
    	/**
    	* Checks if the player with the killstreak
    	* died add items to the killer
    	* 
    	*/	
    			
    	public void killedPlayer() {
    		Client o = (Client) PlayerHandler.players[c.killerId];
    			if (o.killStreak >= 2 || c.killerId != o.playerId) {
    				yell("@red@PvP System:@bla@ "+c.playerName+" has ended "+o.playerName+" killing streak of "+o.killStreak+", and was rewarded.");
    				Rewards();
    			}
    		}	  
    	}
    < LOL
    Reply With Quote  
     

Page 1 of 12 12311 ... LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. [PI]Simple Killstreak Titles
    By Arithium in forum Snippets
    Replies: 27
    Last Post: 02-26-2012, 06:11 PM
  2. [PI]Killstreak Notification[PI]
    By thatsgodzkill in forum Help
    Replies: 9
    Last Post: 11-23-2011, 12:47 AM
  3. [PI]Killstreak Help[PI]
    By thatsgodzkill in forum Help
    Replies: 4
    Last Post: 11-15-2011, 03:17 AM
  4. Secret Nuke Killstreak in MW3 (M.O.A.B)
    By Impervious in forum Spam
    Replies: 16
    Last Post: 11-14-2011, 12:36 AM
  5. [pi] killStreak help
    By MetalGear in forum Help
    Replies: 0
    Last Post: 09-10-2010, 10:33 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •