Jump to content
  • 0

Check IP for Poll


Kido

Question


  • Group:  Members
  • Topic Count:  127
  • Topics Per Day:  0.03
  • Content Count:  1445
  • Reputation:   163
  • Joined:  08/17/13
  • Last Seen:  

Well, in my server i have the npc poll to know what my players thinks and in base of that make some change on the stuff, but i noticed that a player made around 7 acc. to vote more the option it likes

 

i want to change this npc so it can check ip and only let 1 same ip account to vote

this is my script

//===== eAthena Script ======================================= 
//= Votaciones 
//===== by: ================================================== 
//= Hattori
//===== Repaired by: ================================================== 
//= DRAXTER (Emperium RO)    
//===== Current Version: ===================================== 
//= 2.0
//===== Compatible With: ===================================== 
//= Cualquier Version eAthena
//===== Description: ========================================= 
//= Se toma en cuenta una encuesta,en la cual participan los users y es modificable x GMs
//===== Comentarios: ================================= 
//= Reparado Por DRAXTER BUGS:mapa,duplicate(QUITADO) y condicionales GM(Estaban erroneos los valores)
//= Cambiado a Mapa Prontera 
//============================================================
izlude.gat,123,151,4	script	Encuesta	831,{
if ($poll_question$ == "") goto L_NoQuestion;

L_Begin:
	mes "[Poll]";
	mes "^FF0000" + $poll_question$ + "^000000";
	
	if (#pollid != $pollid) goto L_NotVoted;
	
	// Sets bar length
	set @PB$[0], "                    ";
	set @PB$[1], "^0077BF|                   ^000000";
	set @PB$[2], "^0081CF|^0077BF|                  ^000000";
	set @PB$[3], "^008BDF|^0081CF|^0077BF|                 ^000000";
	set @PB$[4], "^0094EF|^008BDF|^0081CF|^0077BF|                ^000000";
	set @PB$[5], "^009EFF|^0094EF|^008BDF|^0081CF|^0077BF|               ^000000";
	set @PB$[6], "^0FA4FF|^009EFF|^0094EF|^008BDF|^0081CF|^0077BF|              ^000000";
	set @PB$[7], "^1FAAFF|^0FA4FF|^009EFF|^0094EF|^008BDF|^0081CF|^0077BF|             ^000000";
	set @PB$[8], "^2FB0FF|^1FAAFF|^0FA4FF|^009EFF|^0094EF|^008BDF|^0081CF|^0077BF|            ^000000";
	set @PB$[9], "^3FB6FF|^2FB0FF|^1FAAFF|^0FA4FF|^009EFF|^0094EF|^008BDF|^0081CF|^0077BF|           ^000000";
	set @PB$[10], "^4FBCFF|^3FB6FF|^2FB0FF|^1FAAFF|^0FA4FF|^009EFF|^0094EF|^008BDF|^0081CF|^0077BF|          ^000000";
	set @PB$[11], "^5FC2FF|^4FBCFF|^3FB6FF|^2FB0FF|^1FAAFF|^0FA4FF|^009EFF|^0094EF|^008BDF|^0081CF|^0077BF|         ^000000";
	set @PB$[12], "^6FC8FF|^5FC2FF|^4FBCFF|^3FB6FF|^2FB0FF|^1FAAFF|^0FA4FF|^009EFF|^0094EF|^008BDF|^0081CF|^0077BF|        ^000000";
	set @PB$[13], "^7FCCFF|^6FC8FF|^5FC2FF|^4FBCFF|^3FB6FF|^2FB0FF|^1FAAFF|^0FA4FF|^009EFF|^0094EF|^008BDF|^0081CF|^0077BF|       ^000000";
	set @PB$[14], "^8FD2FF|^7FCCFF|^6FC8FF|^5FC2FF|^4FBCFF|^3FB6FF|^2FB0FF|^1FAAFF|^0FA4FF|^009EFF|^0094EF|^008BDF|^0081CF|^0077BF|      ^000000";
	set @PB$[15], "^9FD8FF|^8FD2FF|^7FCCFF|^6FC8FF|^5FC2FF|^4FBCFF|^3FB6FF|^2FB0FF|^1FAAFF|^0FA4FF|^009EFF|^0094EF|^008BDF|^0081CF|^0077BF|     ^000000";
	set @PB$[16], "^AFDFFF|^9FD8FF|^8FD2FF|^7FCCFF|^6FC8FF|^5FC2FF|^4FBCFF|^3FB6FF|^2FB0FF|^1FAAFF|^0FA4FF|^009EFF|^0094EF|^008BDF|^0081CF|^0077BF|    ^000000";
	set @PB$[17], "^BFE5FF|^AFDFFF|^9FD8FF|^8FD2FF|^7FCCFF|^6FC8FF|^5FC2FF|^4FBCFF|^3FB6FF|^2FB0FF|^1FAAFF|^0FA4FF|^009EFF|^0094EF|^008BDF|^0081CF|^0077BF|   ^000000";
	set @PB$[18], "^CFEBFF|^BFE5FF|^AFDFFF|^9FD8FF|^8FD2FF|^7FCCFF|^6FC8FF|^5FC2FF|^4FBCFF|^3FB6FF|^2FB0FF|^1FAAFF|^0FA4FF|^009EFF|^0094EF|^008BDF|^0081CF|^0077BF|  ^000000";
	set @PB$[19], "^DFF1FF|^CFEBFF|^BFE5FF|^AFDFFF|^9FD8FF|^8FD2FF|^7FCCFF|^6FC8FF|^5FC2FF|^4FBCFF|^3FB6FF|^2FB0FF|^1FAAFF|^0FA4FF|^009EFF|^0094EF|^008BDF|^0081CF|^0077BF| ^000000";
	set @PB$[20], "^EFF8FF|^DFF1FF|^CFEBFF|^BFE5FF|^AFDFFF|^9FD8FF|^8FD2FF|^7FCCFF|^6FC8FF|^5FC2FF|^4FBCFF|^3FB6FF|^2FB0FF|^1FAAFF|^0FA4FF|^009EFF|^0094EF|^008BDF|^0081CF|^0077BF|^000000";
	
	// Calculates percentage
	set @total,$PA[1]+$PA[2]+$PA[3]+$PA[4]+$PA[5]+$PA[6]+$PA[7]+$PA[8]+$PA[9];
	set @PC[1],$PA[1]*100/@total;
	set @PC[2],$PA[2]*100/@total;
	set @PC[3],$PA[3]*100/@total;
	set @PC[4],$PA[4]*100/@total;
	set @PC[5],$PA[5]*100/@total;
	set @PC[6],$PA[6]*100/@total;
	set @PC[7],$PA[7]*100/@total;
	set @PC[8],$PA[8]*100/@total;
	set @PC[9],$PA[9]*100/@total;
	
	// Displays results
	if ($PQ$[1] != "") mes $PQ$[1];
	if ($PQ$[1] != "") mes "["+@PB$[@PC[1]/5]+"] " + $PA[1] + " ("+@PC[1]+"%)";
	if ($PQ$[2] != "") mes $PQ$[2];
	if ($PQ$[2] != "") mes "["+@PB$[@PC[2]/5]+"] " + $PA[2] + " ("+@PC[2]+"%)";
	if ($PQ$[3] != "") mes $PQ$[3];
	if ($PQ$[3] != "") mes "["+@PB$[@PC[3]/5]+"] " + $PA[3] + " ("+@PC[3]+"%)";
	if ($PQ$[4] != "") mes $PQ$[4];
	if ($PQ$[4] != "") mes "["+@PB$[@PC[4]/5]+"] " + $PA[4] + " ("+@PC[4]+"%)";
	if ($PQ$[5] != "") mes $PQ$[5];
	if ($PQ$[5] != "") mes "["+@PB$[@PC[5]/5]+"] " + $PA[5] + " ("+@PC[5]+"%)";
	if ($PQ$[6] != "") mes $PQ$[6];
	if ($PQ$[6] != "") mes "["+@PB$[@PC[6]/5]+"] " + $PA[6] + " ("+@PC[6]+"%)";
	if ($PQ$[7] != "") mes $PQ$[7];
	if ($PQ$[7] != "") mes "["+@PB$[@PC[7]/5]+"] " + $PA[7] + " ("+@PC[7]+"%)";
	if ($PQ$[8] != "") mes $PQ$[8];
	if ($PQ$[8] != "") mes "["+@PB$[@PC[8]/5]+"] " + $PA[8] + " ("+@PC[8]+"%)";
	if ($PQ$[9] != "") mes $PQ$[9];
	if ($PQ$[9] != "") mes "["+@PB$[@PC[9]/5]+"] " + $PA[9] + " ("+@PC[9]+"%)";
	mes "total de votos" + @total;
	if (getgmlevel() > 90) menu "Continuar",-,"Opción de encuesta de revisión",L_Edit,"Cuenta de encuesta de revisión",L_EditCount,"Añada la opción de encuesta",L_Add,"Juego nueva encuesta",L_SetQuestion,"Permita a revotación",L_ReVote;
	close;

// Vote menu
L_NotVoted:
	menu	$PQ$[1],P1,
			$PQ$[2],P2,
			$PQ$[3],P3,
			$PQ$[4],P4,
			$PQ$[5],P5,
			$PQ$[6],P6,
			$PQ$[7],P7,
			$PQ$[8],P8,
			$PQ$[9],P9,
			"Cancel",L_Cancel;
			
P1:	set @vote,1; goto P_Vote;
P2:	set @vote,2; goto P_Vote;
P3:	set @vote,3; goto P_Vote;
P4:	set @vote,4; goto P_Vote;
P5:	set @vote,5; goto P_Vote;
P6:	set @vote,6; goto P_Vote;
P7:	set @vote,7; goto P_Vote;
P8:	set @vote,8; goto P_Vote;
P9:	set @vote,9; goto P_Vote;

P_Vote:
	if ($PQ$[@vote] == "") goto L_Begin;
	
	set $PA[@vote],$PA[@vote]+1;
	set #pollid,$pollid;
	next;
	mes "[Poll]";
	mes "Gracias por tu voto!";
	next;
	goto L_Begin;

// No question is set
L_NoQuestion:
	mes "[Poll]";
	mes "No hay preguntas";
	if (getgmlevel() > 90) goto L_SetQuestion;
	close;

// Set question
L_SetQuestion:
	set $PQ$[1],"";
	set $PQ$[2],"";
	set $PQ$[3],"";
	set $PQ$[4],"";
	set $PQ$[5],"";
	set $PQ$[6],"";
	set $PQ$[7],"";
	set $PQ$[8],"";
	set $PQ$[9],"";
	set $PA[1],"";
	set $PA[2],"";
	set $PA[3],"";
	set $PA[4],"";
	set $PA[5],"";
	set $PA[6],"";
	set $PA[7],"";
	set $PA[8],"";
	set $PA[9],"";

	next;
	mes "[Poll]";
	mes "Pregunta de juego?";
	next;
	menu "Si",-,"No",L_Cancel;
	
	input $poll_question$;
	set $pollid,rand (100000,999999);
	mes "Sistema de pregunta: " + $poll_question$;
	next;
	mes "[Poll]";
	mes "Las opciones de la entrada";
	mes "escriba 'el final' para pararse";
	next;
	
	P_Set:
		input $PQ$[1];
		if ($PQ$[1] == "end") goto P_Set;	// Disallows no option poll
	P_Set2:
		input $PQ$[2];
		if ($PQ$[2] == "end") goto P_Set2; // Disallows 1 option poll
		input $PQ$[3];
		set @last,3;
		if ($PQ$[3] == "end") goto L_SetEnd;
		input $PQ$[4];
		set @last,4;
		if ($PQ$[4] == "end") goto L_SetEnd;
		input $PQ$[5];
		set @last,5;
		if ($PQ$[5] == "end") goto L_SetEnd;
		input $PQ$[6];
		set @last,6;
		if ($PQ$[6] == "end") goto L_SetEnd;
		input $PQ$[7];
		set @last,7;
		if ($PQ$[7] == "end") goto L_SetEnd;
		input $PQ$[8];
		set @last,8;
		if ($PQ$[8] == "end") goto L_SetEnd;
		input $PQ$[9];
		set @last,9;
		if ($PQ$[9] == "end") goto L_SetEnd;

// Add poll field
L_Add:
	next;
	mes "[Poll]";

	if ($PQ$[3] == "") goto PA3;
	if ($PQ$[4] == "") goto PA4;
	if ($PQ$[5] == "") goto PA5;
	if ($PQ$[6] == "") goto PA6;
	if ($PQ$[7] == "") goto PA7;
	if ($PQ$[8] == "") goto PA8;
	if ($PQ$[9] == "") goto PA9;
	
	mes "Lamentable, las opciones estan llenas.";
	close;

	PA3:	set @add,3; goto L_Add2;
	PA4:	set @add,4; goto L_Add2;
	PA5:	set @add,5; goto L_Add2;
	PA6:	set @add,6; goto L_Add2;
	PA7:	set @add,7; goto L_Add2;
	PA8:	set @add,8; goto L_Add2;
	PA9:	set @add,9; goto L_Add2;
	
	L_Add2:
	mes "Entre en el nombre de la votación que usted desea que usted agrega.";
	input $PQ$[@add];
	next;
	mes "[Poll]";
	mes "Opción añadió";
	close;
	
// Edit poll count
L_EditCount:
	next;
	mes "[Poll]";
	mes "Qué opción tienes gusto de cambiar la cuenta de?";
	next;
	menu	$PQ$[1],PEC1,
			$PQ$[2],PEC2,
			$PQ$[3],PEC3,
			$PQ$[4],PEC4,
			$PQ$[5],PEC5,
			$PQ$[6],PEC6,
			$PQ$[7],PEC7,
			$PQ$[8],PEC8,
			$PQ$[9],PEC9,
			"Cancel",L_Cancel;
	
	PEC1:	input $PA[1]; goto L_EditCountSet;
	PEC2:	input $PA[2]; goto L_EditCountSet;
	PEC3:	input $PA[3]; goto L_EditCountSet;
	PEC4:	input $PA[4]; goto L_EditCountSet;
	PEC5:	input $PA[5]; goto L_EditCountSet;
	PEC6:	input $PA[6]; goto L_EditCountSet;
	PEC7:	input $PA[7]; goto L_EditCountSet;
	PEC8:	input $PA[8]; goto L_EditCountSet;
	PEC9:	input $PA[9]; goto L_EditCountSet;
	
	L_EditCountSet:
		mes "[Poll]";
		mes "Opcion cambiada";
		close;
	
// Edit poll field
L_Edit:
	next;
	mes "[Poll]";
	mes "¿Qué opción le gustaría para revisar?";
	next;
	menu	$PQ$[1],PE1,
			$PQ$[2],PE2,
			$PQ$[3],PE3,
			$PQ$[4],PE4,
			$PQ$[5],PE5,
			$PQ$[6],PE6,
			$PQ$[7],PE7,
			$PQ$[8],PE8,
			$PQ$[9],PE9,
			"Cancel",L_Cancel;
		
		PE1:	input $PQ$[1]; goto L_EditSet;
		PE2:	input $PQ$[2]; goto L_EditSet;
		PE3:	input $PQ$[3]; goto L_EditSet;
		PE4:	input $PQ$[4]; goto L_EditSet;
		PE5:	input $PQ$[5]; goto L_EditSet;
		PE6:	input $PQ$[6]; goto L_EditSet;
		PE7:	input $PQ$[7]; goto L_EditSet;
		PE8:	input $PQ$[8]; goto L_EditSet;
		PE9:	input $PQ$[9]; goto L_EditSet;

L_EditSet:
	mes "[Poll]";
	mes "Opcion cambiada";
	close;

L_SetEnd:
	Announce "Se ha fijado una nueva encuesta!",8;
	Announce $poll_question$,8;
	set $PQ$[@last],"";
	mes "[Poll]";
	mes "Sistema de la encuesta";
	close;

// Allow players to re-cast their vote
L_ReVote:
	next;
	set $pollid,rand (100000,999999);
	mes "[Poll]";
	mes "Re-voto permitido";
	close;
	
L_Cancel:
	mes "[Poll]";
	mes "Adios!!!";
	close;
}

Thanks! i hope i gave enought information, if not, i will give more

thanks again!

Link to comment
Share on other sites

11 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.01
  • Content Count:  276
  • Reputation:   24
  • Joined:  07/06/13
  • Last Seen:  

Can you translate the script to english? I can help you on this.

 

Edited:

 

I do not know where to put IP restrictions, cant understand the language. :)

Edited by Lil Troll
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  127
  • Topics Per Day:  0.03
  • Content Count:  1445
  • Reputation:   163
  • Joined:  08/17/13
  • Last Seen:  

sure no problem, i will translate it to english, sorry for that, give me a break so i can translate, im mexican thats why my english is bad xD allright i will translate it :) when i translated i will edit my post ok or if you answer i will respond :)

 

 

Edit:

done

//===== eAthena Script ======================================= 
//= Votaciones 
//===== by: ================================================== 
//= Hattori
//===== Repaired by: ================================================== 
//= DRAXTER (Emperium RO)    
//===== Current Version: ===================================== 
//= 2.0
//===== Compatible With: ===================================== 
//= Cualquier Version eAthena
//===== Description: ========================================= 
//= Se toma en cuenta una encuesta,en la cual participan los users y es modificable x GMs
//===== Comentarios: ================================= 
//= Reparado Por DRAXTER BUGS:mapa,duplicate(QUITADO) y condicionales GM(Estaban erroneos los valores)
//= Cambiado a Mapa Prontera 
//============================================================
izlude.gat,123,151,4	script	Encuesta	831,{
if ($poll_question$ == "") goto L_NoQuestion;

L_Begin:
	mes "[Poll]";
	mes "^FF0000" + $poll_question$ + "^000000";
	
	if (#pollid != $pollid) goto L_NotVoted;
	
	// Sets bar length
	set @PB$[0], "                    ";
	set @PB$[1], "^0077BF|                   ^000000";
	set @PB$[2], "^0081CF|^0077BF|                  ^000000";
	set @PB$[3], "^008BDF|^0081CF|^0077BF|                 ^000000";
	set @PB$[4], "^0094EF|^008BDF|^0081CF|^0077BF|                ^000000";
	set @PB$[5], "^009EFF|^0094EF|^008BDF|^0081CF|^0077BF|               ^000000";
	set @PB$[6], "^0FA4FF|^009EFF|^0094EF|^008BDF|^0081CF|^0077BF|              ^000000";
	set @PB$[7], "^1FAAFF|^0FA4FF|^009EFF|^0094EF|^008BDF|^0081CF|^0077BF|             ^000000";
	set @PB$[8], "^2FB0FF|^1FAAFF|^0FA4FF|^009EFF|^0094EF|^008BDF|^0081CF|^0077BF|            ^000000";
	set @PB$[9], "^3FB6FF|^2FB0FF|^1FAAFF|^0FA4FF|^009EFF|^0094EF|^008BDF|^0081CF|^0077BF|           ^000000";
	set @PB$[10], "^4FBCFF|^3FB6FF|^2FB0FF|^1FAAFF|^0FA4FF|^009EFF|^0094EF|^008BDF|^0081CF|^0077BF|          ^000000";
	set @PB$[11], "^5FC2FF|^4FBCFF|^3FB6FF|^2FB0FF|^1FAAFF|^0FA4FF|^009EFF|^0094EF|^008BDF|^0081CF|^0077BF|         ^000000";
	set @PB$[12], "^6FC8FF|^5FC2FF|^4FBCFF|^3FB6FF|^2FB0FF|^1FAAFF|^0FA4FF|^009EFF|^0094EF|^008BDF|^0081CF|^0077BF|        ^000000";
	set @PB$[13], "^7FCCFF|^6FC8FF|^5FC2FF|^4FBCFF|^3FB6FF|^2FB0FF|^1FAAFF|^0FA4FF|^009EFF|^0094EF|^008BDF|^0081CF|^0077BF|       ^000000";
	set @PB$[14], "^8FD2FF|^7FCCFF|^6FC8FF|^5FC2FF|^4FBCFF|^3FB6FF|^2FB0FF|^1FAAFF|^0FA4FF|^009EFF|^0094EF|^008BDF|^0081CF|^0077BF|      ^000000";
	set @PB$[15], "^9FD8FF|^8FD2FF|^7FCCFF|^6FC8FF|^5FC2FF|^4FBCFF|^3FB6FF|^2FB0FF|^1FAAFF|^0FA4FF|^009EFF|^0094EF|^008BDF|^0081CF|^0077BF|     ^000000";
	set @PB$[16], "^AFDFFF|^9FD8FF|^8FD2FF|^7FCCFF|^6FC8FF|^5FC2FF|^4FBCFF|^3FB6FF|^2FB0FF|^1FAAFF|^0FA4FF|^009EFF|^0094EF|^008BDF|^0081CF|^0077BF|    ^000000";
	set @PB$[17], "^BFE5FF|^AFDFFF|^9FD8FF|^8FD2FF|^7FCCFF|^6FC8FF|^5FC2FF|^4FBCFF|^3FB6FF|^2FB0FF|^1FAAFF|^0FA4FF|^009EFF|^0094EF|^008BDF|^0081CF|^0077BF|   ^000000";
	set @PB$[18], "^CFEBFF|^BFE5FF|^AFDFFF|^9FD8FF|^8FD2FF|^7FCCFF|^6FC8FF|^5FC2FF|^4FBCFF|^3FB6FF|^2FB0FF|^1FAAFF|^0FA4FF|^009EFF|^0094EF|^008BDF|^0081CF|^0077BF|  ^000000";
	set @PB$[19], "^DFF1FF|^CFEBFF|^BFE5FF|^AFDFFF|^9FD8FF|^8FD2FF|^7FCCFF|^6FC8FF|^5FC2FF|^4FBCFF|^3FB6FF|^2FB0FF|^1FAAFF|^0FA4FF|^009EFF|^0094EF|^008BDF|^0081CF|^0077BF| ^000000";
	set @PB$[20], "^EFF8FF|^DFF1FF|^CFEBFF|^BFE5FF|^AFDFFF|^9FD8FF|^8FD2FF|^7FCCFF|^6FC8FF|^5FC2FF|^4FBCFF|^3FB6FF|^2FB0FF|^1FAAFF|^0FA4FF|^009EFF|^0094EF|^008BDF|^0081CF|^0077BF|^000000";
	
	// Calculates percentage
	set @total,$PA[1]+$PA[2]+$PA[3]+$PA[4]+$PA[5]+$PA[6]+$PA[7]+$PA[8]+$PA[9];
	set @PC[1],$PA[1]*100/@total;
	set @PC[2],$PA[2]*100/@total;
	set @PC[3],$PA[3]*100/@total;
	set @PC[4],$PA[4]*100/@total;
	set @PC[5],$PA[5]*100/@total;
	set @PC[6],$PA[6]*100/@total;
	set @PC[7],$PA[7]*100/@total;
	set @PC[8],$PA[8]*100/@total;
	set @PC[9],$PA[9]*100/@total;
	
	// Displays results
	if ($PQ$[1] != "") mes $PQ$[1];
	if ($PQ$[1] != "") mes "["+@PB$[@PC[1]/5]+"] " + $PA[1] + " ("+@PC[1]+"%)";
	if ($PQ$[2] != "") mes $PQ$[2];
	if ($PQ$[2] != "") mes "["+@PB$[@PC[2]/5]+"] " + $PA[2] + " ("+@PC[2]+"%)";
	if ($PQ$[3] != "") mes $PQ$[3];
	if ($PQ$[3] != "") mes "["+@PB$[@PC[3]/5]+"] " + $PA[3] + " ("+@PC[3]+"%)";
	if ($PQ$[4] != "") mes $PQ$[4];
	if ($PQ$[4] != "") mes "["+@PB$[@PC[4]/5]+"] " + $PA[4] + " ("+@PC[4]+"%)";
	if ($PQ$[5] != "") mes $PQ$[5];
	if ($PQ$[5] != "") mes "["+@PB$[@PC[5]/5]+"] " + $PA[5] + " ("+@PC[5]+"%)";
	if ($PQ$[6] != "") mes $PQ$[6];
	if ($PQ$[6] != "") mes "["+@PB$[@PC[6]/5]+"] " + $PA[6] + " ("+@PC[6]+"%)";
	if ($PQ$[7] != "") mes $PQ$[7];
	if ($PQ$[7] != "") mes "["+@PB$[@PC[7]/5]+"] " + $PA[7] + " ("+@PC[7]+"%)";
	if ($PQ$[8] != "") mes $PQ$[8];
	if ($PQ$[8] != "") mes "["+@PB$[@PC[8]/5]+"] " + $PA[8] + " ("+@PC[8]+"%)";
	if ($PQ$[9] != "") mes $PQ$[9];
	if ($PQ$[9] != "") mes "["+@PB$[@PC[9]/5]+"] " + $PA[9] + " ("+@PC[9]+"%)";
	mes "total de votos" + @total;
	if (getgmlevel() > 90) menu "Continuar",-,"Opción de encuesta de revisión",L_Edit,"Cuenta de encuesta de revisión",L_EditCount,"Añada la opción de encuesta",L_Add,"Juego nueva encuesta",L_SetQuestion,"Permita a revotación",L_ReVote;
	close;

// Vote menu
L_NotVoted:
	menu	$PQ$[1],P1,
			$PQ$[2],P2,
			$PQ$[3],P3,
			$PQ$[4],P4,
			$PQ$[5],P5,
			$PQ$[6],P6,
			$PQ$[7],P7,
			$PQ$[8],P8,
			$PQ$[9],P9,
			"Cancel",L_Cancel;
			
P1:	set @vote,1; goto P_Vote;
P2:	set @vote,2; goto P_Vote;
P3:	set @vote,3; goto P_Vote;
P4:	set @vote,4; goto P_Vote;
P5:	set @vote,5; goto P_Vote;
P6:	set @vote,6; goto P_Vote;
P7:	set @vote,7; goto P_Vote;
P8:	set @vote,8; goto P_Vote;
P9:	set @vote,9; goto P_Vote;

P_Vote:
	if ($PQ$[@vote] == "") goto L_Begin;
	
	set $PA[@vote],$PA[@vote]+1;
	set #pollid,$pollid;
	next;
	mes "[Poll]";
	mes "Thank you for your vote!";
	next;
	goto L_Begin;

// No question is set
L_NoQuestion:
	mes "[Poll]";
	mes "There is not any questions";
	if (getgmlevel() > 90) goto L_SetQuestion;
	close;

// Set question
L_SetQuestion:
	set $PQ$[1],"";
	set $PQ$[2],"";
	set $PQ$[3],"";
	set $PQ$[4],"";
	set $PQ$[5],"";
	set $PQ$[6],"";
	set $PQ$[7],"";
	set $PQ$[8],"";
	set $PQ$[9],"";
	set $PA[1],"";
	set $PA[2],"";
	set $PA[3],"";
	set $PA[4],"";
	set $PA[5],"";
	set $PA[6],"";
	set $PA[7],"";
	set $PA[8],"";
	set $PA[9],"";

	next;
	mes "[Poll]";
	mes "Game ask?";
	next;
	menu "Yes",-,"No",L_Cancel;
	
	input $poll_question$;
	set $pollid,rand (100000,999999);
	mes "Question System: " + $poll_question$;
	next;
	mes "[Poll]";
	mes "Options of entrance";
	mes "type at the end 'end' to top the questions";
	next;
	
	P_Set:
		input $PQ$[1];
		if ($PQ$[1] == "end") goto P_Set;	// Disallows no option poll
	P_Set2:
		input $PQ$[2];
		if ($PQ$[2] == "end") goto P_Set2; // Disallows 1 option poll
		input $PQ$[3];
		set @last,3;
		if ($PQ$[3] == "end") goto L_SetEnd;
		input $PQ$[4];
		set @last,4;
		if ($PQ$[4] == "end") goto L_SetEnd;
		input $PQ$[5];
		set @last,5;
		if ($PQ$[5] == "end") goto L_SetEnd;
		input $PQ$[6];
		set @last,6;
		if ($PQ$[6] == "end") goto L_SetEnd;
		input $PQ$[7];
		set @last,7;
		if ($PQ$[7] == "end") goto L_SetEnd;
		input $PQ$[8];
		set @last,8;
		if ($PQ$[8] == "end") goto L_SetEnd;
		input $PQ$[9];
		set @last,9;
		if ($PQ$[9] == "end") goto L_SetEnd;

// Add poll field
L_Add:
	next;
	mes "[Poll]";

	if ($PQ$[3] == "") goto PA3;
	if ($PQ$[4] == "") goto PA4;
	if ($PQ$[5] == "") goto PA5;
	if ($PQ$[6] == "") goto PA6;
	if ($PQ$[7] == "") goto PA7;
	if ($PQ$[8] == "") goto PA8;
	if ($PQ$[9] == "") goto PA9;
	
	mes "The options are fulled.";
	close;

	PA3:	set @add,3; goto L_Add2;
	PA4:	set @add,4; goto L_Add2;
	PA5:	set @add,5; goto L_Add2;
	PA6:	set @add,6; goto L_Add2;
	PA7:	set @add,7; goto L_Add2;
	PA8:	set @add,8; goto L_Add2;
	PA9:	set @add,9; goto L_Add2;
	
	L_Add2:
	mes "Enter the name of the votation that you want to add.";
	input $PQ$[@add];
	next;
	mes "[Poll]";
	mes "Option added";
	close;
	
// Edit poll count
L_EditCount:
	next;
	mes "[Poll]";
	mes "Wich option would you like to change?";
	next;
	menu	$PQ$[1],PEC1,
			$PQ$[2],PEC2,
			$PQ$[3],PEC3,
			$PQ$[4],PEC4,
			$PQ$[5],PEC5,
			$PQ$[6],PEC6,
			$PQ$[7],PEC7,
			$PQ$[8],PEC8,
			$PQ$[9],PEC9,
			"Cancel",L_Cancel;
	
	PEC1:	input $PA[1]; goto L_EditCountSet;
	PEC2:	input $PA[2]; goto L_EditCountSet;
	PEC3:	input $PA[3]; goto L_EditCountSet;
	PEC4:	input $PA[4]; goto L_EditCountSet;
	PEC5:	input $PA[5]; goto L_EditCountSet;
	PEC6:	input $PA[6]; goto L_EditCountSet;
	PEC7:	input $PA[7]; goto L_EditCountSet;
	PEC8:	input $PA[8]; goto L_EditCountSet;
	PEC9:	input $PA[9]; goto L_EditCountSet;
	
	L_EditCountSet:
		mes "[Poll]";
		mes "Opcion cambiada";
		close;
	
// Edit poll field
L_Edit:
	next;
	mes "[Poll]";
	mes "¿Wich option would you like to view?";
	next;
	menu	$PQ$[1],PE1,
			$PQ$[2],PE2,
			$PQ$[3],PE3,
			$PQ$[4],PE4,
			$PQ$[5],PE5,
			$PQ$[6],PE6,
			$PQ$[7],PE7,
			$PQ$[8],PE8,
			$PQ$[9],PE9,
			"Cancel",L_Cancel;
		
		PE1:	input $PQ$[1]; goto L_EditSet;
		PE2:	input $PQ$[2]; goto L_EditSet;
		PE3:	input $PQ$[3]; goto L_EditSet;
		PE4:	input $PQ$[4]; goto L_EditSet;
		PE5:	input $PQ$[5]; goto L_EditSet;
		PE6:	input $PQ$[6]; goto L_EditSet;
		PE7:	input $PQ$[7]; goto L_EditSet;
		PE8:	input $PQ$[8]; goto L_EditSet;
		PE9:	input $PQ$[9]; goto L_EditSet;

L_EditSet:
	mes "[Poll]";
	mes "Option changed";
	close;

L_SetEnd:
	Announce "There is a new poll!",8;
	Announce $poll_question$,8;
	set $PQ$[@last],"";
	mes "[Poll]";
	mes "System of the poll";
	close;

// Allow players to re-cast their vote
L_ReVote:
	next;
	set $pollid,rand (100000,999999);
	mes "[Poll]";
	mes "Re-vote allowed";
	close;
	
L_Cancel:
	mes "[Poll]";
	mes "Adios!!!";
	close;
}
Edited by Kido
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.01
  • Content Count:  276
  • Reputation:   24
  • Joined:  07/06/13
  • Last Seen:  

Sorry late reply, didnt see your reply earlier doing some other stuff. Anyways is it ok if we add new query for this poll of yours? Instead of using `ragnarok`.`login`? Because login might get messy. Actually cant open your script am receiving "OP Division by zero error" i think because we do have different svn version, anyways try to put this on your script, i think even not trying it should work fine.

 

I used two things for IP checking, the pool_count, the condition was:

if (getcharip(strcharinfo(0))==.@lip$ && .@poll==1)

Search: 

P_Vote:
	if ($PQ$[@vote] == "") goto L_Begin;
	
	set $PA[@vote],$PA[@vote]+1;
	set #pollid,$pollid;
	next;
	mes "[Poll]";
	mes "Thank you for your vote!";
	next;
	goto L_Begin;

Replace with:

        if ($PQ$[@vote] == "") goto L_Begin;
	
	set .@lip$,getcharip(strcharinfo(0));
	query_sql "SELECT `last_ip`,`poll` FROM `ragnarok`.`poll_system` WHERE `last_ip` = '" + escape_sql(.@lip$) + "'",.@lip$,.@poll;
	if(getgmlevel()<50) {	// You can remove this if you wanted, it will prevent all non-gm char from re-voting using the same ip.
		if (getcharip(strcharinfo(0))==.@lip$ && .@poll==1) 
		mes "Prohibiting voting at same `IP`"; 
		set #pollid,$pollid; 
		close;
	}	// Also it will not restrict any gm from revoting when using other IP's. You can also remove this condition if you wanted.	
	
	set $PA[@vote],$PA[@vote]+1;
	set #pollid,$pollid;
	set .@poll_count,1;
	query_sql ("INSERT INTO `ragnarok`.`poll_system` (`last_ip`,`poll`) VALUES ('"+escape_sql(.@lip$)+"','"+escape_sql(.@poll_count)+"')");
	next;
	mes "[Poll]";
	mes "Thank you for your vote!";
	next;
	goto L_Begin;

And in the end of the line, after:

L_Cancel:
	mes "[Poll]";
	mes "Adios!!!";
	close;

Add this line:(Dont replace the above line)

OnInit:
	query_sql "CREATE TABLE IF NOT EXISTS `ragnarok`.`poll_system` ( `last_ip` BINARY(9) NOT NULL, `poll` INT(1) NOT NULL DEFAULT '0')ENGINE = MYISAM";
end;

Tell me if its not working, alright? :)

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  127
  • Topics Per Day:  0.03
  • Content Count:  1445
  • Reputation:   163
  • Joined:  08/17/13
  • Last Seen:  

in my est server it worked but im having a problem D:!

 

i missclicked when i was about to start a new poll and just hitted cancel, and then the npc only gives 1 option wich is Cancel and i cant restart it D:!

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  49
  • Topics Per Day:  0.01
  • Content Count:  545
  • Reputation:   220
  • Joined:  03/01/13
  • Last Seen:  

I'm totally clueless on scripting, but I wish you the best of luck in fixing this issue. Nice to see someone who cares about player feedback.  /no1 

Best of luck resolving your issue,
~Azura Skyy

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.01
  • Content Count:  276
  • Reputation:   24
  • Joined:  07/06/13
  • Last Seen:  

Can you show me the screenshot? For me to know what where is the error, and also do screenshot in mapserv if you found one.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  127
  • Topics Per Day:  0.03
  • Content Count:  1445
  • Reputation:   163
  • Joined:  08/17/13
  • Last Seen:  

aw i can not for now, my players are conmnected (21) but i can give you a SS of the npc how it shows the option

 

ohzl.png

sorry for late answer too, university takes alot of time x_x

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.01
  • Content Count:  276
  • Reputation:   24
  • Joined:  07/06/13
  • Last Seen:  

Is this your L_NotVoted? Seems something is missing in your script, i tried the script now on my test server and it is working. We need to find the error in your mapserver.

L_NotVoted:
menu	$PQ$[1],P1,
$PQ$[2],P2,
$PQ$[3],P3,
$PQ$[4],P4,
$PQ$[5],P5,
$PQ$[6],P6,
$PQ$[7],P7,
$PQ$[8],P8,
$PQ$[9],P9,
"Cancel",L_Cancel;

P1:	set @vote,1; goto P_Vote;
P2:	set @vote,2; goto P_Vote;
P3:	set @vote,3; goto P_Vote;
P4:	set @vote,4; goto P_Vote;
P5:	set @vote,5; goto P_Vote;
P6:	set @vote,6; goto P_Vote;
P7:	set @vote,7; goto P_Vote;
P8:	set @vote,8; goto P_Vote;
P9:	set @vote,9; goto P_Vote;
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  127
  • Topics Per Day:  0.03
  • Content Count:  1445
  • Reputation:   163
  • Joined:  08/17/13
  • Last Seen:  

yeah that's it

try to do this:

 

start a new poll

put the question

dont add anyquestion, just type end or warp to anywhere

 

and you will get the error x_X

 

however you gave me a brilliant idea o:!

 

just to fix it, i can modify the canel button to make it give me the option of new poll, and then i will make one, when the script gets fixed i will return the script ot the normality, how can i do that o:?!

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.01
  • Content Count:  276
  • Reputation:   24
  • Joined:  07/06/13
  • Last Seen:  

Tweak the whole script, just translate it to your language.  :)

#1 Tweak: Removed #pollid,$pollid;

Instead of using #pollid to set restriction, I used query (`poll`,`ip`).

#2 Tweak: Full SQL support. 

#3 Tweak: Fix Divided by zero error.

#4 Tweak: Improve and Changed the Menu.

 - Add Option, Change Option, Delete Option, Recast Re-Vote, Edit Option Count, Reset Voter Count, Reset All(Including the Poll itself!)  :D

yeah that's it

try to do this:

 

start a new poll

put the question

dont add anyquestion, just type end or warp to anywhere

 

and you will get the error x_X

 

however you gave me a brilliant idea o:!

 

just to fix it, i can modify the canel button to make it give me the option of new poll, and then i will make one, when the script gets fixed i will return the script ot the normality, how can i do that o:?!

 

Heres the script.


 

poll.txt

Edited by Lil Troll
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  127
  • Topics Per Day:  0.03
  • Content Count:  1445
  • Reputation:   163
  • Joined:  08/17/13
  • Last Seen:  

the problem presist, i think i will have to restart over again the server, shutting down and turning it on, hope it helps

that is an awesome script o:!!! thanks!

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.

Guest
Answer this question...

×   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...