Jump to content
  • 0

[HELP]Prevent Pk count for same IP


Question

Posted

Well i added to l2jofficial last rev the protection to Prevent PvP count for same Ip's and i wanted to add and protection for PK also.

Well here is my code for Pvp no problem with that.

 

return;

        // Check if it's pvp

	String player1 = getClient().getConnection().getInetAddress().getHostAddress(); 
	String player1target = targetPlayer.getClient().getConnection().getInetAddress().getHostAddress(); 
	if (Config.ALLOW_PVP_FROM_SAME_IP && player1.equals(player1target))
		return; 

	if (

 

so i added the same code for pk here is my code

*Note that i want to count the Karma when Pking some1 with same Ip

Code:

            newKarma = Integer.MAX_VALUE - getKarma();

        // Add karma to attacker and increase its PK counter
        
        String player1 = getClient().getConnection().getInetAddress().getHostAddress(); 
	String player1target = targetPlayer.getClient().getConnection().getInetAddress().getHostAddress(); 
	if (Config.ALLOW_PK_FROM_SAME_IP && player1.equals(player1target))
		return;
        
        setKarma(getKarma() + newKarma);
		                 
        if (increasePk) 
        	setPkKills(getPkKills() + 1);

 

and i get this error

    [javac] Compiling 1349 source files to C:\l2\trunk\lin2srv\build\classes
    [javac] C:\l2\trunk\lin2srv\java\net\sf\l2j\gameserver\model\actor\instance\L2PcInstance.java:5812: cannot find symbol
    [javac] symbol  : variable targetPlayer
    [javac] location: class net.sf.l2j.gameserver.model.actor.instance.L2PcInstance
    [javac] 		String player1target = targetPlayer.getClient().getConnection().getInetAddress().getHostAddress(); 
    [javac] 		                       ^
    [javac] 1 error

10 answers to this question

Recommended Posts

  • 0
Posted

This is code is not work l2offocial.

 

I assigned it with red one that in you have to lay it.

You try it.

 

The code is made by Mentor.

 

/**

* This class represents all player characters in the world.

* There is always a client-thread connected to this (except if a player-store is activated upon logout).<BR><BR>

*

* Anti Pvp and Pk Farm by Mentor www.teamsrv.net

*

* @version $Revision: 1.66.2.41.2.33 $ $Date: 2005/04/11 10:06:09 $

*/

 

/************ Source Kód *************/

 

  public void onKillUpdatePvPKarma(L2Character target)

  {

      if (target == null) return;

      if (!(target instanceof L2Playable)) return;

 

      L2PcInstance targetPlayer = target.getActingPlayer();

      L2PcInstance targetp = (L2PcInstance)getTarget();

      String ip = getClient().getConnection().getInetAddress().getHostAddress();

      String ip2 = targetp.getClient().getConnection().getInetAddress().getHostAddress();

 

/************ Source Kód *************/

 

                  isInsideZone(ZONE_PVP) &&                //  Player is inside pvp zone and

                  targetPlayer.isInsideZone(ZONE_PVP)    //  Target player is inside pvp zone

            )

      )

      {

        if (ip.equals(ip2))

          return;

        increasePvpKills();

             

            }

      else                                                                        // Target player doesn't have pvp flag set

      {

            // check about wars

            if (targetPlayer.getClan() != null && getClan() != null)

            {

                if (getClan().isAtWarWith(targetPlayer.getClanId()))

                {

                    if (targetPlayer.getClan().isAtWarWith(getClanId()))

                    {

                        // 'Both way war' -> 'PvP Kill'

                      if (ip.equals(ip2))

                      return;

                      increasePvpKills();

                    }

                }

            }

 

            // 'No war' or 'One way war' -> 'Normal PK'

        if (targetPlayer.getKarma() > 0)                                        // Target player has karma

        {

            if ( Config.KARMA_AWARD_PK_KILL )

            {

              if (ip.equals(ip2))

                return;

              increasePvpKills();

            }

        }

        else if (targetPlayer.getPvpFlag() == 0)                                                                    // Target player doesn't have karma

        {

            if (ip.equals(ip2))

            return;

                increasePkKillsAndKarma(targetPlayer.getLevel());

            //Unequip adventurer item

  • 0
Posted
return;

 

       // Check if it's pvp

 

String player1 = getClient().getConnection().getInetAddress().getHostAddress();

String player1target = targetPlayer.getClient().getConnection().getInetAddress().getHostAddress();

if (Config.ALLOW_PVP_FROM_SAME_IP && player1.equals(player1target))

return;

 

if (

 

This code is for L2JArchid..witch i commited yesterday.

Guest
This topic is now closed to further replies.


  • Posts

    • ## [1.4.0] - 2026-01-28   ### ✨ New Features - **Vote System**: Lineage 2 servers can now use our vote–reward system. Players vote on the website and claim rewards in-game (1 vote = 1 claim) - **Vote Page**: On each server’s page (`/servers/<server>`), a **“Vote for Server”** button opens a dedicated vote page with cooldown info and optional Turnstile verification - **By Votes View**: The **“By Votes”** tab on the main page shows **actual vote counts** per server - **API Documentation**: New **API Docs** page at `/docs` (and footer link) with HMAC auth, endpoints, and examples for game server integration - **Vote API (My Servers)**: Server owners can open **“Vote API”** in My Servers to manage credentials, cooldown, allowed IPs, and open the docs   ### 🔄 Improvements - **Server Pages**: Single-server data is cached and loads faster; server pages can be opened by ID or by name (e.g. `/servers/my-server-name`) - **API Root**: Visiting the API root redirects to the docs URL configured in admin (default: site docs page) - **Admin Panel**: New **“Vote System”** tab for global settings (Turnstile, API security, default cooldown, docs URL)   ### 🔐 Security & Reliability - Turnstile (CAPTCHA) support for vote submissions to reduce abuse - HMAC-protected game server API for secure vote check/claim and stats
    • "I recently purchased the account panel from this developer and wanted to leave a positive review.   The transaction was smooth, and the developer demonstrated exceptional professionalism throughout the process.   What truly sets them apart is their outstanding post-sale support. They are responsive, patient, and genuinely helpful when addressing questions or issues. It's clear they care about their customers' experience beyond just the initial sale.   I am thoroughly satisfied and grateful for the service. This is a trustworthy seller who provides real value through both a quality product and reliable support. 100% recommended."
    • Server owners, Top.MaxCheaters.com is now live and accepting Lineage 2 server listings. There is no voting, no rankings manipulation, and no paid advantages. Visibility is clean and equal, and early listings naturally appear at the top while the platform grows. If your server is active, it should already be listed. Submit here https://Top.MaxCheaters.com This platform is part of the MaxCheaters.com network and is being built as a long-term reference point for the Lineage 2 community. — MaxCheaters.com Team
    • ⚙️ General Changed “No Carrier” title to “Disconnected” to avoid confusion after abnormal DC. On-screen Clan War kill notifications will no longer appear during Sieges, Epics, or Events. Bladedancer or SwordSinger classes can now log in even when Max Clients (2) is reached, you cannot have both at the same time. The max is 3 clients. Duels will now be aborted if a monster aggros players during a duel (retail-like behavior). Players can no longer send party requests to blocked players (retail-like). Fixed Researcher Euclie NPC dialogue HTML error. Changed Clan leave/kick penalty from 12 hours to 3 hours. 🧙 Skills Adjusted Decrease Atk. Spd. & Decrease Speed land rates in Varka & FoG. Fixed augmented weapons not getting cooldown when entering Olympiad. 🎉 Events New Team vs Team map added. New Save the King map added (old TvT map). Mounts disabled during Events. Letter Collector Event enabled Monsters drop letters until Feb. 13th Louie the Cat in Giran until Feb. 16th Inventory slots +10 during event period 📜 Quests Fixed “Possessor of a Precious Soul Part 1” rare stuck issue when exceeding max quest items. Fixed Seven Signs applying Strife buff/debuff every Monday until restart. 🏆 Milestones New milestone: “Defeat 700 Monsters in Varka” 🎁 Rewards: 200 Varka’s Mane + Daily Coin 🌍 NEW EXP Bonus Zones Hot Springs added Varka Silenos added (hidden spots excluded) As always, thank you for your support! L2Elixir keeps evolving, improving, and growing every day 💙   Website: https://l2elixir.org/ Discord: https://discord.gg/5ydPHvhbxs
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..