Jump to content
  • 0

[Help] Prefix name change by pvp count


Question

Posted

Hello!

Trying to make scrypt to change the nickname prefix by pvp count

But have little problem with that.

exactly: here is the diff

 

Index: java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java	(revision 5538)
+++ java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java	(working copy)
@@ -4343,7 +4343,58 @@
			DuelManager.getInstance().broadcastToOppositTeam(this, update);
		}
	}
-	
+
+	public void updatePrefix(int pvpKills)
+	{
+		if (Config.PVP_PREFIX_SYSTEM_ENABLED)
+		{
+			//Check if the character has GM access 
+			if (isGM())
+				return;
+			{
+				if ((pvpKills >= (Config.PVP_LVL1)) && (pvpKills <= (Config.PVP_LVL1)))
+				{
+                   getActingPlayer().setName(Config.NAME_PREFIX_FOR_PVP_LVL1 + getActingPlayer().getName());
+				}
+				else if ((pvpKills >= (Config.PVP_LVL2)) && (pvpKills <= (Config.PVP_LVL2)))
+				{
+					getActingPlayer().setName(Config.NAME_PREFIX_FOR_PVP_LVL2 + getActingPlayer().getName());
+				}
+				else if ((pvpKills >= (Config.PVP_LVL3)) && (pvpKills <= (Config.PVP_LVL3)))
+				{
+					getActingPlayer().setName(Config.NAME_PREFIX_FOR_PVP_LVL3 + getActingPlayer().getName());
+				}
+				else if ((pvpKills >= (Config.PVP_LVL4)) && (pvpKills <= (Config.PVP_LVL4)))
+				{
+					getActingPlayer().setName(Config.NAME_PREFIX_FOR_PVP_LVL4 + getActingPlayer().getName());
+				}
+				else if ((pvpKills >= (Config.PVP_LVL5)) && (pvpKills <= (Config.PVP_LVL5)))
+				{
+					getActingPlayer().setName(Config.NAME_PREFIX_FOR_PVP_LVL5 + getActingPlayer().getName());
+				}
+				else if ((pvpKills >= (Config.PVP_LVL6)) && (pvpKills <= (Config.PVP_LVL6)))
+				{
+					getActingPlayer().setName(Config.NAME_PREFIX_FOR_PVP_LVL6 + getActingPlayer().getName());
+				}
+				else if ((pvpKills >= (Config.PVP_LVL7)) && (pvpKills <= (Config.PVP_LVL7)))
+				{
+					getActingPlayer().setName(Config.NAME_PREFIX_FOR_PVP_LVL7 + getActingPlayer().getName());
+				}
+				else if ((pvpKills >= (Config.PVP_LVL8)) && (pvpKills <= (Config.PVP_LVL8)))
+				{
+					getActingPlayer().setName(Config.NAME_PREFIX_FOR_PVP_LVL8 + getActingPlayer().getName());
+				}
+				else if ((pvpKills >= (Config.PVP_LVL9)) && (pvpKills <= (Config.PVP_LVL9)))
+				{
+					getActingPlayer().setName(Config.NAME_PREFIX_FOR_PVP_LVL9 + getActingPlayer().getName());
+				}
+				else if (pvpKills >= (Config.PVP_LVL10))
+				{
+					getActingPlayer().setName(Config.NAME_PREFIX_FOR_PVP_LVL10 + getActingPlayer().getName());
+				}
+			}
+		}
+	}
	/**
	 * Send a Server->Client packet UserInfo to this L2PcInstance and CharInfo to all L2PcInstance in its _KnownPlayers.<BR><BR>
	 *
@@ -5684,6 +5735,9 @@
			// Add karma to attacker and increase its PK counter
			setPvpKills(getPvpKills() + 1);

+        updatePrefix(getPvpKills());
+        broadcastUserInfo();
+			
			// Send a Server->Client UserInfo packet to attacker with its Karma and PK Counter
			sendPacket(new UserInfo(this));
			sendPacket(new ExBrExtraUserInfo(this));
Index: java/com/l2jserver/Config.java
===================================================================
--- java/com/l2jserver/Config.java	(revision 5538)
+++ java/com/l2jserver/Config.java	(working copy)
@@ -725,6 +725,27 @@
	public static int L2JMOD_DUALBOX_CHECK_MAX_PLAYERS_PER_IP;
	public static int L2JMOD_DUALBOX_CHECK_MAX_OLYMPIAD_PARTICIPANTS_PER_IP;
	public static TIntIntHashMap L2JMOD_DUALBOX_CHECK_WHITELIST;
+	public static boolean		PVP_PREFIX_SYSTEM_ENABLED;
+	public static int			PVP_LVL1;
+	public static int			PVP_LVL2;
+	public static int			PVP_LVL3;
+	public static int			PVP_LVL4;
+	public static int			PVP_LVL5;
+	public static int			PVP_LVL6;
+	public static int			PVP_LVL7;
+	public static int			PVP_LVL8;
+	public static int			PVP_LVL9;
+	public static int			PVP_LVL10;
+	public static String			NAME_PREFIX_FOR_PVP_LVL1;
+	public static String			NAME_PREFIX_FOR_PVP_LVL2;
+	public static String			NAME_PREFIX_FOR_PVP_LVL3;
+	public static String			NAME_PREFIX_FOR_PVP_LVL4;
+	public static String			NAME_PREFIX_FOR_PVP_LVL5;
+	public static String			NAME_PREFIX_FOR_PVP_LVL6;
+	public static String			NAME_PREFIX_FOR_PVP_LVL7;
+	public static String			NAME_PREFIX_FOR_PVP_LVL8;
+	public static String			NAME_PREFIX_FOR_PVP_LVL9;
+	public static String			NAME_PREFIX_FOR_PVP_LVL10;

	//--------------------------------------------------
	// NPC Settings
@@ -2421,7 +2442,29 @@
							}
						}
					}
-					
+	    			// PVP Name Prefix System configs - Start
+	    			PVP_PREFIX_SYSTEM_ENABLED = Boolean.parseBoolean(L2JModSettings.getProperty("EnablePrefixSystem", "false"));
+	    			PVP_LVL1 = Integer.parseInt(L2JModSettings.getProperty("PvpLvl1", "500"));
+	    			PVP_LVL2 = Integer.parseInt(L2JModSettings.getProperty("PvpLvl2", "1000"));
+	    			PVP_LVL3 = Integer.parseInt(L2JModSettings.getProperty("PvpLvl3", "2000"));
+					PVP_LVL4 = Integer.parseInt(L2JModSettings.getProperty("PvpLvl4", "2500"));
+	    			PVP_LVL5 = Integer.parseInt(L2JModSettings.getProperty("PvpLvl5", "3000"));
+	    			PVP_LVL6 = Integer.parseInt(L2JModSettings.getProperty("PvpLvl6", "350"));
+	    			PVP_LVL7 = Integer.parseInt(L2JModSettings.getProperty("PvpLvl7", "4000"));
+	    			PVP_LVL8 = Integer.parseInt(L2JModSettings.getProperty("PvpLvl8", "4500"));
+	    			PVP_LVL9 = Integer.parseInt(L2JModSettings.getProperty("PvpLvl9", "5000"));
+	    			PVP_LVL10 = Integer.parseInt(L2JModSettings.getProperty("PvpLvl10", "7000"));
+	    			NAME_PREFIX_FOR_PVP_LVL1 = L2JModSettings.getProperty("PrefLvl1", "[Cadet]");
+	    			NAME_PREFIX_FOR_PVP_LVL2 = L2JModSettings.getProperty("PrefLvl2", "[slayer]");
+	    			NAME_PREFIX_FOR_PVP_LVL3 = L2JModSettings.getProperty("PrefLvl3", "[Corporal]");
+	    			NAME_PREFIX_FOR_PVP_LVL4 = L2JModSettings.getProperty("PrefLvl4", "[Killer]");
+	    			NAME_PREFIX_FOR_PVP_LVL5 = L2JModSettings.getProperty("PrefLvl5", "[Executioner]");
+	    			NAME_PREFIX_FOR_PVP_LVL6 = L2JModSettings.getProperty("PrefLvl6", "[Most Wanted]");
+	    			NAME_PREFIX_FOR_PVP_LVL7 = L2JModSettings.getProperty("PrefLvl7", "[Enforcer}");
+	    			NAME_PREFIX_FOR_PVP_LVL8 = L2JModSettings.getProperty("PrefLvl8", "[Assasin}");
+	    			NAME_PREFIX_FOR_PVP_LVL9 = L2JModSettings.getProperty("PrefLvl9", "[Exterminator]");
+	    			NAME_PREFIX_FOR_PVP_LVL10 = L2JModSettings.getProperty("PrefLvl10", "[Lord of War]");
+	    			// PvP Name Prefix System configs - End
					BANKING_SYSTEM_ENABLED = Boolean.parseBoolean(L2JModSettings.getProperty("BankingEnabled", "false"));
					BANKING_SYSTEM_GOLDBARS = Integer.parseInt(L2JModSettings.getProperty("BankingGoldbarCount", "1"));
					BANKING_SYSTEM_ADENA = Integer.parseInt(L2JModSettings.getProperty("BankingAdenaCount", "500000000"));


 

Problem is: when the player has 500 pvp automatically appear prefix [cadet]

but as I will have more pvp it appears [slayer] and nick looks like "[slayer][cadet]Nickname"

jak zrobic aby usunac poprzedni prefix i dodac nowy?

and code is written correctly?

14 answers to this question

Recommended Posts

  • 0
Posted

First, "getActingPlayer()." isn't needed at all if your code is in L2PcInstance. That will cut 1/3 of code, make the crap easier to read and make it slighty faster aswell.

 

Second, you're adding prefix to name. When you change of name, you're doing the same again. Which mean :

 

"blabla1" + "blabla2" = "blabla1blabla2"

"blabla3" + "blabla1blabla2" = "blabla3blabla1blabla2" (prefix + current name)

 

The code is ok and it makes what you said, that's how you think your code which is wrong.

 

You mustn't use getName, but something new as getOriginalName().

 

I must say, editing the name like you do is really fucking up, as depending of the pack the name can be entire part of identification process (such as online feature, friendlist, and such). If your pack doesn't follow behind, you will have funny bugs.

  • 0
Posted

Tryskell You're right, better not to change the nickname of players, but it is a good idea. This may add a new column in characters sql "prefix" and insert in front of Nick. If it can be to do so,

  • 0
Posted

You dont need to add anything into database..

apply this patch: http://pastebin.com/HwkjLbvQ

run updatePrefix in restore method,

and also go to UserInfo and replace:

_name = player.getName();

with

_name = player.getPrefix()+player.getName();

  • 0
Posted

You should make a column named "Prefix" into characters table . Every "x" PVP , this gonna change to ...

 

no, this will just create unnecessary column, if updatePrefix will be run every time u log in, and every time u are getting pvp, u dont need to add anything else.

  • 0
Posted

no, this will just create unnecessary column, if updatePrefix will be run every time u log in, and every time u are getting pvp, u dont need to add anything else.

 

Your words are full of truth , but i just exemplified another method .

  • 0
Posted

Really I think the best and cleanest way is what jokkerino said.

1-Create a column to put there all prefix, to not mess it with nicks.

2-Find the code where you write the nick to be visual-shown, and add there the prefix.

Coz if u simply do it with setName()... You'll get full of bugs with other mods, as Tryskell said.

  • 0
Posted

Really I think the best and cleanest way is what jokkerino said.

1-Create a column to put there all prefix, to not mess it with nicks.

2-Find the code where you write the nick to be visual-shown, and add there the prefix.

Coz if u simply do it with setName()... You'll get full of bugs with other mods, as Tryskell said.

thats what i wrote in the patch, i just think creating new column for such thing is useless, we could make database table for everything..

  • 0
Posted

have not found in UserInfo "_name = player.getName();"

sorry, didnt look how it is made in l2jserver

change line:

writeS(_activeChar.getName());

with

writeS(_activeChar.getPrefix+_activeChar.getName());

  • 0
Posted

I did as you said.

1st error - log in and see before Nick null, but only for me, others I can see normally

2nd error - prefix disappears after logoff

3rd now I think of it, however, is not a good idea, btw thx for help.

  • 0
Posted

1st, change  private String _prefix; to  private String _prefix = "";

2st, u didnt add this method in restore method in L2PcInstance

3rd, no problem, want me to lock it?

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


  • Posts

    • I fixed it now my friends can join too, with what do you want help with? Also can you upload the interlude client of gx-ext for c4? just to have it because i deleted the rar i just have the folder
    • me ayudas a montar ese pack por que no entiendo tanto es para tener de prueba
    • GX-C4 pack, its ok...just used it.
    • This post originally appeared on MmoGah. Arena Breakout: Infinite is a hardcore tactical extraction shooter that demands precision, patience, and strategy. This guide will walk you through everything a beginner needs to know—from gear and combat to survival and extraction.     What Is Arena Breakout: Infinite? Arena Breakout: Infinite (ABI) is a free-to-play online extraction shooter developed by MoreFun Studios and released on Steam in September 2025. Unlike traditional battle royales, ABI focuses on risk vs. reward rather than being the last one standing. Players enter instanced maps called "raids," where they must scavenge loot, survive enemy encounters, and extract safely.   Core Gameplay Mechanics 1. Raids and Extraction Each raid features 4–6 teams (solo or squad) dropped into a map. The goal is to loot valuable items and extract through designated points. Extraction is not exclusive—multiple teams can leave the map alive. 2. PvPvE Combat You'll face both human players and AI enemies. AI can be unpredictable and deadly, especially in high-tier zones. 3. No Hand-Holding ABI offers no tutorials or guidance. You learn by dying—and surviving.   Gear and Loadouts 1. Choose Wisely Your gear determines your survivability. Armor, helmets, and medical supplies are essential. Weapons vary in recoil, damage, and handling. Start with low-cost rifles like the AKS-74U or MP5. 2. Insurance System You can insure gear to recover it if you die and it isn't looted. Use insurance for expensive items, but don't rely on it blindly. 3. Backpacks and Storage Larger backpacks allow more loot but make you a bigger target. Organize your inventory to quickly access meds and ammo during combat.   Tactical Tips for Beginners 1. Know What to Loot Prioritize high-value items like weapon parts, medical kits, and rare electronics. Learn loot hotspots on each map—warehouses, bunkers, and military zones often yield better gear. 2. Sound Is Everything Footsteps, gunfire, and reloads are loud. Use headphones and move cautiously. Crouch-walking and slow peeking reduce noise and improve stealth. 3. Map Knowledge Study maps offline or in low-risk raids. Learn extraction points, choke zones, and sniper nests. 4. Stamina Management Sprinting drains stamina, which affects aim and movement. Rest in safe zones and avoid overexertion during firefights.   Combat and Survival 1. Engage Smartly Don't chase kills—survival and extraction are the real goals. Use cover, lean mechanics, and suppressive fire to control fights. 2. Healing and Damage ABI features a detailed health system: limbs can be fractured, bleeding, or disabled. Carry splints, bandages, and painkillers. Know how to treat each condition. 3. Death Is a Lesson You will die—a lot. Use each death to learn positioning, gear value, and enemy behavior.   Progression and Economy 1. Free-to-Play Friendly ABI is generous with starter gear and daily rewards. You can earn the currency Arena Breakout: Infinite Koens through successful raids and selling loot. 2. Marketplace Trade gear with other players or sell to vendors. Prices fluctuate—learn market trends to maximize profit. 3. No Skill Trees Unlike similar games, ABI doesn't use operator skills. Progression is gear-based and tactical, not RPG-style.   Settings and Optimization 1. Graphics and Performance Lower shadows and post-processing for better visibility. Use high FPS settings for smoother combat. 2. Keybinds Customize controls for quick access to healing, leaning, and inventory. Practice muscle memory in offline raids. 3. Audio Settings Maximize footstep and gunfire volume. Reduce ambient noise to focus on threats.   Beginner Loadout Recommendation Slot Item Notes Primary Gun AKS-74U or MP5 Low recoil, easy to handle Secondary Pistol (optional) Backup for emergencies Armor Basic Vest Better than nothing Helmet Light Helmet Protects against headshots Backpack Medium Balance between space and size Meds Bandages, Splints Treat bleeding and fractures Ammo 2–3 extra mags Always reload before fights         Final Advice for New Players Start slow: Don't rush into high-tier zones. Learn the basics in low-risk areas. Play with friends: Squad play improves survival and makes learning easier. Watch and learn: Study streamers and guides to understand advanced tactics. Don't hoard: Use your gear. Hoarding leads to stagnation and fear of loss. Extract often: Surviving and extracting builds confidence and resources. Arena Breakout: Infinite is brutal, but deeply rewarding. With patience and practice, you'll evolve from a terrified scavenger to a confident operator. Every raid is a story—make yours one of survival and triumph.
  • Topics

×
×
  • 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