How can I force all players around me to sit?
command?? skill effect??
how can I do this?
How can I force all players around me to sit?
Forum rules
READ NOW: L2j Forums Rules of Conduct
READ NOW: L2j Forums Rules of Conduct
-
- Posts: 8
- Joined: Wed Oct 28, 2009 12:14 am
-
- Posts: 102
- Joined: Wed Sep 02, 2009 11:10 pm
Re: How can I force all players around me to sit?
if (;)
{
player.stopMove(null, false);
player.abortAttack();
player.abortCast();
if (!player.isSitting())
player.sitDown();
}
else
{
if (player.isSitting())
player.standUp();
}
{
player.stopMove(null, false);
player.abortAttack();
player.abortCast();
if (!player.isSitting())
player.sitDown();
}
else
{
if (player.isSitting())
player.standUp();
}
- devo
- Posts: 798
- Joined: Mon Jun 15, 2009 1:19 pm
Re: How can I force all players around me to sit?
Patch:
dont forget to add commands in sql:
Code: Select all
### Eclipse Workspace Patch 1.0#P datapack_developmentIndex: data/scripts/handlers/admincommandhandlers/AdminSit.java===================================================================--- data/scripts/handlers/admincommandhandlers/AdminSit.java (revision 0)+++ data/scripts/handlers/admincommandhandlers/AdminSit.java (revision 0)@@ -0,0 +1,227 @@+/*+ * This program is free software: you can redistribute it and/or modify it under+ * the terms of the GNU General Public License as published by the Free Software+ * Foundation, either version 3 of the License, or (at your option) any later+ * version.+ * + * This program is distributed in the hope that it will be useful, but WITHOUT+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more+ * details.+ * + * You should have received a copy of the GNU General Public License along with+ * this program. If not, see <http://www.gnu.org/licenses/>.+ */+package handlers.admincommandhandlers;++import java.util.StringTokenizer;+import net.sf.l2j.gameserver.handler.IAdminCommandHandler;+import net.sf.l2j.gameserver.model.L2Object;+import net.sf.l2j.gameserver.model.L2World;+import net.sf.l2j.gameserver.model.actor.L2Character;+import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;+import net.sf.l2j.gameserver.network.SystemMessageId;+import net.sf.l2j.gameserver.network.serverpackets.SystemMessage;++/**+ * + * author devO+ * + * This class handles following admin commands:+ * - sit = force target L2Character to sit+ * - stand = force target L2Character to stand+ *+ * - sit <radius> = If radius is specified, then ALL players only in that radius will sit.+ * - stand <radius> = If radius is specified, then ALL players only in that radius will stand.+ *+ */+public class AdminSit implements IAdminCommandHandler+{+ private static final String[] ADMIN_COMMANDS =+ {+ "admin_sit",+ "admin_stand"+ };+ + public boolean useAdminCommand(String command, L2PcInstance activeChar)+ {+ if (command.startsWith("admin_sit"))+ {+ StringTokenizer st = new StringTokenizer(command, " ");+ st.nextToken(); // skip command+ + if (st.hasMoreTokens())+ {+ String firstParam = st.nextToken();+ L2PcInstance plyr = L2World.getInstance().getPlayer(firstParam);+ if (plyr != null)+ {+ if (st.hasMoreTokens())+ {+ try+ {+ int radius = Integer.parseInt(st.nextToken());+ for (L2Character knownChar : plyr.getKnownList().getKnownCharactersInRadius(radius))+ {+ if (knownChar == activeChar)+ continue;+ + sit(activeChar, knownChar);+ }+ + activeChar.sendMessage("All characters within a " + radius + " unit radius forced to sit.");+ return true;+ }+ catch (NumberFormatException e)+ {+ activeChar.sendMessage("Invalid radius.");+ return false;+ }+ }+ else+ {+ sit(activeChar, plyr);+ }+ }+ else+ {+ try+ {+ int radius = Integer.parseInt(firstParam);+ + for (L2Character knownChar : activeChar.getKnownList().getKnownCharactersInRadius(radius))+ {+ if (knownChar == activeChar)+ continue;+ sit(activeChar, knownChar);+ }+ + activeChar.sendMessage("All characters within a " + radius + " unit radius forced to sit.");+ return true;+ }+ catch (NumberFormatException e)+ {+ activeChar.sendMessage("Usage: //sit <player_name | radius>");+ return false;+ }+ }+ }+ else+ {+ L2Object obj = activeChar.getTarget();+ if (!(obj instanceof L2PcInstance))+ activeChar.sendPacket(new SystemMessage(SystemMessageId.INCORRECT_TARGET));+ else+ {+ sit(activeChar, (L2Character) obj);+ }+ }+ }+ else if (command.startsWith("admin_stand"))+ {+ StringTokenizer st = new StringTokenizer(command, " ");+ st.nextToken(); // skip command+ + if (st.hasMoreTokens())+ {+ String firstParam = st.nextToken();+ L2PcInstance plyr = L2World.getInstance().getPlayer(firstParam);+ if (plyr != null)+ {+ if (st.hasMoreTokens())+ {+ try+ {+ int radius = Integer.parseInt(st.nextToken());+ for (L2Character knownChar : plyr.getKnownList().getKnownCharactersInRadius(radius))+ {+ if (knownChar == activeChar)+ continue;+ + stand(activeChar, knownChar);+ }+ + activeChar.sendMessage("All characters within a " + radius + " unit radius forced to stand.");+ return true;+ }+ catch (NumberFormatException e)+ {+ activeChar.sendMessage("Invalid radius.");+ return false;+ }+ }+ else+ {+ stand(activeChar, plyr);+ }+ }+ else+ {+ try+ {+ int radius = Integer.parseInt(firstParam);+ + for (L2Character knownChar : activeChar.getKnownList().getKnownCharactersInRadius(radius))+ {+ if (knownChar == activeChar)+ continue;+ stand(activeChar, knownChar);+ }+ + activeChar.sendMessage("All characters within a " + radius + " unit radius forced to stand.");+ return true;+ }+ catch (NumberFormatException e)+ {+ activeChar.sendMessage("Usage: //stand <player_name | radius>");+ return false;+ }+ }+ }+ else+ {+ L2Object obj = activeChar.getTarget();+ if (!(obj instanceof L2PcInstance))+ activeChar.sendPacket(new SystemMessage(SystemMessageId.INCORRECT_TARGET));+ else+ {+ stand(activeChar, (L2Character) obj);+ }+ }+ }+ return true;+ }+ + private void sit(L2PcInstance activeChar, L2Character target)+ {+ if (target instanceof L2PcInstance)+ {+ target.stopMove(null, false);+ target.abortAttack();+ target.abortCast();+ if (!((L2PcInstance) target).isSitting())+ {+ ((L2PcInstance) target).sitDown();+ }+ }+ }+ + private void stand(L2PcInstance activeChar, L2Character target)+ {+ if (target instanceof L2PcInstance)+ {+ target.stopMove(null, false);+ target.abortAttack();+ target.abortCast();+ if (((L2PcInstance) target).isSitting())+ {+ ((L2PcInstance) target).standUp();+ }+ }+ }+ + public String[] getAdminCommandList()+ {+ return ADMIN_COMMANDS;+ }+}Index: data/scripts/handlers/MasterHandler.java===================================================================--- data/scripts/handlers/MasterHandler.java (revision 6775)+++ data/scripts/handlers/MasterHandler.java (working copy)@@ -92,6 +94,7 @@ AdminCommandHandler.getInstance().registerAdminCommandHandler(new AdminShop()); AdminCommandHandler.getInstance().registerAdminCommandHandler(new AdminShutdown()); AdminCommandHandler.getInstance().registerAdminCommandHandler(new AdminSiege());+ AdminCommandHandler.getInstance().registerAdminCommandHandler(new AdminSit()); AdminCommandHandler.getInstance().registerAdminCommandHandler(new AdminSkill()); AdminCommandHandler.getInstance().registerAdminCommandHandler(new AdminSpawn()); AdminCommandHandler.getInstance().registerAdminCommandHandler(new AdminSummon());
Code: Select all
INSERT IGNORE INTO `admin_command_access_rights` VALUES('admin_sit','1'),('admin_stand','1');
A hero of war is that what they see...
- jurchiks
- Posts: 6769
- Joined: Sat Sep 19, 2009 4:16 pm
- Location: Eastern Europe
Re: How can I force all players around me to sit?
hey, that's some useful stuff, thx 
just 1 question: can they stand up by themselves after forced to sit?
Edit: maybe you could add a function to stop all players in the radius from casting skills too? that would be like in school

just 1 question: can they stand up by themselves after forced to sit?
Edit: maybe you could add a function to stop all players in the radius from casting skills too? that would be like in school

If you have problems, FIRST TRY SOLVING THEM YOURSELF, and if you get errors, TRY TO ANALYZE THEM, and ONLY if you can't help it, THEN ask here.
Otherwise you will never learn anything if all you do is copy-paste!
Discussion breeds innovation.
Otherwise you will never learn anything if all you do is copy-paste!
Discussion breeds innovation.
- devo
- Posts: 798
- Joined: Mon Jun 15, 2009 1:19 pm
Re: How can I force all players around me to sit?
yesjurchiks wrote: just 1 question: can they stand up by themselves after forced to sit?
only to stop casting?jurchiks wrote: Edit: maybe you could add a function to stop all players in the radius from casting skills too? that would be like in
A hero of war is that what they see...
- jurchiks
- Posts: 6769
- Joined: Sat Sep 19, 2009 4:16 pm
- Location: Eastern Europe
Re: How can I force all players around me to sit?
well, it would be better to disallow casting for a set number of time, seconds probably, but there is a number of problems
but i guess canceling for just that moment is easier
about that sit/stand - better to disallow standing by themselves, if you want it for an event, like dice, then you don't want them switching places, running around etc...
that would probably require some kind of toggle admin skill though
but i guess canceling for just that moment is easier
about that sit/stand - better to disallow standing by themselves, if you want it for an event, like dice, then you don't want them switching places, running around etc...
that would probably require some kind of toggle admin skill though

If you have problems, FIRST TRY SOLVING THEM YOURSELF, and if you get errors, TRY TO ANALYZE THEM, and ONLY if you can't help it, THEN ask here.
Otherwise you will never learn anything if all you do is copy-paste!
Discussion breeds innovation.
Otherwise you will never learn anything if all you do is copy-paste!
Discussion breeds innovation.
- Tan
- L2j Veteran
- Posts: 873
- Joined: Wed Jun 10, 2009 10:31 pm
- Location: Poland
Re: How can I force all players around me to sit?
For event l2j have implanted //event commend with you can spawn a npc nearest players then summon they and force them to sit trough // event_panel
Some people believe in God... i believe in Music... some people pray..... I turn on Winamp
http://www.last.fm/user/L2jTan
http://www.last.fm/user/L2jTan
- devo
- Posts: 798
- Joined: Mon Jun 15, 2009 1:19 pm
Re: How can I force all players around me to sit?
its not a problem to make it, if you want I can make it also.jurchiks wrote:well, it would be better to disallow casting for a set number of time, seconds probably, but there is a number of problems
but i guess canceling for just that moment is easier
isnt there a //para <radius> command?jurchiks wrote: about that sit/stand - better to disallow standing by themselves, if you want it for an event, like dice, then you don't want them switching places, running around etc...
that would probably require some kind of toggle admin skill though
A hero of war is that what they see...
- jurchiks
- Posts: 6769
- Joined: Sat Sep 19, 2009 4:16 pm
- Location: Eastern Europe
Re: How can I force all players around me to sit?
i'm just making suggestions, i don't need it, but maybe someone else will
it's good that you can
it's good that you can

If you have problems, FIRST TRY SOLVING THEM YOURSELF, and if you get errors, TRY TO ANALYZE THEM, and ONLY if you can't help it, THEN ask here.
Otherwise you will never learn anything if all you do is copy-paste!
Discussion breeds innovation.
Otherwise you will never learn anything if all you do is copy-paste!
Discussion breeds innovation.