Jump to content

Question

Posted (edited)

i want out a npc for voting example

 

1- Renewal is better

2- Reborn is better

 

ppl vote for it

if u can with ip if u can't no prob

Edited by SpongeBOB

5 answers to this question

Recommended Posts

Posted

yesterday i was looking an npc like this and somebody recommended this survey Npc, i dont know if this is working with ip, but i know people can't vote twice with same account, when you set a new survey npc will announce it, its very nice try it:

 

//===== rAthena Script =======================================
//= Survey NPC
//===== By: ==================================================
//= Zafer
//===== Modified By: =========================================
// = Mysterious
//===== Current Version: =====================================
//= 1.6
//===== Compatible With: =====================================
//= rAthena SVN 
//===== Description: =========================================
//= Allow players to vote on a question through a Survey.
//===== Other Information: ===================================
// Gamemasters can create topics/questions while players are
// able to vote on such a question/topic. 
//===== Additional Comments: =================================
//= v1.0 - Intitial Re-release [Mysterious]
//= v1.1 - Language structures [Mysterious]
//= v1.2 - Added divisions [Mysterious]
//= v1.3 - Added proper information [Mysterious]
//= v1.4 - Structured the script better [Mysterious]
//= v1.5 - Fixed German wordings? [Mysterious]
//= v1.6 - Cleaning [Mysterious]
//============================================================
prontera,161,185,3	script	Survey NPC	831,{

set @np$,"[ ^7401DFSandra^000000 ]";
if ( getgmlevel() == 99 ) {
if ( $survey_running ) {
switch ( select ( "- Survey Result","- Delete Survey" ) ) {

        case 1:
			mes "- ^8A0808"+$survey_title$+"^000000 -";
			mes $survey_question$;
			mes "";
			for ( set @a,0; @a < getarraysize($survey_option$); set @a,@a+1 ) {
			mes "^0404B4"+$survey_option$[@a]+"^000000 - ^8A0808"+$survey_option_votes[@a]+"^000000 Vote/s";
			}
			close;
         case 2:
                mes @np$;
                mes "Are you sure that you want to delete the survey: ";
                mes "";
                mes "- ^8A0808"+$survey_title$+"^000000 -";
                next;
                if ( select ( "- No","- Yes, pretty sure" ) == 1 ) { close; }
                set $survey_running,0;
				set $survey_title$,"^8A0808NOT SET^000000"; 
				set $survey_question$,"";
				set @question_set$,"^8A0808NOT SET^000000";
				for ( set @b,0; @b <= getarraysize($survey_option$)+2; set @b,@b+1 ) {
				set $survey_option$[@b],"";
				set $survey_option_votes[@b],0;
				}
                mes @np$;
                mes "The survey has been deleted successfully.";
                close;
                }
                
		} // Ending bracket to Survey running

		if ( select ( "- Exit","- Create Survey" ) == 1 ) { close; }
		set $survey_title$,"^8A0808NOT SET^000000"; 
		set $survey_question$,"";
		set @question_set$,"^8A0808NOT SET^000000";
		for ( set @b,0; @b <= getarraysize($survey_option$); set @b,@b+1 ) {
		set $survey_option$[@b],"";}
		while ( 1 ) {
			set @subtract,2;
			if ( getarraysize($survey_option$) > 1 ) && ($survey_title$ != "NOT SET") && ( $survey_question$ != "NOT SET") { 
				set @menu_string$,"- Complete";
				set @menu_string$,@menu_string$+":Title [^04B404"+$survey_title$+"^000000]";
				set @subtract,3;
			} else {
				set @menu_string$,"Title [^04B404"+$survey_title$+"^000000]";
				}
			set @menu_string$,@menu_string$+":Question ["+@question_set$+"]";
			for ( set @a,0; @a < getarraysize($survey_option$); set @a,@a+1 ) {
				set @menu_string$,@menu_string$ +":    "+(@a+1)+". ^0404B4"+$survey_option$[@a]+"^000000";
				}
			set @menu_string$,@menu_string$ +":^0AE143+^000000 Add Option";
			mes @np$;
			mes "Do your Survey settings.";
			next;
			set @selected, select ( @menu_string$)-@subtract;
				if ( @selected == -2 ) {
					mes @np$;
					mes "Title:"; 
					mes "^04B404"+$survey_title$+"^000000";
					mes "Question:";
					mes "^04B404"+$survey_question$+"^000000";
					mes "Options:";
					for ( set @b,0; @b <= getarraysize($survey_option$)-1; set @b,@b+1 ) {
					mes (@b+1)+". ^0404B4"+$survey_option$[@b]+"^000000";
					}
				next;
				if (select( "- Not correct","- Correct" ) == 2 ) {
					mes @np$;
					mes "Your Survey started successfully";
					set $vote_id,$vote_id+1;
					set $survey_running,1;
					getmapxy(@map$,@x,@y,1);
					announce "Please see the Survey NPC in "+@map$+" and give us your Vote.",bc_all;
					close;
					}
				}

			if ( @selected == 0) { 
			mes @np$;
			mes "Type in the survey's leading question.";
			mes "";
			mes "Current:";
			if ( $survey_question$ == "" ) {
			mes "^8A0808NOT SET^000000";
				} else {
					mes "^04B404"+$survey_question$+"^000000"; }
					next;
					input $survey_question$;
					set @question_set$,"^0AE143SET^000000";
					}

			if ( @selected == -1) { 
				mes @np$;
				mes "Type in the survey title.";
				mes "";
				mes "Current:";
				mes "^04B404"+$survey_title$+"^000000";
				next;
				input $survey_title$;
				}

			if ( @selected == getarraysize($survey_option$)+1) { 
			mes @np$;
			mes "Type in a new option.";
			next;
			input $survey_option$[@selected-1];
			set @selected,@selected+1;
			}

		if ( @selected >= 1 ) && ( @selected < getarraysize($survey_option$)+1) {

		set @selected2, select ( "- Back","- Change","- Delete" );

          if ( @selected2 == 2 ) {
			mes @np$;
			mes "Type in the new option:";
			mes "";
			mes "Current:";
			mes "^0404B4"+$survey_option$[@selected-1]+"^000000";
			next;
			input $survey_option$[@selected-1];
		}
          if ( @selected2 == 3) {

			for ( set @a,@selected-1; @a < getarraysize($survey_option$)-1; set @a,@a+1 ) {
			set $survey_option$[@a],$survey_option$[@a+1];
		}
            set $survey_option$[@a],"";
		}
	}
}

end;
// =========================
// Gamemaster Settings-End
// =========================
} else {
// =========================
// Player's view
// =========================
	if ( !$survey_running ) { mes @np$; mes "There are no surveys running at the moment."; close; }
	if ( !getd("##survey_id_"+$vote_id) ) {
		mes @np$;
		mes "Please choose an option for the following Survey:";
		next;
		while (1) {
		mes "- ^8A0808"+$survey_title$+"^000000 -";
		mes "";
		mes $survey_question$;
		set @menu_string$,"";
		for ( set @a,0; @a < getarraysize($survey_option$); set @a,@a+1 ) {
		set @menu_string$,@menu_string$ +":"+(@a+1)+". ^0404B4"+$survey_option$[@a]+"^000000";
		}
	next;
	set @select, select ( @menu_string$ )-2;
	mes @np$;
	mes "Are you positive with your choice?";
	mes "";
	mes "- ^0404B4"+$survey_option$[@select]+"^000000 -";
	next;
	if ( select ( "- Nope","- Yeah" ) == 2 ) { 
		set getd("##survey_id_"+($vote_id-1)),0;
		set getd("##survey_id_"+$vote_id),1;
		set $survey_option_votes[@select],$survey_option_votes[@select]+1;
		mes @np$;
		mes "Thank you for your Vote.";
		next;
		break;
		}
	}
}
	if ( getd("##survey_id_"+$vote_id) ) {
		mes "- ^8A0808"+$survey_title$+"^000000 -";
		mes $survey_question$;
		mes "";
		for ( set @a,0; @a < getarraysize($survey_option$); set @a,@a+1 ) {
		mes "^0404B4"+$survey_option$[@a]+"^000000 - ^8A0808"+$survey_option_votes[@a]+"^000000 Vote/s";
		}
		close;
		}
	}
}// Ending bracket
  • 0
Posted (edited)

Wow i scripted that 13 years ago .. when i was 12. Nice to see that it is still in use. I released a lot of scripts during eAthena times. Does anybody know if there is any way to find them? this is the only one i can find via google =(

Edited by Zafer
forgot sth
  • 0
Posted
On 4/8/2017 at 4:03 PM, Zafer said:

Wow i scripted that 13 years ago .. when i was 12. Nice to see that it is still in use. I released a lot of scripts during eAthena times. Does anybody know if there is any way to find them? this is the only one i can find via google =(

Awesome. ?

  • 0
Posted
On 4/9/2017 at 6:03 AM, Zafer said:

Wow i scripted that 13 years ago .. when i was 12. Nice to see that it is still in use. I released a lot of scripts during eAthena times. Does anybody know if there is any way to find them? this is the only one i can find via google =(

Hi, I'm inspired! I'm 11 years old start developing a server now i'm 15 years old! ❤️

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...