Рейтинг темы:
  • 0 Голос(ов) - 0 в среднем
  • 1
  • 2
  • 3
  • 4
  • 5
Помогите переделать проверку! Пожалуйста!
#11
Как обычно мне нужна ваша помощьSmile

Код:
public static synchronized void onBypass(String command, L2PcInstance playerInstance)
    {
        if (playerInstance == null || !isParticipating())
            return;
        
        final String htmContent;

        if (command.equals("tvt_event_participation"))
        {
            NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage(0);
            int playerLevel = playerInstance.getLevel();
            
            [COLOR="Red"]String IPRegPlayer = playerInstance.getClient().getConnection().getInetAddress().getHostAddress();
                for(L2PcInstance pl : playerInstance)
                    if (pl!=null)
                        if(pl.getClient().getConnection().getInetAddress().getHostAddress().equals(IPRegPlayer))
                            {
                                htmContent = HtmCache.getInstance().getHtm(htmlPath+"IP.htm");
                                    if (htmContent != null)
                                        npcHtmlMessage.setHtml(htmContent);
                            }[/COLOR]
            if (playerInstance.isCursedWeaponEquipped())
            {
                htmContent = HtmCache.getInstance().getHtm(htmlPath+"CursedWeaponEquipped.htm");
                if (htmContent != null)
                    npcHtmlMessage.setHtml(htmContent);
            }
            else if (Olympiad.getInstance().isRegistered(playerInstance))
            {
                htmContent = HtmCache.getInstance().getHtm(htmlPath+"Olympiad.htm");
                if (htmContent != null)
                    npcHtmlMessage.setHtml(htmContent);
            }
            else if (playerInstance.getKarma() > 0)
            {
                htmContent = HtmCache.getInstance().getHtm(htmlPath+"Karma.htm");
                if (htmContent != null)
                    npcHtmlMessage.setHtml(htmContent);
            }
            else if (playerLevel < Config.TVT_EVENT_MIN_LVL || playerLevel > Config.TVT_EVENT_MAX_LVL)
            {
                htmContent = HtmCache.getInstance().getHtm(htmlPath+"Level.htm");
                if (htmContent != null)
                {
                    npcHtmlMessage.setHtml(htmContent);
                    npcHtmlMessage.replace("%min%", String.valueOf(Config.TVT_EVENT_MIN_LVL));
                    npcHtmlMessage.replace("%max%", String.valueOf(Config.TVT_EVENT_MAX_LVL));
                }
            }
            else if (_teams[0].getParticipatedPlayerCount() == Config.TVT_EVENT_MAX_PLAYERS_IN_TEAMS && _teams[1].getParticipatedPlayerCount() == Config.TVT_EVENT_MAX_PLAYERS_IN_TEAMS)
            {
                htmContent = HtmCache.getInstance().getHtm(htmlPath+"TeamsFull.htm");
                if (htmContent != null)
                {
                    npcHtmlMessage.setHtml(htmContent);
                    npcHtmlMessage.replace("%max%", String.valueOf(Config.TVT_EVENT_MAX_PLAYERS_IN_TEAMS));
                }
            }
            else if (!payParticipationFee(playerInstance))
            {
                htmContent = HtmCache.getInstance().getHtm(htmlPath+"ParticipationFee.htm");
                if (htmContent != null)
                {
                    npcHtmlMessage.setHtml(htmContent);
                    npcHtmlMessage.replace("%fee%", getParticipationFee());
                }
            }
            else if (addParticipant(playerInstance))
                npcHtmlMessage.setHtml(HtmCache.getInstance().getHtm(htmlPath+"Registered.htm"));
            else
                return;
            
            playerInstance.sendPacket(npcHtmlMessage);
        }
        else if (command.equals("tvt_event_remove_participation"))
        {
            removeParticipant(playerInstance.getObjectId());
            
            NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage(0);
            
            npcHtmlMessage.setHtml(HtmCache.getInstance().getHtm(htmlPath+"Unregistered.htm"));
            playerInstance.sendPacket(npcHtmlMessage);
        }
    }

При попытке компиляции вот такая ошибка:

Код:
compile:
    [javac] C:\l2open\Game\build.xml:42: warning: 'includeantruntime' was not se
t, defaulting to build.sysclasspath=last; set to false for repeatable builds
    [javac] Compiling 1593 source files to C:\l2open\Game\target\classes
    [javac] C:\l2open\Game\src\main\java\com\l2open\gameserver\model\entity\TvTE
vent.java:658: foreach not applicable to expression type
    [javac]                             for(L2PcInstance pl : playerInstance)
    [javac]                                                   ^
    [javac] 1 error

Что я там запорол?Smile
Ответ
#12
вникаеш разницу между playerInstance и regPlayer который тебе дали? а

Добавлено через 3 минуты
кароч попрубй заместь L2PcInstance pl : playerInstance
L2PcInstance pl : players
Ответ
#13
Легче не стало.

Код:
compile:
    [javac] c:\l2open\Game\build.xml:42: warning: 'includeantruntime' was not se
t, defaulting to build.sysclasspath=last; set to false for repeatable builds
    [javac] Compiling 1593 source files to c:\l2open\Game\target\classes
    [javac] c:\l2open\Game\src\main\java\com\l2open\gameserver\model\entity\TvTE
vent.java:658: cannot find symbol
    [javac] symbol  : variable players
    [javac] location: class com.l2open.gameserver.model.entity.TvTEvent
    [javac]                             for(L2PcInstance pl : players)
    [javac]                                                   ^
    [javac] 1 error

вот код:

Код:
String IPRegPlayer = playerInstance.getClient().getConnection().getInetAddress().getHostAddress();
                for(L2PcInstance pl : players)
                    if (pl!=null)
                        if(pl.getClient().getConnection().getInetAddress().getHostAddress().equals(IPRegPlayer))
                            {
                                htmContent = HtmCache.getInstance().getHtm(htmlPath+"IP.htm");
                                    if (htmContent != null)
                                        npcHtmlMessage.setHtml(htmContent);
                            }
Ответ
#14
derron116, а что-то не вижу массива. Не по 1-му игроку же цикл гонять.
Ответ
#15
Array Написал:derron116, а что-то не вижу массива. Не по 1-му игроку же цикл гонять.

а как это сделать?Smile
Ответ


Возможно похожие темы ...
Тема Автор Ответы Просмотры Последний пост
  Ребята помогите с логин и геймом Lackyjack 4 1,879 04-04-2018, 05:46 PM
Последний пост: MasVild
  Помогите переписать скрипт с Python на Java Virrilis3 0 1,478 03-29-2018, 10:55 PM
Последний пост: Virrilis3
  Помогите со сборкой lostworld HF voland3 1 2,135 03-22-2018, 12:54 AM
Последний пост: Kampina
  подскажите пожалуйста kasper 12 3,039 01-27-2016, 06:22 AM
Последний пост: finfan
  Помогите со скриптом Mazahacka 0 1,133 07-29-2015, 10:26 PM
Последний пост: Mazahacka
  Сервер RusTeam rev1269 Хроники C5 [Помогите найти] s4nders 0 1,038 03-13-2015, 09:21 AM
Последний пост: s4nders
  Помогите скомпилить cool235 1 1,423 01-04-2015, 09:03 PM
Последний пост: Rolfer
  Оверлорд докаст скилов - помогите настроить Munhgauzen 15 3,832 01-11-2014, 08:04 AM
Последний пост: DiagoD
  Оверлорд помогите насторить Hide - офлайк Munhgauzen 3 1,514 12-22-2013, 01:53 AM
Последний пост: Munhgauzen
  Помогите прикрутить код wakepower 22 6,926 12-08-2013, 10:19 AM
Последний пост: alextt1989

Перейти к форуму:


Пользователи, просматривающие эту тему: 2 Гость(ей)