Jump to content
  • 0

[DeathMatch]Find winner


Question

Posted

Hello there, i have this code.

 

 

       

for (L2PcInstance onlinePlayer : ples)
        {
            if (onlinePlayer.isInDm)
            {
                onlinePlayer.teleToLocation(81220, 148588, -3472);
                onlinePlayer.isInDm = false;
            }
            if (onlinePlayer.getDmKills() > maxkills)
            {
                winner = onlinePlayer;
                maxkills = onlinePlayer.getDmKills();
            }
            onlinePlayer.isInDm = false;
            onlinePlayer.setDmKills(0);
        }
        if (maxkills != 0)
        {
            for (int[] reward : Config.DM_EVENT_REWARDS)
            {
                winner.addItem("Death Match", reward[1], reward[2], winner, true);
                winner.broadcastUserInfo();
                winner.sendPacket(new InventoryUpdate());
                winner.sendPacket(new ItemList(winner, false));
                winner.sendPacket(new StatusUpdate(winner));
            }
            winner.sendMessage("Congratulations! You have won Death Match Event.");
        }

 

I want to find from all registered players in event (isInDm) who has most DmKills and reward him, i used that but it says me that maxkills stayed 0...

1 answer to this question

Recommended Posts

Guest
This topic is now closed to further replies.


×
×
  • Create New...