Jump to content
  • 0

Vip System


showma

Question

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
Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

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
Link to comment
Share on other sites

  • 0

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).

Link to comment
Share on other sites

  • 0
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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Posts

    • Keto Move ||  https://rebrand.ly/keto-move-official   Keto Move, as the name the provider has given it, is a pragmatic and regular arrangement that will help you in consuming the additional fat that is all put away in different substantial segments of your body. It can help you through your weight reduction venture in each conceivable way and assist you with consuming off every one of the additional calories put away in your headstrong body districts. On a keto diet, you should comply to specific tight rules, for example, consuming only 5% of carbs, considerably less than whatever we ordinarily take.   Facebook:- https://www.facebook.com/Keto.Move.Official/   Keto Move targets obstinate fat stores all through your body and attempts to kill them, permitting you to get thinner. This keto supplement contains BHB salts, green tea remove, espresso separate, and other home grown parts. Each part of this recipe ensures that Ketosis works appropriately in the body. What's more, this adds to fruitful weight reduction. These sticky bears offer your body all it expects for appropriate cell action. These desserts taste better, yet they additionally work better.   More Relative Blogs https://keto-move.webflow.io/ https://keto-move.company.site/ https://keto-move.jimdosite.com/ https://keto-move.mystrikingly.com/ https://ketomove.journoportfolio.com/ https://solo.to/ketomove https://bio.link/ketomoveofficial https://in.pinterest.com/pin/1145532855383041696 https://soundcloud.com/ketomove/keto-move-weight-loss-review-price-benefits https://medium.com/@ketomove/keto-move-expert-tips-for-staying-on-track-with-keto-71933c4ceaa5 https://sketchfab.com/3d-models/keto-move-better-sale-price-2024-54158d06ed6b48a485ec4ae5568792d9 https://www.eventbrite.com/e/keto-move-keto-move-updated-customer-warning-alert-exposed-tickets-891768873707
    • Attention, attention, the heroes of Elmoraden are wanted! Get ready for new adventures, because our gates are open for you! We switch to the Interlude chronicles on Lionna x5 server, where exciting battles, exciting quests and incredible adventures await you! But that's not all! For beginners, we have a special offer – shadow equipment that will help you develop faster and more efficiently in the world of Elmoraden. With these powerful items, you can easily reach new heights! Join us on May 17th and become a part of the great saga! An unforgettable adventure awaits you on the Lionna X5 server with the Interlude chronicles. Don't miss your chance to become a real hero!     More info: - Characters created from 17.05 09:00 server time, when created will receive gifts in the form of chests with coupons for temporary weapons \ armor No Grade - A grade; - Characters created from 15.05 00:00 server time to 17.05 09:00 will receive gifts in the form of chests with coupons for temporary weapons \ armor No Grade - A grade; - Gifts are divided by grades (No Grade - A Grade) and gifts can be opened at levels corresponding to the grade of the gift. (A gift of D Grade can be opened at the 20th level, B Grade at 52, etc.), but the character's level when opening the gift should not exceed the 75th; - The duration of the equipment \ weapon is 10 hours; - Chaotic characters (characters whose PK counter is higher than 0) cannot use shadow equipment; - On 17.05 at 09:00 server time (10:00 Moscow time), you can meet Looney the Cat in the cities, who will exchange coupons for temporary weapons and equipment; Coupon amount in the gift chests: No Grade: 1 D Grade: 2 C Grade: 2 B Grade: 1 A Grade: 1   On 17.06 at 00:00 server time, the cats will disappear, and with them the chests and coupons. Items received for coupons are not deleted.
  • Topics

×
×
  • Create New...