Jump to content

[Share]Vote


Recommended Posts

when the options are ready, write //startvotes for html ...

also //showvotes will show the votes

//clear - the command will help you to clear the options and votes

 

Are Those Guys Too Stupid Or I Just Started To Reading Java ?ahahaha Fail They Cant Understand

Link to comment
Share on other sites

Nice idea...you can make an auto-manager that will take an action based on the votes...Like a trivia or anti-bot or a lot of other events. And it could be edited so you ca show that html to a person or a party or a clan or who knows what...Gj

Link to comment
Share on other sites

Nice idea...you can make an auto-manager that will take an action based on the votes...Like a trivia or anti-bot or a lot of other events. And it could be edited so you ca show that html to a person or a party or a clan or who knows what...Gj

I will extend it including your idea

Link to comment
Share on other sites

from  RequestBypassToServer.java - Index: net.sf.l2j.gameserver.clientpackets

 

i get error this line

 

else if (_command.startsWith("Quest "))

{

if(!activeChar.validateBypass(_command))

return;

 

L2PcInstance player = getClient().getActiveChar();

if (player == null) return;

 

String p = _command.substring(6).trim();

int idx = p.indexOf(' ');

if (idx < 0)

player.processQuestEvent(p, "");

else

player.processQuestEvent(p.substring(0, idx), p.substring(idx).trim());

}

+ else if(_command.startsWith("custom_"))

+ {

+ L2PcInstance player = getClient().getActiveChar();

+ if(!player.validateBypass(_command))

+ return;

+

+ BypassHandler.getInstance().handleBypass(player, _command);

+ }

 

 

i can't find this cordination ... BypassHandler.java - Index: net.sf.l2j.gameserver.model.custom

 

from   Vote.java - Index: net.sf.l2j.gameserver.model.entity.Events

 

/* 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 2, 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, write to the Free Software

* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA

* 02111-1307, USA.

*

* http://www.gnu.org/copyleft/gpl.html

*/

package net.sf.l2j.gameserver.model.entity.Events;

 

import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminCustom;

import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;

import net.sf.l2j.gameserver.serverpackets.NpcHtmlMessage;

 

/**

* @author  xAddytzu

*/

public class Vote

{

private static Vote _instance = null;

private List<String> _IPs = new FastList<String>();

public static int voteCount1 = 0;

public static int voteCount2 = 0;

public static int voteCount3 = 0;

public static Vote getInstance()

{

if(_instance == null)

_instance = new Vote();

 

return _instance;

}

public void handleCommand(L2PcInstance player,String command)

{

if(command.startsWith("custom_vote_1"))

{

if (_IPs.contains(player.getClient().getConnection().getSocketChannel().socket().getInetAddress().getHostAddress()))

continue;

 

_IPs.add(player.getClient().getConnection().getSocketChannel().socket().getInetAddress().getHostAddress());

voteCount1++;

player.sendMessage("Thanks for your vote.");

}

else if(command.startsWith("custom_vote_2"))

{

if (_IPs.contains(player.getClient().getConnection().getSocketChannel().socket().getInetAddress().getHostAddress()))

continue;

 

_IPs.add(player.getClient().getConnection().getSocketChannel().socket().getInetAddress().getHostAddress());

voteCount2++;

player.sendMessage("Thanks for your vote.");

}

else if(command.startsWith("custom_vote_3"))

{

if (_IPs.contains(player.getClient().getConnection().getSocketChannel().socket().getInetAddress().getHostAddress()))

continue;

 

_IPs.add(player.getClient().getConnection().getSocketChannel().socket().getInetAddress().getHostAddress());

voteCount3++;

player.sendMessage("Thanks for your vote.");

}

}

public void showVoteHtml(L2PcInstance activeChar)

{

String htmFile = "data/html/custom/vote.htm";

NpcHtmlMessage html = new NpcHtmlMessage(1);

html.setFile(htmFile);

html.replace("%first%", String.valueOf(AdminCustom.first));

html.replace("%second%", String.valueOf(AdminCustom.second));

html.replace("%third%", String.valueOf(AdminCustom.third));

html.replace("%voteCount1%", String.valueOf(voteCount1));

html.replace("%voteCount2%", String.valueOf(voteCount2));

html.replace("%voteCount3%", String.valueOf(voteCount3));

activeChar.sendPacket(html);

}

public void clear()

{

voteCount1 = 0;

voteCount2 = 0;

voteCount3 = 0;

AdminCustom.first = "";

AdminCustom.second = "";

AdminCustom.third = "";

_IPs.clear();

}

}

 

why i get this errors? i do everything right..

Link to comment
Share on other sites

+            BypassHandler.getInstance().handleBypass(player, _command);

just import the file :)


 

well, there isnt any class "IPs". any solution?

 

is the same...again i get error...from all cordinate where i need put java codes i get errors..Isn't for IL?

Link to comment
Share on other sites

+            BypassHandler.getInstance().handleBypass(player, _command);

just import the file :)


 

well, there isnt any class "IPs". any solution?

_IPs is a list.

 

import java.util.List;

import javolution.util.FastList;

 

anyway if you are using Eclipse, hold Ctrl+Shift+O (Organize Imports)

 

Link to comment
Share on other sites

_IPs is a list.

 

import java.util.List;

import javolution.util.FastList;

Oh okey, now it gotten fixed. But im now im having problems with getSocketChannel, even if i change it to Socket.

 

Any solution again? Thanks

Link to comment
Share on other sites

Oh okey, now it gotten fixed. But im now im having problems with getSocketChannel, even if i change it to Socket.

 

Any solution again? Thanks

Search in your source code how to get an ip ...

Link to comment
Share on other sites

well, i made it

_IPs.add(player.getClient().getConnection().getSocket().getInetAddress().getHostAddress());

, i deleted getsocketchanel and socket and added getSocket. No errors.

 

but is it going to work?

 

 


 

Edit:

			if (_IPs.contains(player.getClient().getConnection().getSocket().getInetAddress().getHostAddress()))
			[color=yellow]continue;[/color]

Last error >:(

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.




×
×
  • Create New...