Re: function java problem
where are you checking, if player is a leader?
Re: function java problem
in siege.java in attacker register i am sending
L2Clan owningClan = ClanTable.getInstance().getClan(castle.getOwnerId());
int leaderId = owningClan.getLeader().getObjectId();
if (isLeaderInJail(leaderId)) .....
Re: function java problem
well you can always check the database with SQL query... you would avoid checking unwanted players and stuff...
what goes for the 'FOR' loop - you don't break out of the loop, when you find the player, instead you find that player, output the data and still continue the loop... so my suggestion is:
Code:
public boolean isLeaderInJail(int playerId)
{
boolean jailed = false;
for (L2PcInstance player : L2World.getAllPlayers())
{
if (player != null && player.getObjectId() == playerId)
{
jailed = player.isInJail();
break;
}
}
return jailed;
}
Re: function java problem
Quote:
Originally Posted by
Rin4a
well you can always check the database with SQL query... you would avoid checking unwanted players and stuff...
what goes for the 'FOR' loop - you don't break out of the loop, when you find the player, instead you find that player, output the data and still continue the loop... so my suggestion is:
Code:
public boolean isLeaderInJail(int playerId)
{
boolean jailed = false;
for (L2PcInstance player : L2World.getAllPlayers())
{
if (player != null && player.getObjectId() == playerId)
{
jailed = player.isInJail();
break;
}
}
return jailed;
}
it doesn't work. first time i tried that but didn't work.
the problem is the id that i send . i mean the getowner...
Re: function java problem
Code:
public boolean isLeaderInJail(L2PcInstance player) {
return player.isInJail();
}
.
.
.
if(isLeaderInJail(owningClan.getLeader())
BTW, if you are using the boolean method only in the same class, declare it private, less memory will be allocated for it
Edit:
and why not just (if owningClan.getLeader().isInJail()) .. ?
Re: function java problem
yeah i know :) thank you for the replies closed :)