Jump to content
  • 0

Log the PvP Points & Anti-PvP Farming System


Question

Posted

Hello MxCs Again,

 

I searched over the forum but I couldn't found anything. What do I need is an anti-PvP Farm System which prevents the player from farming PvPs constantly between two players, in detail:

 

If someone kills somebody else for the first time he will earn a PvP Point, if he kills the same person again he won't earn any PvP Points, we can also add a time like 5 minutes delay after that he could earn a pvp point again.

 

Thanks in advance,

Static

 

Okay, as I see no-one can or wants to help me so I'll ask for something else...

Can someone tell me how can I log the PvP Kills from the players, just when a player kills someone this should be logged in a file in the logs folder with time and date.

 

Okay because the topic was edited many times here is the last request:

 

 

 

Anti-PvP Farming System:

 

When a player (ex PlayerA) kills another Player (ex PlayerB) for a first time, he will take a PVP Point if he tries to kill again the same Player (PlayerB) he won't take pvp point but he has to kill a different player (PlayerC) in order to get a PvP from the second player (PlayerB) again.

 

Simply:

If Static kills George for a first time he'll take a pvp point.

If Static kills George for a second time he wont take a pvp point.

If Static kills George for a first time and then kills John he will take the PVP from John but if he tries to kill John he won't take the PVP Point however if he kills George again he'll earn the pvp point.

 

Log PvP Points:

 

Some kind of code that will log the PvP Points of the players like

Time and Date Player1 Killed Player2.

Example:

[08 Mar 17:40:18] Static Killed George.

Recommended Posts

  • 0
Posted

Well don't take me wrong but I've helped you enough.

You can't even copy + paste ? lool.

 

I appologise if I seem rude but what you're doing is a complete lack of respect, you could at least try harder. If everybody can do it then so can you.Try harder, the reward is worth the time you waste on attempting to make it work.

  • 0
Posted

I tried, seems I'm dumb and I can't make it.

I asked for your help you refused to give it, you have your reasons that's OK at least let someone else code it for me.

  • 0
Posted

try like this, its not pro but still works.

 

In L2PcInstance.java, find this:

private ClassId _skillLearningClassId;

 

paste this below

private List<Integer> _lastOne = new FastList<Integer>();

 

go to increasePvpKills()

add

	if (_lastOne.contains(getTargetId()) ==  false)
	{
	    _lastOne.clear();
		_lastOne.add(getTargetId());
	}
	else
	{
	    sendMessage("You have recently killed this guy. You are not gained a Pvp kill.");
		return;
	}

  • 0
Posted

Log PvP Points:

 

Some kind of code that will log the PvP Points of the players like

Time and Date Player1 Killed Player2.

Example:

[08 Mar 17:40:18] Static Killed George.

 

  • 0
Posted

yes, but tell me do u want that logs to be shown in GS console or saved on a .txt file or added to new table in database?

  • 0
Posted

Ok, lets see.

 

Firstly add imports

import java.io.FileWriter;
import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.io.LineNumberReader;
import java.util.StringTokenizer;
import java.io.FileInputStream;
import java.io.InputStreamReader;

 

than find something like

private byte _siegeState = 0;

 

and paste this

private Date currentDate = null;
private List<String> _logKill = new FastList<String>();
private SimpleDateFormat theDateFormat = new SimpleDateFormat("dd MMM H:mm:ss");

 

than go to increasePvpKills() and paste this

                     /**					Pvp Logs			*/
	File file = new File("log/PvpLog.txt");
	FileWriter save = null; 
	currentDate = new Date();

	String targName = "";
	if (getTarget() != null) targName = getTarget().getName();

	if (_logKill.size() <= 0)
	    loadPvpLogs();
	_logKill.add("Successful PvP: ["+getName()+"] - killer		["+targName+"] - victim		["+theDateFormat.format(currentDate)+"] - date");

	try
	{
		save = new FileWriter(file);
		for (int i = 0; i < _logKill.size(); i++)
		{
			save.write(_logKill.get(i));
			save.write("\r\n");
		}
		save.flush();
		save.close();
		save = null;
	}
	catch (IOException e)
	{
		_log.warn("Could't save the PvpLog file: " + e);
	}

 

also paste this below increasePvpKills()

public void loadPvpLogs()
{
	_logKill.clear();
	File file = new File("log/PvpLog.txt");
	if (file.exists())
	{
		getFiles(file);
	}
	else
		_log.info("log/PvpLog.txt doesn't exist");
}

public void getFiles(File file)
{
	LineNumberReader lnr = null;
	try
	{
		int i=0;
		String line = null;
		lnr = new LineNumberReader(new InputStreamReader(new FileInputStream(file),"UTF-8"));
		while ( (line = lnr.readLine()) != null)
		{
			StringTokenizer st = new StringTokenizer(line,"\n\r");
			if (st.hasMoreTokens())
			{
				String theLine = st.nextToken();
				_logKill.add(theLine);
				i++;
			}
		}
	}
	catch (IOException e1)
	{
		_log.fatal( "Error reading PvpLogs", e1);
	}
	finally { try{ lnr.close(); } catch (Exception e2) {} }
}

 

Also go to log folder and create a .txt file with name PvpLog

If u dont understand me, download this file and put it in log folder.

http://rapidshare.com/files/362146243/PvpLog.txt.html

 

Test it and give feedback

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock