Jump to content

Question

Posted (edited)

I've never written a java code yet but I would like to write a vip system. It would be consist of an admin command and/or a npc to give a character vip status. the vip status would mean that the character has colored name, earn a vip item and only they can use the global chat.

 

where should I start, how it can be done?

Edited by showma

5 answers to this question

Recommended Posts

  • 0
Posted (edited)

A system that can be extended , i like it ;)

 

You can start by making 2 methods in L2PcInstance to get/set the vip status in the player.

for example:

 

Make a global variable

private boolean vip = false;

then the 2 methods

	public void setVip(boolean val)
	{
		vip = val;
	}
	public boolean isVip()
	{
		return vip;
	}

then, you should make a new admincommandhandler :

 

go at ./handler.admincommandhandlers package and create your new .java AdminVip.java

 

inside the only thing you need is actually 1 check :

if (command.equals("admin_vip"))
	if (activeChar.getTarget() != null && activeChar.getTarget() instanceof L2PcInstance) //checking the target if is a player
	{
		L2PcInstance target = (L2PcInstance) activeChar.getTarget();
		if (target != null)
		{
			if (target.isVip()) //checking if is already a vip
			{
				activeChar.sendMessage("target already vip");
				return false;
			}
			// is not vip , rewarding and set vip
			target.addItem("vipReward", 57, 200, null, true);
			target.sendMessage("You are now Vip!");
			target.setVip(true);
		}
	}

register this command in ./gameserver.handler.AdminCommandHandler.java

registerAdminCommandHandler(new AdminVip());

(dont forget to add the missing import of the AdminVip class)

 

then, depends on your pack you should go in chathandlers and before the message is send to the world,knownlist add a check like this

if (!activeChar.isVip())
{
activeChar.sendMessage("Only vips can talk here");
return;
}
....

Note: with the above code the player is vip until restart. if you want to save the status you should make a connection somewhere in your database to store/restore the vip value

Edited by melron
  • 0
Posted

Can you tell us what project you use? If is aCis, I have something for you. 

For a other project, you should make a connection in your db as Merlon said.. (I think somewhere on Shares & Files, there is a frozen vip system(or hero days) with db connection. But bad coded ofc. It's old).

  • 0
Posted
private static boolean vip = false;

Can't be "static", otherwise the value is global while it must be instancied.

 

There are vip systems here and there (on MxC) and aCis customer section probably got one too. It's nothing more than Melron said.

  • 0
Posted
private static boolean vip = false;

Can't be "static", otherwise the value is global while it must be instancied.

 

There are vip systems here and there (on MxC) and aCis customer section probably got one too. It's nothing more than Melron said.

 

Yeah you're right :p

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

    • We are not back on 2005, life in our days is harder than before, in complection with other things yes, L2 has not the same look.
    • 🌍 https://l2origins.org/ 🛡️ LINEAGE II ORIGINS — SEASON 1 🛡️ 🌑 High Five Classic | True Old-School Experience 🌑 ⚠️ Opening on March 6th at 16:00 Welcome back to the origins of Lineage II. ⚔️ ABOUT THE SERVER Lineage2 Origins is built for players who miss the true retail feeling. Classic progression, real challenges, fair competition — enhanced only with carefully selected QoL features, never breaking the original gameplay. 🌿 PHASED GEAR PROGRESSION 🟢 Month 1: Vesper max 🟢 Month 2: Vorpal unlocked 🟢 Month 3+: Top-grade & Elegia released 🚫 NO AUTO-FARM ✔️ External auto-clicker allowed (1 per client, download page only) ❌ Bots & illegal automation forbidden 🛡️ Strong anti-bot + captcha system ⚠️ AFK players will be punished — stay active or logout 📊 RATES & CORE SETTINGS 🔹 Adena: x5 🔹 Drop / Spoil: x5 🔹 Skill EXP: x15 🔹 Max Windows: 2 per PC 🔹 Subclass: Lv 85 (no quest required) 🔹 Party Level Diff: 30 (55–85) 🔹 No custom items (armors / weapons / jewelry) 🔥 FEATURES ✨ Global & Raid Teleport ✨ NPC Buffer (34 buffs) ✨ Auto Events & PvP Zones ✨ Ranking & Clan Progression ✨ GM Shop & Premium System ✨ All-In-One Community Board ✨ Party & Solo Instances ✨ Siege & Territory War Rewards ✨ RaidBoss Kill Rewards ✨ Lucky Creature Event ✨ Daily Login Rewards ✨ Advanced DDoS Protection & Backups ⚔️ ENCHANTMENTS 🔸 Safe: +3 🔸 Max: +12 (Month 2: +14 | Month 3: +16) 🔸 Blessed: 50% (Premium 65%) 🔸 Normal: 45% (Premium 60%) 🏟️ OLYMPIAD 🔹 Max Enchant: +6 🔹 Start Players: 4 🔹 Period: 1st & 15th 🏰 SIEGE & TW 🔹 Siege Time: 16:00 & 20:00 🔹 Territory War: 20:00 🔹 Max Wards: 3 per Castle 🌌 Lineage2 Origins Fair. Competitive. Nostalgic. A true return to the origins of Lineage II.
    • Bastante confiable, ya trabaje en varios proyectos con el y la verdad te da confianza que hoy en dia poca gente hay asi lo  recomiendo 100%  Gracias por todo amigo ! seguiremos trabajando juntos segurisimamente! 
    • Arcana Mace Acumen +6 : 200 Euro    Leave a message here or better on Discord : grandmaster1991   Discord : GrandMaster#1689  
  • 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..