Jump to content

Player Kd Code [H5]


ganjaradio

Recommended Posts

Hello in HoN (Heroes of Newerth) there is a number Called KD (Kills / Deaths)

This is like a rank system in the game, if u have a bad KD then it means u are kinda bad

So ive made a code for L2 that shows the Player's KD

The Code Is Based To Deaths Counter (http://www.maxcheaters.com/topic/137616-sharedeaths-counter/?hl=%2Bdeaths+%2Bcount) (Not Full!)

The Code Is For H5 (Fandc Project), Not Tested

### Eclipse Workspace Patch 1.0
#P OFandC2
Index: java/l2f/gameserver/model/Player.java
===================================================================
--- java/l2f/gameserver/model/Player.java	(revision 15)
+++ java/l2f/gameserver/model/Player.java	(working copy)
@@ -1018,6 +1018,9 @@
 	_hairStyle,
 	_hairColor;
 
+	private int _deaths; // how many times died character after login
+	private int _kd; // kills / deaths
+	
 	private int _recomHave,
 	_recomLeftToday,
 	_fame;
@@ -1557,6 +1560,43 @@
 		return item;
 	}
 
+		public int getDeaths()
+		{
+			return _deaths;
+		}
+		/**
+		 * Increase the deaths
+		 */
+	public void increaseDeaths()
+		{
+			setDeaths(getDeaths() + 1);
+		}
+	
+		public void setDeaths(int deaths)
+		{
+			_deaths = deaths;
+		}	
+	
+		public void setKd(int KD)
+		{
+			_kd = KD;
+		}	
+		
+		public int KD()
+		{
+			return _kd;
+		}
+		
+		public void setKd()
+		{
+			setKd(_pvpKills / _deaths);
+		}
+	 	
+	public void VKDcmd()
+	{
+		sendMessage("You' re KD is" + _kd + "");
+	}
+	
 	public void addAutoSoulShot(Integer itemId)
 	{
 		_activeSoulShots.add(itemId);
@@ -3613,7 +3653,7 @@
 		}
 
 		List<ItemInstance> drop = new LazyArrayList<ItemInstance>(), // total array with the results of the  choice
-		dropItem = new LazyArrayList<ItemInstance>(), dropEquip = new LazyArrayList<ItemInstance>(), dropWeapon = new LazyArrayList<ItemInstance>(); // временные
+		dropItem = new LazyArrayList<ItemInstance>(), dropEquip = new LazyArrayList<ItemInstance>(), dropWeapon = new LazyArrayList<ItemInstance>(); // Π²Ρ€ΠµΠΌΠµΠ½Π½Ρ‹Πµ
 
 		getInventory().writeLock();
 		try
@@ -5870,9 +5910,9 @@
 	}
 
 	/**
-	 * Возвращает тип используемого склада.
+	 * ВозвращаеСβ€� Π΅β€�Π Ρ‘Π Ρ— Π Ρ‘Π΅ΠƒΠ Ρ—Π Ρ•Π Β»Π΅Π�Π Β·Π΅Ρ“Π ΒµΠ Ρ�Π Ρ•Π Ρ–Π Ρ• Π΅ΠƒΠ Ρ”Π Β»Π Β°Π �‘Π Β°.
 	 * 
-	 * @return null или тип склада:<br>
+	 * @return null Π Ρ‘Π Β»Π Ρ‘ Π΅β€�Π Ρ‘Π Ρ— Π΅ΠƒΠ Ρ”Π Β»Π Β°Π �‘Π Β°:<br>
 	 *         <ul>
 	 *         <li>WarehouseType.PRIVATE
 	 *         <li>WarehouseType.CLAN
Index: java/l2f/gameserver/handler/voicecommands/impl/KDcmd.java
===================================================================
--- java/l2f/gameserver/handler/voicecommands/impl/KDcmd.java	(nonexistent)
+++ java/l2f/gameserver/handler/voicecommands/impl/KDcmd.java	(working copy)
@@ -0,0 +1,25 @@
+package l2f.gameserver.handler.voicecommands.impl;
+
+import l2f.gameserver.handler.voicecommands.IVoicedCommandHandler;
+import l2f.gameserver.model.Player;
+
+public class KDcmd
+  implements IVoicedCommandHandler
+{
+private String[] VOICED_COMMANDS = { "kd"};
+
+  public boolean useVoicedCommand(String command, Player activeChar, String text)
+  {
+    Player _kd = null;
+    if (command.startsWith("kd"))
+    	activeChar.sendMessage("You 're KD is" + _kd +"");
+	return true;
+   
+  }
+
+
+public String[] getVoicedCommandList()
+  {
+    return VOICED_COMMANDS;
+  }
+}
\ No newline at end of file

Creits: Me And EdenEternal For The Deaths Counter Code

Link to comment
Share on other sites

I love the way you are avoiding my question, so Imma quote it.. :D

 

You know that this code can't work, right?

Link to comment
Share on other sites

And what if player log out? What if server restart? Where you store those in player's ass?

Also whats the difference from the main topic? Nothing.  Lets analyze the mistakes in your topic.

 

  1. You use FandC which mean you spend lots of time downloading project and leeching codes (reference to your project)
  2. Your code has no difference at all from the main code that is a copy from some other code that is a copy from some other code. Copy -> Copy -> Copy the only change is the Eclipse path.
  3. The ironic moment when 98% of community work with L2J and it does not support VC. At least you should include the VC code to add it or make it UC.
  4. "Do not post simple java strings or stupid configuration codes. Such topics will be immediately locked" <-- rules.. Now i know that good java codes are junked cause is 4-5 lines but still this is like a "configuration" since you just set var and get var.
  5. Credits for.. i guess the patch?
  6. K/D reset if player log out or server restart.
  7. We are currently in 2k16 and still sharing setPk  getPk codes. In 2007 people used to share whole engines and big scripts but 7 years (almost 8) years later people share 2 lines of code that are just copy paste from 2007 cause logic.
  8. Heroes of newearth ! (If i could sin you right now u would be over 9999999)
  9. Elfo is like "access don't bother forum members who try make this community a better place" and hit mute button on me. 
  10. Nothing i just wanted to finish with 10 :3
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.


  • Posts

    • I use l2fandc files. I need a java code, I've been searching a lot and waiting for help. What I want to do is to teleport to the players doing pvp. So it's like finding the flag player. I found some files but they did not fit my system. I'm waiting for help..   EXAMPLE:     package handlers.bypasshandlers; import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; import com.l2jmobius.Config; import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.gameserver.enums.ChatType; import com.l2jmobius.gameserver.handler.IBypassHandler; import com.l2jmobius.gameserver.model.L2World; import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.zone.ZoneId; import com.l2jmobius.gameserver.network.serverpackets.CreatureSay; /**  * @author Mobius (based on Tenkai pvpzone)  */ public class FindPvP implements IBypassHandler {     private static final String[] COMMANDS =     {         "FindPvP"     };          @Override     public boolean useBypass(String command, L2PcInstance activeChar, L2Character target)     {         if (!Config.ENABLE_FIND_PVP || !target.isNpc())         {             return false;         }                  L2PcInstance mostPvP = null;         int max = -1;         for (L2PcInstance player : L2World.getInstance().getPlayers())         {             if ((player == null) //                 || (player.getPvpFlag() == 0) //                 || (player.getInstanceId() != 0) //                 || player.isGM() //                 || player.isInsideZone(ZoneId.PEACE) //                 || player.isInsideZone(ZoneId.SIEGE) //                 || player.isInsideZone(ZoneId.NO_SUMMON_FRIEND))             {                 continue;             }                          int count = 0;             for (L2PcInstance pl : L2World.getInstance().getVisibleObjects(player, L2PcInstance.class))             {                 if ((pl.getPvpFlag() > 0) && !pl.isInsideZone(ZoneId.PEACE))                 {                     count++;                 }             }                          if (count > max)             {                 max = count;                 mostPvP = player;             }         }                  if (mostPvP != null)         {             // Check if the player's clan is already outnumbering the PvP             if (activeChar.getClan() != null)             {                 Map<Integer, Integer> clanNumbers = new HashMap<>();                 int allyId = activeChar.getAllyId();                 if (allyId == 0)                 {                     allyId = activeChar.getClanId();                 }                 clanNumbers.put(allyId, 1);                 for (L2PcInstance known : L2World.getInstance().getVisibleObjects(mostPvP, L2PcInstance.class))                 {                     int knownAllyId = known.getAllyId();                     if (knownAllyId == 0)                     {                         knownAllyId = known.getClanId();                     }                     if (knownAllyId != 0)                     {                         if (clanNumbers.containsKey(knownAllyId))                         {                             clanNumbers.put(knownAllyId, clanNumbers.get(knownAllyId) + 1);                         }                         else                         {                             clanNumbers.put(knownAllyId, 1);                         }                     }                 }                                  int biggestAllyId = 0;                 int biggestAmount = 2;                 for (Entry<Integer, Integer> clanNumber : clanNumbers.entrySet())                 {                     if (clanNumber.getValue() > biggestAmount)                     {                         biggestAllyId = clanNumber.getKey();                         biggestAmount = clanNumber.getValue();                     }                 }                                  if (biggestAllyId == allyId)                 {                     activeChar.sendPacket(new CreatureSay(0, ChatType.WHISPER, target.getName(), "Sorry, your clan/ally is outnumbering the place already so you can't move there."));                     return true;                 }             }                          activeChar.teleToLocation((mostPvP.getX() + Rnd.get(300)) - 150, (mostPvP.getY() + Rnd.get(300)) - 150, mostPvP.getZ());             activeChar.setSpawnProtection(true);             if (!activeChar.isGM())             {                 activeChar.setPvpFlagLasts(System.currentTimeMillis() + Config.PVP_PVP_TIME);                 activeChar.startPvPFlag();             }         }         else         {             activeChar.sendPacket(new CreatureSay(0, ChatType.WHISPER, target.getName(), "Sorry, I can't find anyone in flag status right now."));         }         return false;     }          @Override     public String[] getBypassList()     {         return COMMANDS;     } }
    • How are you, fucking Nazi? Haven't you been sent to the front line yet, as cannon fodder? or are you Nazi scum still hiding in the basements? you whores destroyed the inhabitants of Donbass for 8 years, and now you are a fagot hiding behind the backs of women. Nazis in Ukraine will be physically destroyed! every! we will get each of you! if not immediately, then years later you will be punished for your crimes!
  • Topics

×
×
  • Create New...