Jump to content
  • 0

Max clan members


Amanda55

Question

Where i make max 2 clan members

 

	/**
 * @param pledgeType the Id of the pledge type.
 * @return the maximum number of members allowed for a given {@code pledgeType}.
 */
public int getMaxNrOfMembers(int pledgeType)
{
	int limit = 2;

	switch (pledgeType)
	{
		case 0:
			switch (getLevel())
			{
				case 3:
					limit = 2;
					break;
				case 2:
					limit = 2;
					break;
				case 1:
					limit = 2;
					break;
				case 0:
					limit = 2;
					break;
				default:
					limit = 2;
					break;
			}
			break;
		case -1:
			limit = 2;
			break;
		case 100:
		case 200:
			switch (getLevel())
			{
				case 11:
					limit = 2;
					break;
				default:
					limit = 2;
					break;
			}
			break;
		case 1001:
		case 1002:
		case 2001:
		case 2002:
			switch (getLevel())
			{
				case 9:
				case 10:
				case 11:
					limit = 2;
					break;
				default:
					limit = 2;
					break;
			}
			break;
		default:
			break;
	}

	return limit;
}

 

 

Don't work

 

ty for help

Link to comment
Share on other sites

15 answers to this question

Recommended Posts

  • 0

Depends on clan lvl & how much royals clan does have... but use this and give me feed back...

	public int getMaxNrOfMembers(int pledgetype)
{
	int limit = 0;

	switch (pledgetype)
	{
	case 0:
		switch (getLevel())
		{
		case 4:
			limit   = 0;
			break;
		case 3:
			limit   = 0;
			break;
		case 2:
			limit   = 0;
			break;
		case 1:
			limit   = 0;
			break;
		case 0:
			limit   = 0;
			break;
		default:
			limit   = 2;
		break;
		}
		break;
	case -1:
	case 100:
	case 200:
		limit   = 0;
		break;
	case 1001:
	case 1002:
	case 2001:
	case 2002:
		switch (getLevel())
		{
			case 9:
			case 10:
				limit	= 0;
				break;
			default:
				limit   = 0;
				break;
		}
		break;
	default:
		break;
        }

        return limit;
}

Link to comment
Share on other sites

  • 0

Create a condicion in RequestJoinPledge..

 

if (activeChar.getClan().getMembersCount() >= "NUM")

{

activeChar.sendMessage("Your clan is full!.");

return;

}

 

NUM = the number you want of max clan members in a clan.

 

Hope i help.

Link to comment
Share on other sites

  • 0

Create a condicion in RequestJoinPledge..

 

if (activeChar.getClan().getMembersCount() >= "NUM")

{

activeChar.sendMessage("Your clan is full!.");

return;

}

 

NUM = the number you want of max clan members in a clan.

 

Hope i help.

 

why, to make it more heavier? He already has what he needs.

Link to comment
Share on other sites

  • 0

Stewie  don't work :/

 

 

exity  where i put the code in:

 

 public final class RequestJoinPledge extends L2GameClientPacket
{
private static final String _C__26_REQUESTJOINPLEDGE = "[C] 26 RequestJoinPledge";

private int _target;
private int _pledgeType;

@Override
protected void readImpl()
{
	_target = readD();
	_pledgeType = readD();
}

@Override
protected void runImpl()
{
	final L2PcInstance activeChar = getClient().getActiveChar();
	if (activeChar == null)
	{
		return;
	}

	final L2Clan clan = activeChar.getClan();
	if (clan == null)
	{
		return;
	}

	final L2PcInstance target = L2World.getInstance().getPlayer(_target);
	if (target == null)
	{
		activeChar.sendPacket(SystemMessageId.YOU_HAVE_INVITED_THE_WRONG_TARGET);
		return;
	}

	if (!clan.checkClanJoinCondition(activeChar, target, _pledgeType))
	{
		return;
	}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                             if (activeChar.getClan().getMembersCount() >= "NUM")                         ( HERE ) ?
                             {
                             activeChar.sendMessage("Your clan is full!.");
                             return;
                             }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	if (!activeChar.getRequest().setRequest(target, this))
	{
		return;
	}

	final String pledgeName = activeChar.getClan().getName();
	final String subPledgeName = (activeChar.getClan().getSubPledge(_pledgeType) != null ? activeChar.getClan().getSubPledge(_pledgeType).getName() : null);
	target.sendPacket(new AskJoinPledge(activeChar.getObjectId(), subPledgeName, _pledgeType, pledgeName));
}

public int getPledgeType()
{
	return _pledgeType;
}

@Override
public String getType()
{
	return _C__26_REQUESTJOINPLEDGE;
}
}

Link to comment
Share on other sites

  • 0

Small Error

 

if (activeChar.getClan().getMembersCount() >= "2")                ////  The operator >= is undefined for the argument type(s) int, string  ////

 

 

 

And Compil error :

 

:72: error: bad operand types for binary operator '>='

    [javac] if (activeChar.getClan().getMembersCount() >= "2")

    [javac]                                           ^

    [javac]  first type:  int

    [javac]  second type: String

    [javac] 1 error

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.


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