Jump to content
  • 0

how to put announce and pub chat on Prize Giver NPC


fireicesurfer

Question


  • Group:  Members
  • Topic Count:  34
  • Topics Per Day:  0.02
  • Content Count:  101
  • Reputation:   3
  • Joined:  04/15/20
  • Last Seen:  

Hello guys. I keep on screwing this script.

Can you put announce and pubchat (waitingroom "Prize Giver",0;) on this npc please?

//======= 3ceam Script =======================================
//= Prize Giver NPC
//===== Modified By: =========================================
//= Keitenai
//===== Current Version: =====================================
//= 1.0
//===== Compatible With: =====================================
//= Athena Project
//===== Description: =========================================
//= Prize giver for single char, account and more.
//===== Additional Comments: =================================
//= 1.0 Modified Version for 3ceam compatibility
//============================================================

prontera,147,173,4	script	Server Reward	544,{
	//cutin "v_sprakki04",2;
	//Check if setups are loaded.
	if(!.Setup)
		{
			callsub OnLoadSetup;
		}

	//Show GM Panel if player is GM.
	if(getgmlevel() >= .GMin)
		menu("Take a prize as a player",-,"Give prize",
				OnManagement,"Reset Item Give",
				OnDelete,"IP Limit per Item",
				OnLimit);

	//Read attached player gifts from SQL table.
	if(select("Get Account Prize!:Get Character Prize!:Exit") == 1)
		{
			set .@query, query_sql("SELECT * FROM `" + .GiftTableName$ + "` WHERE account_id="+getcharid(3),
				.@gift_id,
				.@gift_account,
				.@gift_char,
				.@gift_item,
				.@gift_amount,
				.@gift_duration,
				.@gift_time
				); //Account gifts.
		}
		else if(@menu == 2)
		{
			set .@query, query_sql("SELECT * FROM `" + .GiftTableName$ + "` WHERE char_id="+getcharid(0),
				.@gift_id,
				.@gift_account,
				.@gift_char,
				.@gift_item,
				.@gift_amount,
				.@gift_duration,
				.@gift_time
				); //Char gifts.
		}
		else goto OnLeave;

	//Check if player don't have gifts.
	if(!.@query)
		{
			mes "[Reward Giver]";
			mes "Sorry, you don't have any prize";

			cutin "v_sprakki04",255;
			close;
		}

	//Build menu from query arrays.
		mes "[" + strnpcinfo(1) + "]";
		mes "^009900You got the prize^000000";
			for( set .@i, 0; .@i < .@query; set .@i, .@i + 1 )
			{
				mes "(" + .@gift_amount[.@i] + ") " + getitemname(.@gift_item[.@i]) + ".";
				set .@menu$, .@menu$ + getitemname(.@gift_item[.@i]) + ":";
			}
			next;
			set .@mid,select(.@menu$); //Show menu.
			set .@mid,.@mid-1;

	if (.@gift_time[.@mid] && .@gift_time[.@mid] < gettimetick(2))
	{
		mes "[Reward Giver]";
		mes "Sorry, this prize's claim time is already over.";

		cutin "v_sprakki04",255;
		close;
	}
	//Item is now selected. Choose what you want to do with it.
	mes "[" + strnpcinfo(1) + "]";
	mes "what you want do with (" + .@gift_amount[.@mid] + ") " + getitemname(.@gift_item[.@mid]) + "?";
	next;
	set .@Select,select("^009900Get it^000000:^ff0000Delete it! ^000000:nothings");

	//Receive gift selected.
	if(.@Select == 1)
	{
		//Check weight.
		if(checkweight( .@gift_item, .@gift_amount ) || .@gift_item[.@mid] == .ZenyID)
		{
			mes "[" + strnpcinfo(1) + "]";
			mes "^009900Get : (" + .@gift_amount[.@mid] + ") " + getitemname(.@gift_item[.@mid]) + ".^000000";
			if (.ip_limit)
			{
				// add ip_address to logs
				.@ipexist = query_sql("SELECT item_id, ip_address, claim_count FROM " + .GiftTableNameIP$ + " WHERE last_ip = (SELECT last_ip FROM login WHERE account_id="+getcharid(3)+") AND item_id = "+.@gift_item[.@mid]+" LIMIT 1", .@item,.@ip,.@claim_count);
				if (.@claim_count[0] >= .ip_limit)
				{
					next;
					mes "Sorry you have reached the maximum redeem limit for this IP address";
					cutin "v_sprakki04",255;
					close;
				}
				if (!.@claim_count[0])
				{
					query_sql("INSERT INTO " + .GiftTableNameIP$ + " (give_id,item_id,last_ip,claim_count) VALUES("+.@gift_id+","+.@gift_item+",'(SELECT last_ip FROM login WHERE account_id="+getcharid(3)+")',1)");		
				}
				else
				{
					query_sql("UPDATE " + .GiftTableNameIP$ + " SET claim_count = "+(.@claim_count[0]+1)+" WHERE item_id = "+.@gift_item[.@mid]+" AND last_ip = (SELECT last_ip FROM login WHERE account_id="+getcharid(3)+")");
				}
			}
			if (.@gift_item[.@mid] == .ZenyID) { // detects zeny ID and give zeny.
				if (Zeny+.@gift_amount[.@mid] > .MaxZeny)
				{
					mes "Please make sure that you have enough space to handle all these zennies and come back later.";
					cutin "v_sprakki04",255;
					close;
				}
				set Zeny,Zeny+.@gift_amount[.@mid];
			}
			else
			{
				if (!.@gift_duration)
				{
					getitem .@gift_item[.@mid], .@gift_amount[.@mid]; //Give item to player.
				}
				else
				{
					rentitem .@gift_item[.@mid], .@gift_duration * 60; 
				}
			}
			query_sql( "DELETE FROM `" + .GiftTableName$ + "` WHERE id = " + .@gift_id[.@mid] ); //Remove item from table.
			cutin "v_sprakki04",255;
			close;
		}
		else
		{
			//Overweight
			mes "^ff0000Sorry ^000000 You can't take it " + getitemname(.@gift_item[.@mid]);
			mes "Could lose some wight?";
			cutin "v_sprakki04",255;
			close;
		}
	}
	//Remove gift selected.
	else if(.@Select == 2) {
		mes "[" + strnpcinfo(1) + "]";
		mes "Are you sure you want dellet it?";
		mes "Gift: ("+.@gift_amount[.@mid]+") "+getitemname(.@gift_item[.@mid])+".";
		next;
		if(select("Yes:No") == 1) {
			mes "[" + strnpcinfo(1) + "]";
			mes "^ff0000Dellet: ("+.@gift_amount[.@mid]+") "+getitemname(.@gift_item[.@mid])+".^000000";
			query_sql("DELETE FROM `" + .GiftTableName$ + "` WHERE id = " + .@gift_id[.@mid]); //Remove item from table.
			cutin "v_sprakki04",255;
			close;
		} else {
			mes "[" + strnpcinfo(1) + "]";
			mes "we will save it";
			cutin "v_sprakki04",255;
			close;
		}
	}
	//Nothing selected.
	else
	{
		goto OnLeave;
	}

//GM Panel below:
OnManagement:
	if(getgmlevel() < .GMin) goto OnLeave;
	mes "[" + strnpcinfo(1) + "]";
	mes "Welvome " + strcharinfo(0) + "!";
	mes "How I can help you?";
	next;

	if(select("Make Gift:Nothing") != 1) goto OnLeave;

		//Make new gift.
		mes "[" + strnpcinfo(1) + "]";
		mes "Please input the item id.";
		mes "Default: 501";
	next;
		mes "What do you want to give?";
		set .@zenygive,0;
			if(select("Item:Zeny") == 1)
				{
					input .@new_item, 501, 30000;
				}
	next;
	mes "Do you want to add a claim timer?";
	if(select("No:Yes")==2)
	{
		next;
		mes "How many minutes do you want this reward to be claimable?";
		input(.@c);
		.@claimtime = gettimetick(2)+(.@c*60);
	}
	if(select("Continue:Cancel") != 1) goto OnLeave;
		mes "[" + strnpcinfo(1) + "]";
		mes "How many items/zeny?";
		mes "Default: 1";
	next;
	//item quantity range of 1 to 1,000.
	if(.@zenygive)
	{
		input .@new_value, 1, .MaxZeny;
	}
	else
	{
		input .@new_value, 1, 1000;
	}
	
	if(select("Continue:Cancel") != 1) goto OnLeave;
		mes "[" + strnpcinfo(1) + "]";
		mes "Please select input type:";
		mes "1. Single Account";
		mes "2. Single Character";
		mes "3. All ^009900Online^000000 Accounts.";
		mes "4. All Accounts.";
		mes "5. All ^009900Online^000000 Players/Characters.";
		mes "6. All Players/Characters.";
		mes "7. ^ff0000Cancel.^000000";
	next;
	switch(select("Single Account:Single Character:^009900Online^000000 Accounts:All Accounts:^009900Online^000000 Characters:All Characters:Cancel"))
	{
		//Account gift
		case 1:
			mes "[" + strnpcinfo(1) + "]";
			mes "Please select input type:";
			mes "By AID or Name?";
			next;
			if(select("Account ID:Character Name") == 1)
			{
				mes "[" + strnpcinfo(1) + "]";
				mes "Write account id:";
				next;
				input .@new_account, 2000000, 10000000; //Account id range from 2m to 10m.
				set .@query, query_sql("SELECT account_id FROM `" + .CharTableName$ + "` WHERE account_id = " + .@new_account, .@new_account);
				if(!.@query) goto OnNotExist;
				if(select("Continue:Cancel") != 1) goto OnLeave;
				mes "[" + strnpcinfo(1) + "]";
				mes "^009900Gift is ready to go!^000000";
				mes "AID: ^ff0000" + .@new_account + "^000000";
				mes "------------------";
				mes "Item: ^ff0000" + getitemname(.@new_item) + "^000000";
				mes "Quantity: ^ff0000" + .@new_value + "^000000";
				mes "Duration: " + .@duration + " Minutes";
				mes "Claim Time: " + .@c + " Minutes";
				next;
				if(select("Send Gift:Cancel") != 1) goto OnLeave;
				mes "[" + strnpcinfo(1) + "]";
				mes "Gift sending success!";
				//Create gift. <auto_id>, <account_id> <char_id> <item> <value>
				query_sql("INSERT INTO `" + .GiftTableName$ + "` (account_id, item, value, duration, timestamp) VALUES(" + .@new_account + ", " + .@new_item + ", " + .@new_value + ", " + .@duration + ", " + .@claimtime + ")");
			}
			else
			{
				mes "[" + strnpcinfo(1) + "]";
				mes "Write player name:";
				next;
				input .@new_name$;
				set .@query, query_sql("SELECT account_id FROM `" + .CharTableName$ + "` WHERE name = '" + .@new_name$ + "'", .@new_account);
				if(!.@query) goto OnNotExist;
				if(select("Continue:Cancel") != 1) goto OnLeave;
				mes "[" + strnpcinfo(1) + "]";
				mes "^009900Gift is ready to go!^000000";
				mes "AID: ^ff0000" + .@new_account + "^000000";
				mes "Name: ^ff0000"+ .@new_name$ + "^000000";
				mes "------------------";
				mes "Item: ^ff0000" + getitemname(.@new_item) + "^000000";
				mes "Quantity: ^ff0000" + .@new_value + "^000000";
				mes "Duration: " + .@duration + " Minutes";
				mes "Claim Time: " + .@c + " Minutes";
				next;
				if(select("Send Gift:Cancel") != 1) goto OnLeave;
				//Check if player is logged in.
				if(isloggedin(.@new_account)) {
					mes "[" + strnpcinfo(1) + "]";
					mes "Gift sending success!";
					query_sql("INSERT INTO `" + .GiftTableName$ + "` (account_id, item, value, duration, timestamp) VALUES(" + .@new_account + ", " + .@new_item + ", " + .@new_value + ", " + .@duration + ", " + .@claimtime + ")");
				} else {
					//Account was not online.
					mes "[" + strnpcinfo(1) + "]";
					mes "Gift sending success!";
					query_sql("INSERT INTO `" + .GiftTableName$ + "` (account_id, item, value, duration, timestamp) VALUES(" + .@new_account + ", " + .@new_item + ", " + .@new_value + ", " + .@duration + ", " + .@claimtime + ")"); // duplicate to other menus - continue here on giver side
				}
			}
			break;

		//Character gift.
		case 2:
			mes "[" + strnpcinfo(1) + "]";
			mes "Please select input type:";
			mes "By CID or Name?";
			next;
			if(select("Character ID:Character Name") == 1)
			{
				mes "[" + strnpcinfo(1) + "]";
				mes "Write character id:";
				next;
				input .@new_char,150000, 10000000; //Char id range from 150k to 10m.
				set .@query, query_sql("SELECT account_id, name FROM `" + .CharTableName$ + "` WHERE char_id = " + .@new_char, .@new_accountid, .@new_name$);
				if(!.@query) goto OnNotExist;
				if(select("Continue:Cancel") != 1) goto OnLeave;
					mes "[" + strnpcinfo(1) + "]";
					mes "^009900Gift is ready to go!^000000";
					mes "CID: ^ff0000" + .@new_char + "^000000";
					mes "Name: ^ff0000" + .@new_name$ + "^000000";
					mes "------------------";
					mes "Item: ^ff0000" + getitemname(.@new_item) + "^000000";
					mes "Quantity: ^ff0000" + .@new_value + "^000000";
					mes "Duration: " + .@duration + " Minutes";
					mes "Claim Time: " + .@c + " Minutes";
				next;
				if(select("Send Gift:Cancel") != 1) goto OnLeave;
				//Check if player is logged in.
				if(isloggedin(.@new_accountid)) {
					mes "[" + strnpcinfo(1) + "]";
					mes "Gift sending success!";

					//Create gift. <auto_id>, <account_id> <char_id> <item> <value>
					query_sql("INSERT INTO `" + .GiftTableName$ + "` (char_id, item, value, duration, timestamp) VALUES (" + .@new_char + ", " + .@new_item + ", " + .@new_value + "," + .@duration + "," + .@claimtime + ")");
				} else {
					//not online ask if we still give the gift.
					mes "[" + strnpcinfo(1) + "]";
					mes "The character is not online!";
					mes "Would you still like to send the gift?";
					next;
					if(select("Yes:No") != 1) goto OnLeave;
					mes "[" + strnpcinfo(1) + "]";
					mes "Gift sending success!";
					//Create gift. <auto_id>, <account_id> <char_id> <item> <value>
					query_sql("INSERT INTO `" + .GiftTableName$ + "` (char_id, item, value, duration, timestamp) VALUES (" + .@new_char + ", " + .@new_item + ", " + .@new_value + "," + .@duration + "," + .@claimtime + ")");
				}

			}
			else
			{
				mes "[" + strnpcinfo(1) + "]";
				mes "Write player name:";
				next;
				input .@new_name$;
				set .@query, query_sql("SELECT char_id, account_id FROM `" + .CharTableName$ + "` WHERE name = '" + .@new_name$ + "'", .@new_char, .@new_accountid);
				if(!.@query) goto OnNotExist;
				if(select("Continue:Cancel") != 1) goto OnLeave;
					mes "[" + strnpcinfo(1) + "]";
					mes "^009900Gift is ready to go!^000000";
					mes "CID: ^ff0000" + .@new_char + "^000000";
					mes "Name: ^ff0000"+ .@new_name$ + "^000000";
					mes "------------------";
					mes "Item: ^ff0000" + getitemname(.@new_item) + "^000000";
					mes "Quantity: ^ff0000" + .@new_value + "^000000";
					mes "Duration: " + .@duration + " Minutes";
					mes "Claim Time: " + .@c + " Minutes";
				next;
				if(select("Send Gift:Cancel") != 1) goto OnLeave;
				//Check if player is logged in.
				if(isloggedin(.@new_accountid))
				{
					mes "[" + strnpcinfo(1) + "]";
					mes "Gift sending success!";
					query_sql("INSERT INTO `" + .GiftTableName$ + "` (char_id, item, value, duration, timestamp) VALUES (" + .@new_char + ", " + .@new_item + ", " + .@new_value + "," + .@duration + "," + .@claimtime + ")");
				}
				else
				{
					//not online ask if we still give the gift.
					mes "[" + strnpcinfo(1) + "]";
					mes "The character is not online!";
					mes "Would you still like to give the gift?";
					next;
					if(select("Yes:No") != 1) goto OnLeave;
					mes "[" + strnpcinfo(1) + "]";
					mes "Gift sending success!";
					//Create gift. <auto_id>, <account_id> <char_id> <item> <value>
					query_sql("INSERT INTO `" + .GiftTableName$ + "` (char_id, item, value, duration, timestamp) VALUES (" + .@new_char + ", " + .@new_item + ", " + .@new_value + "," + .@duration + "," + .@claimtime + ")");
				}
			}
			announce strcharinfo(0)+" successfully sent " + .@new_value + "x " + getitemname(.@new_item) + " to " + .@new_name$,bc_all;
			break;

		//Register gift to all online accounts!
		case 3:
			mes "[" + strnpcinfo(1) + "]";
			mes "^009900Gift is ready to go!^000000";
			mes "Item: ^ff0000" + getitemname(.@new_item) + "^000000";
			mes "Quantity: ^ff0000" + .@new_value + "^000000";
			mes "Duration: " + .@duration + " Minutes";	
			mes "Claim Time: " + .@c + " Minutes";
			next;
			if(select("Send Gift:Cancel") != 1) goto OnLeave;
			mes "[" + strnpcinfo(1) + "]";
			mes "Please hold...";
			set .@c, 0; //Counting success.
			set .@query, query_sql("SELECT account_id FROM `"+.CharTableName$+"` WHERE online=1",.@account);
			for(set .@i, 0; .@i < .@query; set .@i, .@i + 1) {
				sleep2 25; //Slowdown the loop abit.
				.@at = query_sql("SELECT account_id, char_id FROM "+$GiftTableNameAT$+" WHERE account_id = "+.@account[.@i]+"", .@account_id, .@char_id); // check if in the table
				if (!.@at) {		
					query_sql("INSERT INTO `" + .GiftTableName$ + "` (account_id, item, value, duration, timestamp) VALUES(" + .@account[.@i] + ", " + .@new_item + ", " + .@new_value + ", " + .@duration + ", " + .@claimtime + ")");
				}
			}
			mes "Gift registered to (" + .@i + ") accounts!";
			break;

		//Register gift to all accounts!
		case 4:
			mes "[" + strnpcinfo(1) + "]";
			mes "^009900Gift is ready to go!^000000";
			mes "Item: ^ff0000" + getitemname(.@new_item) + "^000000";
			mes "Quantity: ^ff0000" + .@new_value + "^000000";
			mes "Claim Time: " + .@c + " Minutes";		
			next;
			if(select("Send Gift:Cancel") != 1) goto OnLeave;
			mes "[" + strnpcinfo(1) + "]";
			mes "Please hold...";
			set .@query, query_sql("SELECT account_id FROM `"+.LoginTableName$+"`",.@account);
			for(set .@i, 0; .@i < .@query; set .@i, .@i + 1) {
				sleep2 25; //Slowdown the loop abit.
					query_sql("INSERT INTO `" + .GiftTableName$ + "` (account_id, item, value, duration, timestamp) VALUES(" + .@account[.@i] + ", " + .@new_item + ", " + .@new_value + ", " + .@duration + ", " + .@claimtime + ")");
			}
			mes "Gift registered to (" + .@i + ") accounts!";
			break;

		//Register gift to all online characters!
		case 5:
			mes "[" + strnpcinfo(1) + "]";
			mes "^009900Gift is ready to go!^000000";
			mes "Item: ^ff0000" + getitemname(.@new_item) + "^000000";
			mes "Quantity: ^ff0000" + .@new_value + "^000000";
			mes "Claim Time: " + .@c + " Minutes";		
			next;
			if(select("Send Gift:Cancel") != 1) goto OnLeave;
			mes "[" + strnpcinfo(1) + "]";
			mes "Please hold...";
			set .@c, 0; //Counting success.
			set .@query, query_sql("SELECT char_id FROM `"+.CharTableName$+"` WHERE online=1",.@char);
			for(set .@i, 0; .@i < .@query; set .@i, .@i + 1) {
				sleep2 25; //Slowdown the loop abit.
				.@at = query_sql("SELECT account_id, char_id FROM "+$GiftTableNameAT$+" WHERE char_id = "+.@char[.@i]+"", .@account_id, .@char_id); // check if in the table
				if (!.@at) {
					query_sql("INSERT INTO `" + .GiftTableName$ + "` (char_id, item, value, duration, timestamp) VALUES (" + .@char[.@i] + ", " + .@new_item + ", " + .@new_value + "," + .@duration + "," + .@claimtime + ")");
				}
			}
			mes "Gift registered to (" + .@i + ") players!";
			break;

		//Register gift to all characters!
		case 6:
			mes "[" + strnpcinfo(1) + "]";
			mes "^009900Gift is ready to go!^000000";
			mes "Item: ^ff0000" + getitemname(.@new_item) + "^000000";
			mes "Quantity: ^ff0000" + .@new_value + "^000000";
			mes "Claim Time: " + .@c + " Minutes";	
			next;
			if(select("Send Gift:Cancel") != 1) goto OnLeave;
			mes "[" + strnpcinfo(1) + "]";
			mes "Please hold...";
			set .@query, query_sql("SELECT char_id FROM `"+.CharTableName$+"`",.@char);
			for(set .@i, 0; .@i < .@query; set .@i, .@i + 1) {
				sleep2 25; //Slowdown the loop abit.
				query_sql("INSERT INTO `" + .GiftTableName$ + "` (char_id, item, value, duration, timestamp) VALUES (" + .@char[.@i] + ", " + .@new_item + ", " + .@new_value + "," + .@duration + "," + .@claimtime + ")");
			}
			mes "Gift registered to (" + .@i + ") players!";
			break;

		//Cancel.
		Default:
				mes "[Reward Giver]";
				mes "See you later";
				break;
	}
	close;

OnLeave:
		mes "[Reward Giver]";
		mes "See you later";
		cutin "v_sprakki04",255;
		close;

OnNotExist:
		mes "[" + strnpcinfo(1) + "]";
		mes "This account does not exist!";
		cutin "v_sprakki04",255;
		close;
	
//============Reset Function=========================
OnDelete:
		mes "Which gifts do you want to reset?";
		mes "1. Single Account";
		mes "2. Single Character";
		mes "3. All ^009900Online^000000 Accounts.";
		mes "4. All Accounts.";
		mes "5. All ^009900Online^000000 Players/Characters.";
		mes "6. All Players/Characters.";
		mes "7. All cancel";
		switch(select("Single Account:Single Character:^009900Online^000000 Accounts:All Accounts:^009900Online^000000 Characters:All Characters:Specific Item:IPLimit Logs:Cancel"))
			{
			case 1: //Single Account
				mes "[" + strnpcinfo(1) + "]";
				mes "Please select input type:";
				mes "By AID or Name?";
				next;
				if(select("Account ID:Character Name") == 1)
				{
					mes "[" + strnpcinfo(1) + "]";
					mes "Write account id:";
					next;
					input .@new_account, 2000000, 10000000; //Account id range from 2m to 10m.
					set .@query, query_sql("SELECT account_id FROM `" + .CharTableName$ + "` WHERE account_id = " + .@new_account, .@new_account);
					if(!.@query) goto OnNotExist;
					if(select("Continue:Cancel") != 1) goto OnLeave;
						query_sql("DELETE FROM " + .GiftTableName$ + " WHERE account_id = " + .@new_account);
				}
				else
				{
					mes "[" + strnpcinfo(1) + "]";
					mes "Write player name:";
					next;
					input .@new_name$;
					set .@query, query_sql("SELECT account_id FROM `" + .CharTableName$ + "` WHERE name = '" + .@new_name$ + "'", .@new_account);
					if(!.@query) goto OnNotExist;
					if(select("Continue:Cancel") != 1) goto OnLeave;
						query_sql("DELETE FROM " + .GiftTableName$ + " WHERE account_id = " + .@new_account);
				}
				break;
			case 2: //Single Character
				mes "[" + strnpcinfo(1) + "]";
				mes "Please select input type:";
				mes "By CID or Name?";
				next;
				if(select("Character ID:Character Name") == 1)
				{
					mes "[" + strnpcinfo(1) + "]";
					mes "Write character id:";
					next;
					input .@new_char,150000, 10000000; //Char id range from 150k to 10m.
					set .@query, query_sql("SELECT account_id, name FROM `" + .CharTableName$ + "` WHERE char_id = " + .@new_char, .@new_accountid, .@new_name$);
					if(!.@query) goto OnNotExist;
					if(select("Continue:Cancel") != 1) goto OnLeave;
						query_sql("DELETE FROM " + .GiftTableName$ + " WHERE char_id = " + .@new_char);
				}
				else
				{
					mes "[" + strnpcinfo(1) + "]";
					mes "Write player name:";
					next;
					input .@new_name$;
					set .@query, query_sql("SELECT char_id, account_id FROM `" + .CharTableName$ + "` WHERE name = '" + .@new_name$ + "'", .@new_char, .@new_accountid);
					if(!.@query) goto OnNotExist;
					if(select("Continue:Cancel") != 1) goto OnLeave;
						query_sql("DELETE FROM " + .GiftTableName$ + " WHERE char_id = " + .@new_char);
				}
				break;
			case 3: //All Online Accounts.
				mes "[" + strnpcinfo(1) + "]";
				mes "Please hold...";
				set .@c, 0; //Counting success.
				set .@query, query_sql("SELECT account_id FROM `"+.CharTableName$+"` WHERE online=1",.@account);
				for(set .@i, 0; .@i < .@query; set .@i, .@i + 1) {
					sleep2 25; //Slowdown the loop abit.
					query_sql("DELETE FROM " + .GiftTableName$ + " WHERE account_id = " + .@account[.@i]);
				}
				break;
			case 4: //All Accounts.
				query_sql("DELETE FROM " + .GiftTableName$ + " WHERE account_id >= 1");
				break;
			case 5: //All Online Players/Characters.
				mes "[" + strnpcinfo(1) + "]";
				mes "Please hold...";
				set .@c, 0; //Counting success.
				set .@query, query_sql("SELECT char_id FROM `"+.CharTableName$+"` WHERE online=1",.@char);
				for(set .@i, 0; .@i < .@query; set .@i, .@i + 1)
					{
						sleep2 25; //Slowdown the loop abit.
						query_sql("DELETE FROM " + .GiftTableName$ + " WHERE char_id = " + .@char[.@i]);
					}
				break;
			case 6: //All Players/Characters.
				query_sql("TRUNCATE TABLE " + .GiftTableName$);
				break;
			case 7: // Delete specific item
				mes "Please type the id of the item you wish to delete";
				mes "This will delete all entries with the item id you typed";
				input(.@deletethis);
				next;
				mes "Are you sure you want to delete all entries of " + .@deletethis;
				if (select("Yes:No")==1)
					{
						query_sql("DELETE FROM " + .GiftTableName$ + " WHERE item = " + .@deletethis + "");
					}
					else
					{
						mes "Deletion cancelled";
						close;
					}
			case 8: //All ip logs
				query_sql("TRUNCATE TABLE " + .GiftTableNameIP$);
				break;
			default:
				break;
		}
		next;
		mes "deletion finished";
		cutin "v_sprakki04",255;
		close;

OnLimit:
	mes "Please enter an ip limit, current limit is " + .ip_limit;
	input(.ip_limit);
	mes "Done!";
	cutin "v_sprakki04",255;
	close;

//============================================================ 
// Config/Edit:
//============================================================ 
OnLoadSetup:
	set .Setup, 1;	//OnInit is loaded check.
	set .GMin, 60;	//Minimum GM level to use gm panel.
	set .ZenyID,23500; // put this when asked for which item to give zeny.
	set .MaxZeny,1000000000;
	//Your table names:
	set .CharTableName$, "char";	//Character table name(SQL).
	set .LoginTableName$, "login";
	set .GiftTableName$, "reward";	//Gift table name(SQL).
	set .GiftTableNameIP$, "reward_ip";	//Gift table name for ip tracker
	set $GiftTableNameAT$, "reward_at";	//Gift table name for auto trade tracker
	//Create gift table <auto_id>, <account_id>, <char_id>, <item>, <value>

	query_sql("CREATE TABLE IF NOT EXISTS `reward` (`id` int(11) NOT NULL AUTO_INCREMENT,`account_id` int(11) unsigned NOT NULL DEFAULT '0',`char_id` int(11) unsigned NOT NULL DEFAULT '0',`item` int(11) NOT NULL DEFAULT '0',`value` int(11) NOT NULL DEFAULT '0',`duration` int(11) NOT NULL DEFAULT '0',`timestamp` int(23) NOT NULL DEFAULT '0',PRIMARY KEY (`id`))");
	query_sql("CREATE TABLE IF NOT EXISTS `reward_ip` ( `give_id` int(11) NOT NULL,  `item_id` int(11) NOT NULL,  `ip_address` varchar(23) NOT NULL, `claim_count` int(11) NOT NULL,  PRIMARY KEY (`give_id`))");
	query_sql("CREATE TABLE IF NOT EXISTS `reward_at` (`account_id` int(11) NOT NULL,`char_id` int(11) NOT NULL)");
	return;

OnInit:
	callsub OnLoadSetup;
	end;
}

/* Manual table update for at tracker 
CREATE TABLE IF NOT EXISTS `reward_at` (
  `account_id` int(11) NOT NULL,
  `char_id` int(11) NOT NULL
);
*/
-	script	anti_trader	-1,{
	
OnInit:
	.is_anti_trade = 1; // 0 to disable
	end;
	
}
function	script	PG_30Seconds	{
	//dispbottom "anti trader 30sec";
	//Check if Vending (normal or @at)
	if(checkvending() >= 1)
	{
	   // mark as auto trader
	   	.@query = query_sql("SELECT account_id, char_id FROM "+$GiftTableNameAT$+" WHERE account_id = "+getcharid(3)+"", .@account_id, .@char_id); // check if in the table
		if (!.@query)
		{ // add if not there yet
			query_sql("INSERT INTO "+$GiftTableNameAT$+"(account_id,char_id) VALUES("+getcharid(3)+","+getcharid(0)+")");
			//dispbottom "you have been marked as auto trader";
			stopnpctimer;
			detachnpctimer;
			end;
		}
	}
	return;
}
function	script	PG_Login	{
	//dispbottom "at delete";
	.@query = query_sql("SELECT account_id, char_id FROM "+$GiftTableNameAT$+" WHERE account_id = "+getcharid(3)+"", .@account_id, .@char_id); // check if in the table
	if (.@query)
	{ // remove to reverify vending status
		query_sql("DELETE FROM "+$GiftTableNameAT$+" WHERE account_id = "+getcharid(3)+"");
	}
}

 

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  477
  • Reputation:   269
  • Joined:  06/13/17
  • Last Seen:  

1. Quest Board

//===== rAthena Script =======================================
//= tr0n's Questboard
//===== By: ==================================================
//= tr0n
//===== Current Version: =====================================
//= 1.6.5
//===== Description: =========================================
//= Easily add collection and hunting quests.
//===== Changelogs: ==========================================
// 1.0.0 Release
// 1.1.0 Added zeny reward
// 1.2.0 Rewrote checkmob and killcounter
// 1.3.1 Added level restriction
// 1.3.4 Added Reward Item Amount
// 1.4.4 Added Quest delay
// 1.5.4 Added repeatable Quests
// 1.6.4 Added party support
// 1.6.5 Bug fixes for party support
//============================================================
prontera,147,173,5	script	Event Monsters	676,{

	if(c_run==true){
		mes "[^FF7700Questboard^000000]";
		mes "^0000FF"+getd("." + currentquest$ + "_collectionname$")+"^000000";
		mes "--------------------------------";
		set .@size, getarraysize(getd("."+ currentquest$ + "_collectionitem"));
		for( set .@j, 0; .@j < .@size; set .@j,.@j+2){
			mes "^FF0000"+getitemname(getd("."+currentquest$+"_collectionitem["+.@j

+"]"))+" - "+countitem(getd("."+currentquest$+"_collectionitem["+.@j+"]"))+"/"+getd("."+currentquest

$+"_collectionitem["+(.@j+1)+"]")+" ea.^000000";
		}
		mes "--------------------------------";
		mes "[Reward]";
		mes "Item: ^0000FF"+((getd("." +currentquest$+"_collectionprize"))?getitemname(getd

("." +currentquest$+"_collectionprize"))+" - "+getd("." +currentquest$+"_collectionamount")+" 

ea.^000000":"Nothing^000000");
		mes "Zeny: ^0000FF"+getd("." +currentquest$+"_collectionzeny")+"^000000";
		mes "Base EXP: ^0000FF"+getd("." +currentquest$+"_collectionexp["+0+"]")+"^000000";
		mes "Job EXP: ^0000FF"+getd("." +currentquest$+"_collectionexp["+1+"]")+"^000000";
		next;
		if(select("Finish:Abort") == 2){
			mes "[^FF7700Questboard^000000]";
			mes "Quest aborted.";
			set currentquest$, "";
			set c_run, false;
			close;
		}
		goto L_checkitems;
	}

	if(h_run==true){
		mes "[^FF7700Questboard^000000]";
		mes "^0000FF"+getd("." + currentquest$ + "_huntingname$")+"^000000";
		mes "--------------------------------";
		set .@size, getarraysize(getd("."+ currentquest$ + "_huntingmob"));
		for( set .@j, 0; .@j < .@size; set .@j,.@j+2){
			set .@currentmob, getd("."+currentquest$+"_huntingmob["+(.@j)+"]");
			mes "^FF0000"+strmobinfo(1,getd("."+currentquest$+"_huntingmob["+.@j+"]"))+" 

- "+getd(currentquest$+"_"+.@currentmob+"_"+(.@j+1)+"_killcount")+"/"+getd("."+currentquest$

+"_huntingmob["+(.@j+1)+"]")+" ea.^000000";
		}
		mes "--------------------------------";
		mes "[Reward]";
		mes "Item: ^0000FF"+((getd("." +currentquest$+"_huntingprize"))?getitemname(getd("." 

+currentquest$+"_huntingprize"))+" - "+getd("." +currentquest$+"_huntingamount")+" 

ea.^000000":"Nothing^000000");
		mes "Zeny: ^0000FF"+getd("." +currentquest$+"_huntingzeny")+"^000000";
		mes "Base EXP: ^0000FF"+getd("." +currentquest$+"_huntingexp["+0+"]")+"^000000";
		mes "Job EXP: ^0000FF"+getd("." +currentquest$+"_huntingexp["+1+"]")+"^000000";
		next;
		if(select("Finish:Abort") == 2){
			mes "[^FF7700Questboard^000000]";
			mes "Quest aborted.";
			for(set .@x, 1; .@x < .@size; set .@x,.@x+2){
				set .@currentmob, getd("."+currentquest$+"_huntingmob["+(.@x-1)+"]");
				setd(currentquest$+"_"+.@currentmob+"_"+.@x+"_killcount", 0);
			}
			set currentquest$, "";
			set h_run, false;
			close;
		}
		goto L_checkmobs;
	}

	mes "[^FF7700Questboard^000000]";
	mes "Select category:";
	next;

	switch(select((.collection)?"Collection Quests":"",
				  (.hunting)?"Hunting Quests":"",
				  "Exit")) {

	case 1:
		set .@collectmenu$, "";
		for( set .@i,0; .@i < .collectionquestcount; set .@i,.@i+1){
			if (.@i) set .@collectmenu$,.@collectmenu$+":";
			set .@collectmenu$, .@collectmenu$ + "[" + getd("." +(.@i

+1)+"_collectionmin") + " - " + getd("." +(.@i+1)+"_collectionmax") + "] " + getd("." + (.@i+1) + 

"_collectionname$");
		}
		set .@selection,select(.@collectmenu$);
		if(.quest_repeat == true){
			if(gettimetick(2) < getd(.@selection + "_collection_delay")){
				set .@time_left, getd(.@selection + "_collection_delay")-gettimetick

(2);
				mes "[^FF7700Questboard^000000]";
				mes "You have to wait ^0000FF"+Time2Str(.@time_left)+"^000000 to do 

this quest again.";
				close;
			}
		}
		else{
			if(getd(.@selection + "_collection_repeat") == true){
				mes "[^FF7700Questboard^000000]";
				mes "You already did this quest.";
				mes "Please choose another one.";
				close;
			}
		}
		mes "[^FF7700Questboard^000000]";
		mes "^0000FF"+getd("." + .@selection + "_collectionname$")+"^000000";
		mes "--------------------------------";
		set .@size, getarraysize(getd("."+ .@selection + "_collectionitem"));
		for( set .@j, 0; .@j < .@size; set .@j,.@j+2){
			mes "^FF0000"+getitemname(getd("."+.@selection+"_collectionitem["+.@j+"]"))+" 

- "+getd("."+.@selection+"_collectionitem["+(.@j+1)+"]")+" ea.^000000";
		}
		mes "--------------------------------";
		mes "[Reward]";
		mes "Item: ^0000FF"+((getd("." +.@selection+"_collectionprize"))?getitemname(getd("." 

+.@selection+"_collectionprize"))+" - "+getd("." +.@selection+"_collectionamount")+" 

ea.^000000":"Nothing^000000");
		mes "Zeny: ^0000FF"+getd("." +.@selection+"_collectionzeny")+"^000000";
		mes "Base EXP: ^0000FF"+getd("." +.@selection+"_collectionexp["+0+"]")+"^000000";
		mes "Job EXP: ^0000FF"+getd("." +.@selection+"_collectionexp["+1+"]")+"^000000";
		next;
		if(select("Accept:Decline") == 2){
			close;
		}
		if(BaseLevel >= getd("." +.@selection+"_collectionmin") && BaseLevel <= getd("." 

+.@selection+"_collectionmax")){
			mes "[^FF7700Questboard^000000]";
			mes "Quest accepted.";
			set c_run, true;
			set currentquest$, .@selection;
			close;
		}
		else{
			mes "[^FF7700Questboard^000000]";
			mes "You don't have the required";
			mes "level to do this quest.";
			close;
		}

	case 2:
		set .@huntmenu$, "";
		for( set .@i,0; .@i < .huntingquestcount; set .@i,.@i+1){
			if (.@i) set .@huntmenu$,.@huntmenu$+":";
			set .@huntmenu$, .@huntmenu$ + "[" + getd("." +(.@i+1)+"_huntingmin") + " - " 

+ getd("." +(.@i+1)+"_huntingmax") + "] " + getd("." + (.@i+1) + "_huntingname$");
		}
		set .@selection,select(.@huntmenu$);
		if(.quest_repeat == true){
			if(gettimetick(2) < getd(.@selection + "_hunting_delay")){
				set .@time_left, getd(.@selection + "_hunting_delay")-gettimetick(2);
				mes "[^FF7700Questboard^000000]";
				mes "You have to wait ^0000FF"+Time2Str(.@time_left)+"^000000 to do 

this quest again.";
				close;
			}
		}
		else{
			if(getd(.@selection + "_hunting_repeat") == true){
				mes "[^FF7700Questboard^000000]";
				mes "You already did this quest.";
				mes "Please choose another one.";
				close;
			}
		}
		mes "[^FF7700Questboard^000000]";
		mes "^0000FF"+getd("." + .@selection + "_huntingname$")+"^000000";
		mes "--------------------------------";
		set .@size, getarraysize(getd("."+ .@selection + "_huntingmob"));
		for( set .@j, 0; .@j < .@size; set .@j,.@j+2){
			mes "^FF0000"+strmobinfo(1,getd("."+.@selection+"_huntingmob["+.@j+"]"))+" - 

"+getd("."+.@selection+"_huntingmob["+(.@j+1)+"]")+" ea.^000000";
		}
		mes "--------------------------------";
		mes "[Reward]";
		mes "Item: ^0000FF"+((getd("." +.@selection+"_huntingprize"))?getitemname(getd("." 

+.@selection+"_huntingprize"))+" - "+getd("." +.@selection+"_huntingamount")+" 

ea.^000000":"Nothing^000000");
		mes "Zeny: ^0000FF"+getd("." +.@selection+"_huntingzeny")+"^000000";
		mes "Base EXP: ^0000FF"+getd("." +.@selection+"_huntingexp["+0+"]")+"^000000";
		mes "Job EXP: ^0000FF"+getd("." +.@selection+"_huntingexp["+1+"]")+"^000000";
		next;
		if(select("Accept:Decline") == 2){
			close;
		}
		if(BaseLevel >= getd("." +.@selection+"_huntingmin") && BaseLevel <= getd("." 

+.@selection+"_huntingmax")){
			mes "[^FF7700Questboard^000000]";
			mes "Quest accepted.";
			set h_run, true;
			set currentquest$, .@selection;
			close;
		}
		else{
			mes "[^FF7700Questboard^000000]";
			mes "You don't have the required";
			mes "level to do this quest.";
			close;
		}

	case 3:
		close;
	}

L_checkitems:
	set .@size, getarraysize(getd("."+currentquest$+"_collectionitem"));
	for( set .@k,0; .@k < .@size; set .@k,.@k+2){
		if(countitem(getd("."+currentquest$+"_collectionitem["+.@k+"]"))>=getd

("."+currentquest$+"_collectionitem["+(.@k+1)+"]")){
			set .@checkitem,.@checkitem+2;
		}
	}
	if(.@checkitem<.@size){
		mes "[^FF7700Questboard^000000]";
		mes "You don't have everything.";
		close;
	}
	for( set .@delcount,0; .@delcount < .@size; set .@delcount,.@delcount+2){
		delitem getd("."+currentquest$+"_collectionitem["+.@delcount+"]"),getd

("."+currentquest$+"_collectionitem["+(.@delcount+1)+"]");
	}
	mes "[^FF7700Questboard^000000]";
	mes "Congratulation! Here is your Reward.";
	if(getd("." +currentquest$+"_collectionprize")!=0) getitem(getd("." +currentquest$

+"_collectionprize"),getd("." +currentquest$+"_collectionamount"));
	set Zeny,Zeny+getd("." +currentquest$+"_collectionzeny");
	getexp getd("." +currentquest$+"_collectionexp["+0+"]"),getd("." +currentquest$

+"_collectionexp["+1+"]");
	setd(currentquest$ + "_collection_delay"),gettimetick(2)+.quest_delay;
	setd(currentquest$ + "_collection_repeat"),true;
	set currentquest$, "";
	set c_run, false;
	close;

L_checkmobs:
	set .@size, getarraysize(getd("."+currentquest$+"_huntingmob"));
	set .@goal, .@size/2;
	for(set .@i, 1; .@i < .@size; set .@i,.@i+2){
		set .@currentmob, getd("."+currentquest$+"_huntingmob["+(.@i-1)+"]");
		if(getd(currentquest$+"_"+.@currentmob+"_"+.@i+"_killcount")==getd("."+currentquest$

+"_huntingmob["+.@i+"]")){
			set .@checkmonster, .@checkmonster+1;
			if(.@checkmonster==.@goal){
				goto L_checkmobs2;
			}
			continue;
		}
		goto L_checkmobs2;
	}

L_checkmobs2:
	if(.@checkmonster<.@goal){
		mes "[^FF7700Questboard^000000]";
		mes "You didn't kill everything.";
		close;
	}
	mes "[^FF7700Questboard^000000]";
	mes "Congratulation! Here is your Reward.";
	set .@size, getarraysize(getd("."+currentquest$+"_huntingmob"));
	for(set .@x, 1; .@x < .@size; set .@x,.@x+2){
		set .@currentmob, getd("."+currentquest$+"_huntingmob["+(.@x-1)+"]");
		setd(currentquest$+"_"+.@currentmob+"_"+.@x+"_killcount", 0);
	}
	if(getd("." +currentquest$+"_huntingprize")!=0) getitem(getd("." +currentquest$

+"_huntingprize"),getd("." +currentquest$+"_huntingamount"));
	set Zeny, Zeny+getd("." +currentquest$+"_huntingzeny");
	getexp getd("." +currentquest$+"_huntingexp["+0+"]"),getd("." +currentquest$+"_huntingexp

["+1+"]");
	setd(currentquest$ + "_hunting_delay"),gettimetick(2)+.quest_delay;
	setd(currentquest$ + "_hunting_repeat"),true;
	set currentquest$, "";
	set h_run, false;
	close;

OnNPCKillEvent:
	if(h_run!=true) end;
	set .@size, getarraysize(getd("."+currentquest$+"_huntingmob"));
	for(set .@i, 1; .@i < .@size; set .@i,.@i+2){
		if(killedrid==getd("."+currentquest$+"_huntingmob["+(.@i-1)+"]")){
			set .@currentmob, getd("."+currentquest$+"_huntingmob["+(.@i-1)+"]");
			if(getd(currentquest$+"_"+.@currentmob+"_"+.@i+"_killcount")<getd

("."+currentquest$+"_huntingmob["+.@i+"]")){
				setd(currentquest$+"_"+.@currentmob+"_"+.@i+"_killcount", getd

(currentquest$+"_"+.@currentmob+"_"+.@i+"_killcount")+1);
				dispbottom getd("."+currentquest$+"_huntingname$")+": ["+strmobinfo

(1,.@currentmob)+"] ("+ getd(currentquest$+"_"+.@currentmob+"_"+.@i+"_killcount")+"/"+getd

("."+currentquest$+"_huntingmob["+.@i+"]")+")";
			}
			if(getcharid(1) != 0 && .party_support == true){
				getmapxy(.@map1$,.@x1,.@y1);
				set .@killerid, getcharid(3);
				set .@currentquest$, currentquest$;
				getpartymember getcharid(1),1;
				getpartymember getcharid(1),2;
				for(set .@j, 0; .@j < $@partymembercount; .@j++){
					if(isloggedin($@partymemberaid[.@j], $@partymembercid[.@j])){
						if(h_run==true && $@partymemberaid[.@j] != .@killerid 

&& .@currentquest$ == getvar(currentquest$, $@partymembercid[.@j]) && readparam(HP, $@partymembercid

[.@j]) > 0){
							getmapxy(.@map2$,.@x2,.@y2,BL_PC,rid2name

($@partymemberaid[.@j]));
							if(.@map1$ == .@map2$ && distance

(.@x1,.@y1,.@x2,.@y2) < .party_range){
								set .@kill_amt,getvar(getd

(.@currentquest$+"_"+.@currentmob+"_"+.@i+"_killcount"), $@partymembercid[.@j]);
								set .@kill_goal,getd

("."+.@currentquest$+"_huntingmob["+.@i+"]");
								if(.@kill_amt<.@kill_goal)
								{
									setd(.@currentquest$

+"_"+.@currentmob+"_"+.@i+"_killcount", .@kill_amt+1, $@partymembercid[.@j]);
									dispbottom getd

("."+.@currentquest$+"_huntingname$")+": ["+strmobinfo(1,.@currentmob)+"] ("+(.@kill_amt

+1)+"/"+.@kill_goal+")", 0xB6FF00, $@partymembercid[.@j];
								}
							}
						}
					}
				}
			}
			break;
		}
	}
	end;

OnInit:
	waitingroom "Quest Board",0;
	function AddCollection;
	function AddHunting;

	//Activate/Deactivate quest categories (true/1 - activated, false/0 - deactivated)
	set .collection, false;
	set .hunting, true;

	//Quest Delay (seconds)
	//24 hours = 86400 seconds
	set .quest_delay, 0;

	//Activate/Deactivate repeatable quests (true/1 - activated, false/0 - deactivated)
	set .quest_repeat, true;

	//Activate/Deactivate party support (true/1 - activated, false/0 - deactivated)
	set .party_support, true;

	//Max range for party support (+- x & y coordinations)
	set .party_range, 25;

	//Checks if quests are loaded (prevents out of index)
	if(.questsloaded==true) end;
	set .questsloaded, true;

	//Add Collection Quests here (You can add as many required items as you want)
	//AddCollection("<Quest Name>",<Min Lvl>,<Max Lvl>,<Reward|Item ID>,<Reward|Item 

Amount>,<Zeny Reward>,<Base EXP>,<Job EXP>,<Item ID>,<Item Amount>,...);


	//Add Hunting Quests here (You can add as many required mobs as you want)
	//AddHunting("<Quest Name>",<Min Lvl>,<Max Lvl>,<Reward|Item ID>,<Reward|Item Amount>,<Zeny 

Reward>,<Base EXP>,<Job EXP>,<Monster ID>,<Monster Amount>,...);
	Addhunting("Mid-difficulty",1,99,7711,10,50000,50000,40000,1310,100);
	Addhunting("High-difficulty",1,99,7711,20,50000,100000,80000,1098,100);
	Addhunting("Extreme-difficulty",1,99,7711,30,100000,200000,160000,1833,100);
	end;


	function AddCollection{
		set .collectionquestcount,.collectionquestcount+1;
		setd ("." +.collectionquestcount+"_collectionname$", getarg(0));
		setd ("." +.collectionquestcount+"_collectionmin", getarg(1));
		setd ("." +.collectionquestcount+"_collectionmax", getarg(2));
		setd ("." +.collectionquestcount+"_collectionprize", getarg(3));
		setd ("." +.collectionquestcount+"_collectionamount", getarg(4));
		setd ("." +.collectionquestcount+"_collectionzeny", getarg(5));
		set .@argcount, 6;
		set .@size, getarraysize(getd("."+ .collectionquestcount + "_collectionexp"));
		setd ("." +.collectionquestcount+"_collectionexp["+.@size+"]",getarg(.@argcount)); 
		setd ("." +.collectionquestcount+"_collectionexp["+(.@size+1)+"]",getarg(.@argcount

+1)); 
		set .@argcount, .@argcount+2;
		set .@size, getarraysize(getd("."+ .collectionquestcount + "_collectionitem"));
		while(getarg(.@argcount,-1)!=-1 && getarg(.@argcount+1,-1)!=-1){
			setd ("."+.collectionquestcount+"_collectionitem["+.@size+"]",getarg

(.@argcount)); 
			setd ("."+.collectionquestcount+"_collectionitem["+(.@size+1)+"]",getarg

(.@argcount+1));
			set .@argcount,.@argcount+2;
			set .@size, .@size+2;
		}
		return;
	}

	function AddHunting{
		set .huntingquestcount,.huntingquestcount+1;
		setd ("." +.huntingquestcount+"_huntingname$", getarg(0));
		setd ("." +.huntingquestcount+"_huntingmin", getarg(1));
		setd ("." +.huntingquestcount+"_huntingmax", getarg(2));
		setd ("." +.huntingquestcount+"_huntingprize", getarg(3));
		setd ("." +.huntingquestcount+"_huntingamount", getarg(4));
		setd ("." +.huntingquestcount+"_huntingzeny", getarg(5));
		set .@size, getarraysize(getd("."+ .huntingquestcount + "_huntingexp"));
		set .@argcount, 6;
		setd ("." +.huntingquestcount+"_huntingexp["+.@size+"]",getarg(.@argcount));
		setd ("." +.huntingquestcount+"_huntingexp["+(.@size+1)+"]",getarg(.@argcount+1)); 
		set .@argcount, .@argcount+2;
		set .@size, getarraysize(getd("."+ .huntingquestcount + "_huntingmob"));
		while(getarg(.@argcount,-1)!=-1 && getarg(.@argcount+1,-1)!=-1){
			setd ("."+.huntingquestcount+"_huntingmob["+.@size+"]",getarg(.@argcount)); 
			setd ("."+.huntingquestcount+"_huntingmob["+(.@size+1)+"]",getarg(.@argcount

+1));
			set .@argcount, .@argcount+2;
			set .@size, .@size+2;
		}
		return;
	}
}

2. Prize Giver

//======= 3ceam Script =======================================
//= Prize Giver NPC
//===== Modified By: =========================================
//= Keitenai
//===== Current Version: =====================================
//= 1.0
//===== Compatible With: =====================================
//= Athena Project
//===== Description: =========================================
//= Prize giver for single char, account and more.
//===== Additional Comments: =================================
//= 1.0 Modified Version for 3ceam compatibility
//============================================================
prontera,141,175,4	script	Server Reward	113,{
	//cutin "v_sprakki04",2;
	//Check if setups are loaded.
	if(!.Setup)
		{
			callsub OnLoadSetup;
		}

	//Show GM Panel if player is GM.
	if(getgmlevel() >= .GMin)
		menu("Take a prize as a player",-,"Give prize",
				OnManagement,"Reset Item Give",
				OnDelete,"IP Limit per Item",
				OnLimit);

	//Read attached player gifts from SQL table.
	if(select("Get Account Prize!:Get Character Prize!:Exit") == 1)
		{
			set .@query, query_sql("SELECT * FROM `" + .GiftTableName$ + "` WHERE account_id="+getcharid(3),
				.@gift_id,
				.@gift_account,
				.@gift_char,
				.@gift_item,
				.@gift_amount,
				.@gift_duration,
				.@gift_time
				); //Account gifts.
		}
		else if(@menu == 2)
		{
			set .@query, query_sql("SELECT * FROM `" + .GiftTableName$ + "` WHERE char_id="+getcharid(0),
				.@gift_id,
				.@gift_account,
				.@gift_char,
				.@gift_item,
				.@gift_amount,
				.@gift_duration,
				.@gift_time
				); //Char gifts.
		}
		else goto OnLeave;

	//Check if player don't have gifts.
	if(!.@query)
		{
			mes "[Reward Giver]";
			mes "Sorry, you don't have any prize";

			cutin "v_sprakki04",255;
			close;
		}

	//Build menu from query arrays.
		mes "[" + strnpcinfo(1) + "]";
		mes "^009900You got the prize^000000";
			for( set .@i, 0; .@i < .@query; set .@i, .@i + 1 )
			{
				mes "(" + .@gift_amount[.@i] + ") " + getitemname(.@gift_item[.@i]) + ".";
				set .@menu$, .@menu$ + getitemname(.@gift_item[.@i]) + ":";
			}
			next;
			set .@mid,select(.@menu$); //Show menu.
			set .@mid,.@mid-1;

	if (.@gift_time[.@mid] && .@gift_time[.@mid] < gettimetick(2))
	{
		mes "[Reward Giver]";
		mes "Sorry, this prize's claim time is already over.";

		cutin "v_sprakki04",255;
		close;
	}
	//Item is now selected. Choose what you want to do with it.
	mes "[" + strnpcinfo(1) + "]";
	mes "what you want do with (" + .@gift_amount[.@mid] + ") " + getitemname(.@gift_item[.@mid]) + "?";
	next;
	set .@Select,select("^009900Get it^000000:^ff0000Delete it! ^000000:nothings");

	//Receive gift selected.
	if(.@Select == 1)
	{
		//Check weight.
		if(checkweight( .@gift_item, .@gift_amount ) || .@gift_item[.@mid] == .ZenyID)
		{
			mes "[" + strnpcinfo(1) + "]";
			mes "^009900Get : (" + .@gift_amount[.@mid] + ") " + getitemname(.@gift_item[.@mid]) + ".^000000";
			if (.ip_limit)
			{
				// add ip_address to logs
				.@ipexist = query_sql("SELECT item_id, ip_address, claim_count FROM " + .GiftTableNameIP$ + " WHERE last_ip = (SELECT last_ip FROM login WHERE account_id="+getcharid(3)+") AND item_id = "+.@gift_item[.@mid]+" LIMIT 1", .@item,.@ip,.@claim_count);
				if (.@claim_count[0] >= .ip_limit)
				{
					next;
					mes "Sorry you have reached the maximum redeem limit for this IP address";
					cutin "v_sprakki04",255;
					close;
				}
				if (!.@claim_count[0])
				{
					query_sql("INSERT INTO " + .GiftTableNameIP$ + " (give_id,item_id,last_ip,claim_count) VALUES("+.@gift_id+","+.@gift_item+",'(SELECT last_ip FROM login WHERE account_id="+getcharid(3)+")',1)");		
				}
				else
				{
					query_sql("UPDATE " + .GiftTableNameIP$ + " SET claim_count = "+(.@claim_count[0]+1)+" WHERE item_id = "+.@gift_item[.@mid]+" AND last_ip = (SELECT last_ip FROM login WHERE account_id="+getcharid(3)+")");
				}
			}
			if (.@gift_item[.@mid] == .ZenyID) { // detects zeny ID and give zeny.
				if (Zeny+.@gift_amount[.@mid] > .MaxZeny)
				{
					mes "Please make sure that you have enough space to handle all these zennies and come back later.";
					cutin "v_sprakki04",255;
					close;
				}
				set Zeny,Zeny+.@gift_amount[.@mid];
			}
			else
			{
				if (!.@gift_duration)
				{
					getitem .@gift_item[.@mid], .@gift_amount[.@mid]; //Give item to player.
				}
				else
				{
					rentitem .@gift_item[.@mid], .@gift_duration * 60; 
				}
			}
			query_sql( "DELETE FROM `" + .GiftTableName$ + "` WHERE id = " + .@gift_id[.@mid] ); //Remove item from table.
			cutin "v_sprakki04",255;
			close;
		}
		else
		{
			//Overweight
			mes "^ff0000Sorry ^000000 You can't take it " + getitemname(.@gift_item[.@mid]);
			mes "Could lose some wight?";
			cutin "v_sprakki04",255;
			close;
		}
	}
	//Remove gift selected.
	else if(.@Select == 2) {
		mes "[" + strnpcinfo(1) + "]";
		mes "Are you sure you want dellet it?";
		mes "Gift: ("+.@gift_amount[.@mid]+") "+getitemname(.@gift_item[.@mid])+".";
		next;
		if(select("Yes:No") == 1) {
			mes "[" + strnpcinfo(1) + "]";
			mes "^ff0000Dellet: ("+.@gift_amount[.@mid]+") "+getitemname(.@gift_item[.@mid])+".^000000";
			query_sql("DELETE FROM `" + .GiftTableName$ + "` WHERE id = " + .@gift_id[.@mid]); //Remove item from table.
			cutin "v_sprakki04",255;
			close;
		} else {
			mes "[" + strnpcinfo(1) + "]";
			mes "we will save it";
			cutin "v_sprakki04",255;
			close;
		}
	}
	//Nothing selected.
	else
	{
		goto OnLeave;
	}

//GM Panel below:
OnManagement:
	if(getgmlevel() < .GMin) goto OnLeave;
	mes "[" + strnpcinfo(1) + "]";
	mes "Welvome " + strcharinfo(0) + "!";
	mes "How I can help you?";
	next;

	if(select("Make Gift:Nothing") != 1) goto OnLeave;

		//Make new gift.
		mes "[" + strnpcinfo(1) + "]";
		mes "Please input the item id.";
		mes "Default: 501";
	next;
		mes "What do you want to give?";
		set .@zenygive,0;
			if(select("Item:Zeny") == 1)
				{
					input .@new_item, 501, 30000;
				}
	next;
	mes "Do you want to add a claim timer?";
	if(select("No:Yes")==2)
	{
		next;
		mes "How many minutes do you want this reward to be claimable?";
		input(.@c);
		.@claimtime = gettimetick(2)+(.@c*60);
	}
	if(select("Continue:Cancel") != 1) goto OnLeave;
		mes "[" + strnpcinfo(1) + "]";
		mes "How many items/zeny?";
		mes "Default: 1";
	next;
	//item quantity range of 1 to 1,000.
	if(.@zenygive)
	{
		input .@new_value, 1, .MaxZeny;
	}
	else
	{
		input .@new_value, 1, 1000;
	}
	
	if(select("Continue:Cancel") != 1) goto OnLeave;
		mes "[" + strnpcinfo(1) + "]";
		mes "Please select input type:";
		mes "1. Single Account";
		mes "2. Single Character";
		mes "3. All ^009900Online^000000 Accounts.";
		mes "4. All Accounts.";
		mes "5. All ^009900Online^000000 Players/Characters.";
		mes "6. All Players/Characters.";
		mes "7. ^ff0000Cancel.^000000";
	next;
	switch(select("Single Account:Single Character:^009900Online^000000 Accounts:All Accounts:^009900Online^000000 Characters:All Characters:Cancel"))
	{
		//Account gift
		case 1:
			mes "[" + strnpcinfo(1) + "]";
			mes "Please select input type:";
			mes "By AID or Name?";
			next;
			if(select("Account ID:Character Name") == 1)
			{
				mes "[" + strnpcinfo(1) + "]";
				mes "Write account id:";
				next;
				input .@new_account, 2000000, 10000000; //Account id range from 2m to 10m.
				set .@query, query_sql("SELECT account_id FROM `" + .CharTableName$ + "` WHERE account_id = " + .@new_account, .@new_account);
				if(!.@query) goto OnNotExist;
				if(select("Continue:Cancel") != 1) goto OnLeave;
				mes "[" + strnpcinfo(1) + "]";
				mes "^009900Gift is ready to go!^000000";
				mes "AID: ^ff0000" + .@new_account + "^000000";
				mes "------------------";
				mes "Item: ^ff0000" + getitemname(.@new_item) + "^000000";
				mes "Quantity: ^ff0000" + .@new_value + "^000000";
				mes "Duration: " + .@duration + " Minutes";
				mes "Claim Time: " + .@c + " Minutes";
				next;
				if(select("Send Gift:Cancel") != 1) goto OnLeave;
				mes "[" + strnpcinfo(1) + "]";
				mes "Gift sending success!";
				//Create gift. <auto_id>, <account_id> <char_id> <item> <value>
				query_sql("INSERT INTO `" + .GiftTableName$ + "` (account_id, item, value, duration, timestamp) VALUES(" + .@new_account + ", " + .@new_item + ", " + .@new_value + ", " + .@duration + ", " + .@claimtime + ")");
			}
			else
			{
				mes "[" + strnpcinfo(1) + "]";
				mes "Write player name:";
				next;
				input .@new_name$;
				set .@query, query_sql("SELECT account_id FROM `" + .CharTableName$ + "` WHERE name = '" + .@new_name$ + "'", .@new_account);
				if(!.@query) goto OnNotExist;
				if(select("Continue:Cancel") != 1) goto OnLeave;
				mes "[" + strnpcinfo(1) + "]";
				mes "^009900Gift is ready to go!^000000";
				mes "AID: ^ff0000" + .@new_account + "^000000";
				mes "Name: ^ff0000"+ .@new_name$ + "^000000";
				mes "------------------";
				mes "Item: ^ff0000" + getitemname(.@new_item) + "^000000";
				mes "Quantity: ^ff0000" + .@new_value + "^000000";
				mes "Duration: " + .@duration + " Minutes";
				mes "Claim Time: " + .@c + " Minutes";
				next;
				if(select("Send Gift:Cancel") != 1) goto OnLeave;
				//Check if player is logged in.
				if(isloggedin(.@new_account)) {
					mes "[" + strnpcinfo(1) + "]";
					mes "Gift sending success!";
					query_sql("INSERT INTO `" + .GiftTableName$ + "` (account_id, item, value, duration, timestamp) VALUES(" + .@new_account + ", " + .@new_item + ", " + .@new_value + ", " + .@duration + ", " + .@claimtime + ")");
				} else {
					//Account was not online.
					mes "[" + strnpcinfo(1) + "]";
					mes "Gift sending success!";
					query_sql("INSERT INTO `" + .GiftTableName$ + "` (account_id, item, value, duration, timestamp) VALUES(" + .@new_account + ", " + .@new_item + ", " + .@new_value + ", " + .@duration + ", " + .@claimtime + ")"); // duplicate to other menus - continue here on giver side
				}
			}
			break;

		//Character gift.
		case 2:
			mes "[" + strnpcinfo(1) + "]";
			mes "Please select input type:";
			mes "By CID or Name?";
			next;
			if(select("Character ID:Character Name") == 1)
			{
				mes "[" + strnpcinfo(1) + "]";
				mes "Write character id:";
				next;
				input .@new_char,150000, 10000000; //Char id range from 150k to 10m.
				set .@query, query_sql("SELECT account_id, name FROM `" + .CharTableName$ + "` WHERE char_id = " + .@new_char, .@new_accountid, .@new_name$);
				if(!.@query) goto OnNotExist;
				if(select("Continue:Cancel") != 1) goto OnLeave;
					mes "[" + strnpcinfo(1) + "]";
					mes "^009900Gift is ready to go!^000000";
					mes "CID: ^ff0000" + .@new_char + "^000000";
					mes "Name: ^ff0000" + .@new_name$ + "^000000";
					mes "------------------";
					mes "Item: ^ff0000" + getitemname(.@new_item) + "^000000";
					mes "Quantity: ^ff0000" + .@new_value + "^000000";
					mes "Duration: " + .@duration + " Minutes";
					mes "Claim Time: " + .@c + " Minutes";
				next;
				if(select("Send Gift:Cancel") != 1) goto OnLeave;
				//Check if player is logged in.
				if(isloggedin(.@new_accountid)) {
					mes "[" + strnpcinfo(1) + "]";
					mes "Gift sending success!";

					//Create gift. <auto_id>, <account_id> <char_id> <item> <value>
					query_sql("INSERT INTO `" + .GiftTableName$ + "` (char_id, item, value, duration, timestamp) VALUES (" + .@new_char + ", " + .@new_item + ", " + .@new_value + "," + .@duration + "," + .@claimtime + ")");
				} else {
					//not online ask if we still give the gift.
					mes "[" + strnpcinfo(1) + "]";
					mes "The character is not online!";
					mes "Would you still like to send the gift?";
					next;
					if(select("Yes:No") != 1) goto OnLeave;
					mes "[" + strnpcinfo(1) + "]";
					mes "Gift sending success!";
					//Create gift. <auto_id>, <account_id> <char_id> <item> <value>
					query_sql("INSERT INTO `" + .GiftTableName$ + "` (char_id, item, value, duration, timestamp) VALUES (" + .@new_char + ", " + .@new_item + ", " + .@new_value + "," + .@duration + "," + .@claimtime + ")");
				}

			}
			else
			{
				mes "[" + strnpcinfo(1) + "]";
				mes "Write player name:";
				next;
				input .@new_name$;
				set .@query, query_sql("SELECT char_id, account_id FROM `" + .CharTableName$ + "` WHERE name = '" + .@new_name$ + "'", .@new_char, .@new_accountid);
				if(!.@query) goto OnNotExist;
				if(select("Continue:Cancel") != 1) goto OnLeave;
					mes "[" + strnpcinfo(1) + "]";
					mes "^009900Gift is ready to go!^000000";
					mes "CID: ^ff0000" + .@new_char + "^000000";
					mes "Name: ^ff0000"+ .@new_name$ + "^000000";
					mes "------------------";
					mes "Item: ^ff0000" + getitemname(.@new_item) + "^000000";
					mes "Quantity: ^ff0000" + .@new_value + "^000000";
					mes "Duration: " + .@duration + " Minutes";
					mes "Claim Time: " + .@c + " Minutes";
				next;
				if(select("Send Gift:Cancel") != 1) goto OnLeave;
				//Check if player is logged in.
				if(isloggedin(.@new_accountid))
				{
					mes "[" + strnpcinfo(1) + "]";
					mes "Gift sending success!";
					query_sql("INSERT INTO `" + .GiftTableName$ + "` (char_id, item, value, duration, timestamp) VALUES (" + .@new_char + ", " + .@new_item + ", " + .@new_value + "," + .@duration + "," + .@claimtime + ")");
				}
				else
				{
					//not online ask if we still give the gift.
					mes "[" + strnpcinfo(1) + "]";
					mes "The character is not online!";
					mes "Would you still like to give the gift?";
					next;
					if(select("Yes:No") != 1) goto OnLeave;
					mes "[" + strnpcinfo(1) + "]";
					mes "Gift sending success!";
					//Create gift. <auto_id>, <account_id> <char_id> <item> <value>
					query_sql("INSERT INTO `" + .GiftTableName$ + "` (char_id, item, value, duration, timestamp) VALUES (" + .@new_char + ", " + .@new_item + ", " + .@new_value + "," + .@duration + "," + .@claimtime + ")");
				}
			}
			announce strcharinfo(0)+" successfully sent " + .@new_value + "x " + getitemname(.@new_item) + " to " + .@new_name$,bc_all;
			break;

		//Register gift to all online accounts!
		case 3:
			mes "[" + strnpcinfo(1) + "]";
			mes "^009900Gift is ready to go!^000000";
			mes "Item: ^ff0000" + getitemname(.@new_item) + "^000000";
			mes "Quantity: ^ff0000" + .@new_value + "^000000";
			mes "Duration: " + .@duration + " Minutes";	
			mes "Claim Time: " + .@c + " Minutes";
			next;
			if(select("Send Gift:Cancel") != 1) goto OnLeave;
			mes "[" + strnpcinfo(1) + "]";
			mes "Please hold...";
			set .@c, 0; //Counting success.
			set .@query, query_sql("SELECT account_id FROM `"+.CharTableName$+"` WHERE online=1",.@account);
			for(set .@i, 0; .@i < .@query; set .@i, .@i + 1) {
				sleep2 25; //Slowdown the loop abit.
				.@at = query_sql("SELECT account_id, char_id FROM "+$GiftTableNameAT$+" WHERE account_id = "+.@account[.@i]+"", .@account_id, .@char_id); // check if in the table
				if (!.@at) {		
					query_sql("INSERT INTO `" + .GiftTableName$ + "` (account_id, item, value, duration, timestamp) VALUES(" + .@account[.@i] + ", " + .@new_item + ", " + .@new_value + ", " + .@duration + ", " + .@claimtime + ")");
				}
			}
			mes "Gift registered to (" + .@i + ") accounts!";
			break;

		//Register gift to all accounts!
		case 4:
			mes "[" + strnpcinfo(1) + "]";
			mes "^009900Gift is ready to go!^000000";
			mes "Item: ^ff0000" + getitemname(.@new_item) + "^000000";
			mes "Quantity: ^ff0000" + .@new_value + "^000000";
			mes "Claim Time: " + .@c + " Minutes";		
			next;
			if(select("Send Gift:Cancel") != 1) goto OnLeave;
			mes "[" + strnpcinfo(1) + "]";
			mes "Please hold...";
			set .@query, query_sql("SELECT account_id FROM `"+.LoginTableName$+"`",.@account);
			for(set .@i, 0; .@i < .@query; set .@i, .@i + 1) {
				sleep2 25; //Slowdown the loop abit.
					query_sql("INSERT INTO `" + .GiftTableName$ + "` (account_id, item, value, duration, timestamp) VALUES(" + .@account[.@i] + ", " + .@new_item + ", " + .@new_value + ", " + .@duration + ", " + .@claimtime + ")");
			}
			mes "Gift registered to (" + .@i + ") accounts!";
			break;

		//Register gift to all online characters!
		case 5:
			mes "[" + strnpcinfo(1) + "]";
			mes "^009900Gift is ready to go!^000000";
			mes "Item: ^ff0000" + getitemname(.@new_item) + "^000000";
			mes "Quantity: ^ff0000" + .@new_value + "^000000";
			mes "Claim Time: " + .@c + " Minutes";		
			next;
			if(select("Send Gift:Cancel") != 1) goto OnLeave;
			mes "[" + strnpcinfo(1) + "]";
			mes "Please hold...";
			set .@c, 0; //Counting success.
			set .@query, query_sql("SELECT char_id FROM `"+.CharTableName$+"` WHERE online=1",.@char);
			for(set .@i, 0; .@i < .@query; set .@i, .@i + 1) {
				sleep2 25; //Slowdown the loop abit.
				.@at = query_sql("SELECT account_id, char_id FROM "+$GiftTableNameAT$+" WHERE char_id = "+.@char[.@i]+"", .@account_id, .@char_id); // check if in the table
				if (!.@at) {
					query_sql("INSERT INTO `" + .GiftTableName$ + "` (char_id, item, value, duration, timestamp) VALUES (" + .@char[.@i] + ", " + .@new_item + ", " + .@new_value + "," + .@duration + "," + .@claimtime + ")");
				}
			}
			mes "Gift registered to (" + .@i + ") players!";
			break;

		//Register gift to all characters!
		case 6:
			mes "[" + strnpcinfo(1) + "]";
			mes "^009900Gift is ready to go!^000000";
			mes "Item: ^ff0000" + getitemname(.@new_item) + "^000000";
			mes "Quantity: ^ff0000" + .@new_value + "^000000";
			mes "Claim Time: " + .@c + " Minutes";	
			next;
			if(select("Send Gift:Cancel") != 1) goto OnLeave;
			mes "[" + strnpcinfo(1) + "]";
			mes "Please hold...";
			set .@query, query_sql("SELECT char_id FROM `"+.CharTableName$+"`",.@char);
			for(set .@i, 0; .@i < .@query; set .@i, .@i + 1) {
				sleep2 25; //Slowdown the loop abit.
				query_sql("INSERT INTO `" + .GiftTableName$ + "` (char_id, item, value, duration, timestamp) VALUES (" + .@char[.@i] + ", " + .@new_item + ", " + .@new_value + "," + .@duration + "," + .@claimtime + ")");
			}
			mes "Gift registered to (" + .@i + ") players!";
			break;

		//Cancel.
		Default:
				mes "[Reward Giver]";
				mes "See you later";
				break;
	}
	close;

OnLeave:
		mes "[Reward Giver]";
		mes "See you later";
		cutin "v_sprakki04",255;
		close;

OnNotExist:
		mes "[" + strnpcinfo(1) + "]";
		mes "This account does not exist!";
		cutin "v_sprakki04",255;
		close;
	
//============Reset Function=========================
OnDelete:
		mes "Which gifts do you want to reset?";
		mes "1. Single Account";
		mes "2. Single Character";
		mes "3. All ^009900Online^000000 Accounts.";
		mes "4. All Accounts.";
		mes "5. All ^009900Online^000000 Players/Characters.";
		mes "6. All Players/Characters.";
		mes "7. All cancel";
		switch(select("Single Account:Single Character:^009900Online^000000 Accounts:All Accounts:^009900Online^000000 Characters:All Characters:Specific Item:IPLimit Logs:Cancel"))
			{
			case 1: //Single Account
				mes "[" + strnpcinfo(1) + "]";
				mes "Please select input type:";
				mes "By AID or Name?";
				next;
				if(select("Account ID:Character Name") == 1)
				{
					mes "[" + strnpcinfo(1) + "]";
					mes "Write account id:";
					next;
					input .@new_account, 2000000, 10000000; //Account id range from 2m to 10m.
					set .@query, query_sql("SELECT account_id FROM `" + .CharTableName$ + "` WHERE account_id = " + .@new_account, .@new_account);
					if(!.@query) goto OnNotExist;
					if(select("Continue:Cancel") != 1) goto OnLeave;
						query_sql("DELETE FROM " + .GiftTableName$ + " WHERE account_id = " + .@new_account);
				}
				else
				{
					mes "[" + strnpcinfo(1) + "]";
					mes "Write player name:";
					next;
					input .@new_name$;
					set .@query, query_sql("SELECT account_id FROM `" + .CharTableName$ + "` WHERE name = '" + .@new_name$ + "'", .@new_account);
					if(!.@query) goto OnNotExist;
					if(select("Continue:Cancel") != 1) goto OnLeave;
						query_sql("DELETE FROM " + .GiftTableName$ + " WHERE account_id = " + .@new_account);
				}
				break;
			case 2: //Single Character
				mes "[" + strnpcinfo(1) + "]";
				mes "Please select input type:";
				mes "By CID or Name?";
				next;
				if(select("Character ID:Character Name") == 1)
				{
					mes "[" + strnpcinfo(1) + "]";
					mes "Write character id:";
					next;
					input .@new_char,150000, 10000000; //Char id range from 150k to 10m.
					set .@query, query_sql("SELECT account_id, name FROM `" + .CharTableName$ + "` WHERE char_id = " + .@new_char, .@new_accountid, .@new_name$);
					if(!.@query) goto OnNotExist;
					if(select("Continue:Cancel") != 1) goto OnLeave;
						query_sql("DELETE FROM " + .GiftTableName$ + " WHERE char_id = " + .@new_char);
				}
				else
				{
					mes "[" + strnpcinfo(1) + "]";
					mes "Write player name:";
					next;
					input .@new_name$;
					set .@query, query_sql("SELECT char_id, account_id FROM `" + .CharTableName$ + "` WHERE name = '" + .@new_name$ + "'", .@new_char, .@new_accountid);
					if(!.@query) goto OnNotExist;
					if(select("Continue:Cancel") != 1) goto OnLeave;
						query_sql("DELETE FROM " + .GiftTableName$ + " WHERE char_id = " + .@new_char);
				}
				break;
			case 3: //All Online Accounts.
				mes "[" + strnpcinfo(1) + "]";
				mes "Please hold...";
				set .@c, 0; //Counting success.
				set .@query, query_sql("SELECT account_id FROM `"+.CharTableName$+"` WHERE online=1",.@account);
				for(set .@i, 0; .@i < .@query; set .@i, .@i + 1) {
					sleep2 25; //Slowdown the loop abit.
					query_sql("DELETE FROM " + .GiftTableName$ + " WHERE account_id = " + .@account[.@i]);
				}
				break;
			case 4: //All Accounts.
				query_sql("DELETE FROM " + .GiftTableName$ + " WHERE account_id >= 1");
				break;
			case 5: //All Online Players/Characters.
				mes "[" + strnpcinfo(1) + "]";
				mes "Please hold...";
				set .@c, 0; //Counting success.
				set .@query, query_sql("SELECT char_id FROM `"+.CharTableName$+"` WHERE online=1",.@char);
				for(set .@i, 0; .@i < .@query; set .@i, .@i + 1)
					{
						sleep2 25; //Slowdown the loop abit.
						query_sql("DELETE FROM " + .GiftTableName$ + " WHERE char_id = " + .@char[.@i]);
					}
				break;
			case 6: //All Players/Characters.
				query_sql("TRUNCATE TABLE " + .GiftTableName$);
				break;
			case 7: // Delete specific item
				mes "Please type the id of the item you wish to delete";
				mes "This will delete all entries with the item id you typed";
				input(.@deletethis);
				next;
				mes "Are you sure you want to delete all entries of " + .@deletethis;
				if (select("Yes:No")==1)
					{
						query_sql("DELETE FROM " + .GiftTableName$ + " WHERE item = " + .@deletethis + "");
					}
					else
					{
						mes "Deletion cancelled";
						close;
					}
			case 8: //All ip logs
				query_sql("TRUNCATE TABLE " + .GiftTableNameIP$);
				break;
			default:
				break;
		}
		next;
		mes "deletion finished";
		cutin "v_sprakki04",255;
		close;

OnLimit:
	mes "Please enter an ip limit, current limit is " + .ip_limit;
	input(.ip_limit);
	mes "Done!";
	cutin "v_sprakki04",255;
	close;

//============================================================ 
// Config/Edit:
//============================================================ 
OnLoadSetup:
	set .Setup, 1;	//OnInit is loaded check.
	set .GMin, 60;	//Minimum GM level to use gm panel.
	set .ZenyID,23500; // put this when asked for which item to give zeny.
	set .MaxZeny,1000000000;
	//Your table names:
	set .CharTableName$, "char";	//Character table name(SQL).
	set .LoginTableName$, "login";
	set .GiftTableName$, "reward";	//Gift table name(SQL).
	set .GiftTableNameIP$, "reward_ip";	//Gift table name for ip tracker
	set $GiftTableNameAT$, "reward_at";	//Gift table name for auto trade tracker
	//Create gift table <auto_id>, <account_id>, <char_id>, <item>, <value>

	query_sql("CREATE TABLE IF NOT EXISTS `reward` (`id` int(11) NOT NULL AUTO_INCREMENT,`account_id` int(11) unsigned NOT NULL DEFAULT '0',`char_id` int(11) unsigned NOT NULL DEFAULT '0',`item` int(11) NOT NULL DEFAULT '0',`value` int(11) NOT NULL DEFAULT '0',`duration` int(11) NOT NULL DEFAULT '0',`timestamp` int(23) NOT NULL DEFAULT '0',PRIMARY KEY (`id`))");
	query_sql("CREATE TABLE IF NOT EXISTS `reward_ip` ( `give_id` int(11) NOT NULL,  `item_id` int(11) NOT NULL,  `ip_address` varchar(23) NOT NULL, `claim_count` int(11) NOT NULL,  PRIMARY KEY (`give_id`))");
	query_sql("CREATE TABLE IF NOT EXISTS `reward_at` (`account_id` int(11) NOT NULL,`char_id` int(11) NOT NULL)");
	return;

OnInit:
      waitingroom "Prize Giver",0;
	callsub OnLoadSetup;
	end;
}

/* Manual table update for at tracker 
CREATE TABLE IF NOT EXISTS `reward_at` (
  `account_id` int(11) NOT NULL,
  `char_id` int(11) NOT NULL
);
*/
-	script	anti_trader	-1,{
	
OnInit:
	.is_anti_trade = 1; // 0 to disable
	end;
	
}
function	script	PG_30Seconds	{
	//dispbottom "anti trader 30sec";
	//Check if Vending (normal or @at)
	if(checkvending() >= 1)
	{
	   // mark as auto trader
	   	.@query = query_sql("SELECT account_id, char_id FROM "+$GiftTableNameAT$+" WHERE account_id = "+getcharid(3)+"", .@account_id, .@char_id); // check if in the table
		if (!.@query)
		{ // add if not there yet
			query_sql("INSERT INTO "+$GiftTableNameAT$+"(account_id,char_id) VALUES("+getcharid(3)+","+getcharid(0)+")");
			//dispbottom "you have been marked as auto trader";
			stopnpctimer;
			detachnpctimer;
			end;
		}
	}
	return;
}
function	script	PG_Login	{
	//dispbottom "at delete";
	.@query = query_sql("SELECT account_id, char_id FROM "+$GiftTableNameAT$+" WHERE account_id = "+getcharid(3)+"", .@account_id, .@char_id); // check if in the table
	if (.@query)
	{ // remove to reverify vending status
		query_sql("DELETE FROM "+$GiftTableNameAT$+" WHERE account_id = "+getcharid(3)+"");
	}
}

I only put Waitingroom due to the fact that your request for announcement is not precise or accurate. doesn't even know when you want to announce or what to announce..

As i've seen that you always Request for Waitingrooms.. you can do it by Looking for the OnInit of the script and add the line waitingroom.. if there's no OnInit, you can create one and add the OnInit: waitingroom end;

  • MVP 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  34
  • Topics Per Day:  0.02
  • Content Count:  101
  • Reputation:   3
  • Joined:  04/15/20
  • Last Seen:  

Requesting to edit my script to add 

OnInit:
waitingroom "Quest Board",0;
end;
}

OnInit:
waitingroom "Prize Giver",0;
end;
}

and global announce please

1, Quest Board

//===== rAthena Script =======================================
//= tr0n's Questboard
//===== By: ==================================================
//= tr0n
//===== Current Version: =====================================
//= 1.6.5
//===== Description: =========================================
//= Easily add collection and hunting quests.
//===== Changelogs: ==========================================
// 1.0.0 Release
// 1.1.0 Added zeny reward
// 1.2.0 Rewrote checkmob and killcounter
// 1.3.1 Added level restriction
// 1.3.4 Added Reward Item Amount
// 1.4.4 Added Quest delay
// 1.5.4 Added repeatable Quests
// 1.6.4 Added party support
// 1.6.5 Bug fixes for party support
//============================================================
prontera,147,173,5	script	Event Monsters	676,{

	if(c_run==true){
		mes "[^FF7700Questboard^000000]";
		mes "^0000FF"+getd("." + currentquest$ + "_collectionname$")+"^000000";
		mes "--------------------------------";
		set .@size, getarraysize(getd("."+ currentquest$ + "_collectionitem"));
		for( set .@j, 0; .@j < .@size; set .@j,.@j+2){
			mes "^FF0000"+getitemname(getd("."+currentquest$+"_collectionitem["+.@j

+"]"))+" - "+countitem(getd("."+currentquest$+"_collectionitem["+.@j+"]"))+"/"+getd("."+currentquest

$+"_collectionitem["+(.@j+1)+"]")+" ea.^000000";
		}
		mes "--------------------------------";
		mes "[Reward]";
		mes "Item: ^0000FF"+((getd("." +currentquest$+"_collectionprize"))?getitemname(getd

("." +currentquest$+"_collectionprize"))+" - "+getd("." +currentquest$+"_collectionamount")+" 

ea.^000000":"Nothing^000000");
		mes "Zeny: ^0000FF"+getd("." +currentquest$+"_collectionzeny")+"^000000";
		mes "Base EXP: ^0000FF"+getd("." +currentquest$+"_collectionexp["+0+"]")+"^000000";
		mes "Job EXP: ^0000FF"+getd("." +currentquest$+"_collectionexp["+1+"]")+"^000000";
		next;
		if(select("Finish:Abort") == 2){
			mes "[^FF7700Questboard^000000]";
			mes "Quest aborted.";
			set currentquest$, "";
			set c_run, false;
			close;
		}
		goto L_checkitems;
	}

	if(h_run==true){
		mes "[^FF7700Questboard^000000]";
		mes "^0000FF"+getd("." + currentquest$ + "_huntingname$")+"^000000";
		mes "--------------------------------";
		set .@size, getarraysize(getd("."+ currentquest$ + "_huntingmob"));
		for( set .@j, 0; .@j < .@size; set .@j,.@j+2){
			set .@currentmob, getd("."+currentquest$+"_huntingmob["+(.@j)+"]");
			mes "^FF0000"+strmobinfo(1,getd("."+currentquest$+"_huntingmob["+.@j+"]"))+" 

- "+getd(currentquest$+"_"+.@currentmob+"_"+(.@j+1)+"_killcount")+"/"+getd("."+currentquest$

+"_huntingmob["+(.@j+1)+"]")+" ea.^000000";
		}
		mes "--------------------------------";
		mes "[Reward]";
		mes "Item: ^0000FF"+((getd("." +currentquest$+"_huntingprize"))?getitemname(getd("." 

+currentquest$+"_huntingprize"))+" - "+getd("." +currentquest$+"_huntingamount")+" 

ea.^000000":"Nothing^000000");
		mes "Zeny: ^0000FF"+getd("." +currentquest$+"_huntingzeny")+"^000000";
		mes "Base EXP: ^0000FF"+getd("." +currentquest$+"_huntingexp["+0+"]")+"^000000";
		mes "Job EXP: ^0000FF"+getd("." +currentquest$+"_huntingexp["+1+"]")+"^000000";
		next;
		if(select("Finish:Abort") == 2){
			mes "[^FF7700Questboard^000000]";
			mes "Quest aborted.";
			for(set .@x, 1; .@x < .@size; set .@x,.@x+2){
				set .@currentmob, getd("."+currentquest$+"_huntingmob["+(.@x-1)+"]");
				setd(currentquest$+"_"+.@currentmob+"_"+.@x+"_killcount", 0);
			}
			set currentquest$, "";
			set h_run, false;
			close;
		}
		goto L_checkmobs;
	}

	mes "[^FF7700Questboard^000000]";
	mes "Select category:";
	next;

	switch(select((.collection)?"Collection Quests":"",
				  (.hunting)?"Hunting Quests":"",
				  "Exit")) {

	case 1:
		set .@collectmenu$, "";
		for( set .@i,0; .@i < .collectionquestcount; set .@i,.@i+1){
			if (.@i) set .@collectmenu$,.@collectmenu$+":";
			set .@collectmenu$, .@collectmenu$ + "[" + getd("." +(.@i

+1)+"_collectionmin") + " - " + getd("." +(.@i+1)+"_collectionmax") + "] " + getd("." + (.@i+1) + 

"_collectionname$");
		}
		set .@selection,select(.@collectmenu$);
		if(.quest_repeat == true){
			if(gettimetick(2) < getd(.@selection + "_collection_delay")){
				set .@time_left, getd(.@selection + "_collection_delay")-gettimetick

(2);
				mes "[^FF7700Questboard^000000]";
				mes "You have to wait ^0000FF"+Time2Str(.@time_left)+"^000000 to do 

this quest again.";
				close;
			}
		}
		else{
			if(getd(.@selection + "_collection_repeat") == true){
				mes "[^FF7700Questboard^000000]";
				mes "You already did this quest.";
				mes "Please choose another one.";
				close;
			}
		}
		mes "[^FF7700Questboard^000000]";
		mes "^0000FF"+getd("." + .@selection + "_collectionname$")+"^000000";
		mes "--------------------------------";
		set .@size, getarraysize(getd("."+ .@selection + "_collectionitem"));
		for( set .@j, 0; .@j < .@size; set .@j,.@j+2){
			mes "^FF0000"+getitemname(getd("."+.@selection+"_collectionitem["+.@j+"]"))+" 

- "+getd("."+.@selection+"_collectionitem["+(.@j+1)+"]")+" ea.^000000";
		}
		mes "--------------------------------";
		mes "[Reward]";
		mes "Item: ^0000FF"+((getd("." +.@selection+"_collectionprize"))?getitemname(getd("." 

+.@selection+"_collectionprize"))+" - "+getd("." +.@selection+"_collectionamount")+" 

ea.^000000":"Nothing^000000");
		mes "Zeny: ^0000FF"+getd("." +.@selection+"_collectionzeny")+"^000000";
		mes "Base EXP: ^0000FF"+getd("." +.@selection+"_collectionexp["+0+"]")+"^000000";
		mes "Job EXP: ^0000FF"+getd("." +.@selection+"_collectionexp["+1+"]")+"^000000";
		next;
		if(select("Accept:Decline") == 2){
			close;
		}
		if(BaseLevel >= getd("." +.@selection+"_collectionmin") && BaseLevel <= getd("." 

+.@selection+"_collectionmax")){
			mes "[^FF7700Questboard^000000]";
			mes "Quest accepted.";
			set c_run, true;
			set currentquest$, .@selection;
			close;
		}
		else{
			mes "[^FF7700Questboard^000000]";
			mes "You don't have the required";
			mes "level to do this quest.";
			close;
		}

	case 2:
		set .@huntmenu$, "";
		for( set .@i,0; .@i < .huntingquestcount; set .@i,.@i+1){
			if (.@i) set .@huntmenu$,.@huntmenu$+":";
			set .@huntmenu$, .@huntmenu$ + "[" + getd("." +(.@i+1)+"_huntingmin") + " - " 

+ getd("." +(.@i+1)+"_huntingmax") + "] " + getd("." + (.@i+1) + "_huntingname$");
		}
		set .@selection,select(.@huntmenu$);
		if(.quest_repeat == true){
			if(gettimetick(2) < getd(.@selection + "_hunting_delay")){
				set .@time_left, getd(.@selection + "_hunting_delay")-gettimetick(2);
				mes "[^FF7700Questboard^000000]";
				mes "You have to wait ^0000FF"+Time2Str(.@time_left)+"^000000 to do 

this quest again.";
				close;
			}
		}
		else{
			if(getd(.@selection + "_hunting_repeat") == true){
				mes "[^FF7700Questboard^000000]";
				mes "You already did this quest.";
				mes "Please choose another one.";
				close;
			}
		}
		mes "[^FF7700Questboard^000000]";
		mes "^0000FF"+getd("." + .@selection + "_huntingname$")+"^000000";
		mes "--------------------------------";
		set .@size, getarraysize(getd("."+ .@selection + "_huntingmob"));
		for( set .@j, 0; .@j < .@size; set .@j,.@j+2){
			mes "^FF0000"+strmobinfo(1,getd("."+.@selection+"_huntingmob["+.@j+"]"))+" - 

"+getd("."+.@selection+"_huntingmob["+(.@j+1)+"]")+" ea.^000000";
		}
		mes "--------------------------------";
		mes "[Reward]";
		mes "Item: ^0000FF"+((getd("." +.@selection+"_huntingprize"))?getitemname(getd("." 

+.@selection+"_huntingprize"))+" - "+getd("." +.@selection+"_huntingamount")+" 

ea.^000000":"Nothing^000000");
		mes "Zeny: ^0000FF"+getd("." +.@selection+"_huntingzeny")+"^000000";
		mes "Base EXP: ^0000FF"+getd("." +.@selection+"_huntingexp["+0+"]")+"^000000";
		mes "Job EXP: ^0000FF"+getd("." +.@selection+"_huntingexp["+1+"]")+"^000000";
		next;
		if(select("Accept:Decline") == 2){
			close;
		}
		if(BaseLevel >= getd("." +.@selection+"_huntingmin") && BaseLevel <= getd("." 

+.@selection+"_huntingmax")){
			mes "[^FF7700Questboard^000000]";
			mes "Quest accepted.";
			set h_run, true;
			set currentquest$, .@selection;
			close;
		}
		else{
			mes "[^FF7700Questboard^000000]";
			mes "You don't have the required";
			mes "level to do this quest.";
			close;
		}

	case 3:
		close;
	}

L_checkitems:
	set .@size, getarraysize(getd("."+currentquest$+"_collectionitem"));
	for( set .@k,0; .@k < .@size; set .@k,.@k+2){
		if(countitem(getd("."+currentquest$+"_collectionitem["+.@k+"]"))>=getd

("."+currentquest$+"_collectionitem["+(.@k+1)+"]")){
			set .@checkitem,.@checkitem+2;
		}
	}
	if(.@checkitem<.@size){
		mes "[^FF7700Questboard^000000]";
		mes "You don't have everything.";
		close;
	}
	for( set .@delcount,0; .@delcount < .@size; set .@delcount,.@delcount+2){
		delitem getd("."+currentquest$+"_collectionitem["+.@delcount+"]"),getd

("."+currentquest$+"_collectionitem["+(.@delcount+1)+"]");
	}
	mes "[^FF7700Questboard^000000]";
	mes "Congratulation! Here is your Reward.";
	if(getd("." +currentquest$+"_collectionprize")!=0) getitem(getd("." +currentquest$

+"_collectionprize"),getd("." +currentquest$+"_collectionamount"));
	set Zeny,Zeny+getd("." +currentquest$+"_collectionzeny");
	getexp getd("." +currentquest$+"_collectionexp["+0+"]"),getd("." +currentquest$

+"_collectionexp["+1+"]");
	setd(currentquest$ + "_collection_delay"),gettimetick(2)+.quest_delay;
	setd(currentquest$ + "_collection_repeat"),true;
	set currentquest$, "";
	set c_run, false;
	close;

L_checkmobs:
	set .@size, getarraysize(getd("."+currentquest$+"_huntingmob"));
	set .@goal, .@size/2;
	for(set .@i, 1; .@i < .@size; set .@i,.@i+2){
		set .@currentmob, getd("."+currentquest$+"_huntingmob["+(.@i-1)+"]");
		if(getd(currentquest$+"_"+.@currentmob+"_"+.@i+"_killcount")==getd("."+currentquest$

+"_huntingmob["+.@i+"]")){
			set .@checkmonster, .@checkmonster+1;
			if(.@checkmonster==.@goal){
				goto L_checkmobs2;
			}
			continue;
		}
		goto L_checkmobs2;
	}

L_checkmobs2:
	if(.@checkmonster<.@goal){
		mes "[^FF7700Questboard^000000]";
		mes "You didn't kill everything.";
		close;
	}
	mes "[^FF7700Questboard^000000]";
	mes "Congratulation! Here is your Reward.";
	set .@size, getarraysize(getd("."+currentquest$+"_huntingmob"));
	for(set .@x, 1; .@x < .@size; set .@x,.@x+2){
		set .@currentmob, getd("."+currentquest$+"_huntingmob["+(.@x-1)+"]");
		setd(currentquest$+"_"+.@currentmob+"_"+.@x+"_killcount", 0);
	}
	if(getd("." +currentquest$+"_huntingprize")!=0) getitem(getd("." +currentquest$

+"_huntingprize"),getd("." +currentquest$+"_huntingamount"));
	set Zeny, Zeny+getd("." +currentquest$+"_huntingzeny");
	getexp getd("." +currentquest$+"_huntingexp["+0+"]"),getd("." +currentquest$+"_huntingexp

["+1+"]");
	setd(currentquest$ + "_hunting_delay"),gettimetick(2)+.quest_delay;
	setd(currentquest$ + "_hunting_repeat"),true;
	set currentquest$, "";
	set h_run, false;
	close;

OnNPCKillEvent:
	if(h_run!=true) end;
	set .@size, getarraysize(getd("."+currentquest$+"_huntingmob"));
	for(set .@i, 1; .@i < .@size; set .@i,.@i+2){
		if(killedrid==getd("."+currentquest$+"_huntingmob["+(.@i-1)+"]")){
			set .@currentmob, getd("."+currentquest$+"_huntingmob["+(.@i-1)+"]");
			if(getd(currentquest$+"_"+.@currentmob+"_"+.@i+"_killcount")<getd

("."+currentquest$+"_huntingmob["+.@i+"]")){
				setd(currentquest$+"_"+.@currentmob+"_"+.@i+"_killcount", getd

(currentquest$+"_"+.@currentmob+"_"+.@i+"_killcount")+1);
				dispbottom getd("."+currentquest$+"_huntingname$")+": ["+strmobinfo

(1,.@currentmob)+"] ("+ getd(currentquest$+"_"+.@currentmob+"_"+.@i+"_killcount")+"/"+getd

("."+currentquest$+"_huntingmob["+.@i+"]")+")";
			}
			if(getcharid(1) != 0 && .party_support == true){
				getmapxy(.@map1$,.@x1,.@y1);
				set .@killerid, getcharid(3);
				set .@currentquest$, currentquest$;
				getpartymember getcharid(1),1;
				getpartymember getcharid(1),2;
				for(set .@j, 0; .@j < $@partymembercount; .@j++){
					if(isloggedin($@partymemberaid[.@j], $@partymembercid[.@j])){
						if(h_run==true && $@partymemberaid[.@j] != .@killerid 

&& .@currentquest$ == getvar(currentquest$, $@partymembercid[.@j]) && readparam(HP, $@partymembercid

[.@j]) > 0){
							getmapxy(.@map2$,.@x2,.@y2,BL_PC,rid2name

($@partymemberaid[.@j]));
							if(.@map1$ == .@map2$ && distance

(.@x1,.@y1,.@x2,.@y2) < .party_range){
								set .@kill_amt,getvar(getd

(.@currentquest$+"_"+.@currentmob+"_"+.@i+"_killcount"), $@partymembercid[.@j]);
								set .@kill_goal,getd

("."+.@currentquest$+"_huntingmob["+.@i+"]");
								if(.@kill_amt<.@kill_goal)
								{
									setd(.@currentquest$

+"_"+.@currentmob+"_"+.@i+"_killcount", .@kill_amt+1, $@partymembercid[.@j]);
									dispbottom getd

("."+.@currentquest$+"_huntingname$")+": ["+strmobinfo(1,.@currentmob)+"] ("+(.@kill_amt

+1)+"/"+.@kill_goal+")", 0xB6FF00, $@partymembercid[.@j];
								}
							}
						}
					}
				}
			}
			break;
		}
	}
	end;

OnInit:
	
	function AddCollection;
	function AddHunting;

	//Activate/Deactivate quest categories (true/1 - activated, false/0 - deactivated)
	set .collection, false;
	set .hunting, true;

	//Quest Delay (seconds)
	//24 hours = 86400 seconds
	set .quest_delay, 0;

	//Activate/Deactivate repeatable quests (true/1 - activated, false/0 - deactivated)
	set .quest_repeat, true;

	//Activate/Deactivate party support (true/1 - activated, false/0 - deactivated)
	set .party_support, true;

	//Max range for party support (+- x & y coordinations)
	set .party_range, 25;

	//Checks if quests are loaded (prevents out of index)
	if(.questsloaded==true) end;
	set .questsloaded, true;

	//Add Collection Quests here (You can add as many required items as you want)
	//AddCollection("<Quest Name>",<Min Lvl>,<Max Lvl>,<Reward|Item ID>,<Reward|Item 

Amount>,<Zeny Reward>,<Base EXP>,<Job EXP>,<Item ID>,<Item Amount>,...);


	//Add Hunting Quests here (You can add as many required mobs as you want)
	//AddHunting("<Quest Name>",<Min Lvl>,<Max Lvl>,<Reward|Item ID>,<Reward|Item Amount>,<Zeny 

Reward>,<Base EXP>,<Job EXP>,<Monster ID>,<Monster Amount>,...);
	Addhunting("Mid-difficulty",1,99,7711,10,50000,50000,40000,1310,100);
	Addhunting("High-difficulty",1,99,7711,20,50000,100000,80000,1098,100);
	Addhunting("Extreme-difficulty",1,99,7711,30,100000,200000,160000,1833,100);
	end;


	function AddCollection{
		set .collectionquestcount,.collectionquestcount+1;
		setd ("." +.collectionquestcount+"_collectionname$", getarg(0));
		setd ("." +.collectionquestcount+"_collectionmin", getarg(1));
		setd ("." +.collectionquestcount+"_collectionmax", getarg(2));
		setd ("." +.collectionquestcount+"_collectionprize", getarg(3));
		setd ("." +.collectionquestcount+"_collectionamount", getarg(4));
		setd ("." +.collectionquestcount+"_collectionzeny", getarg(5));
		set .@argcount, 6;
		set .@size, getarraysize(getd("."+ .collectionquestcount + "_collectionexp"));
		setd ("." +.collectionquestcount+"_collectionexp["+.@size+"]",getarg(.@argcount)); 
		setd ("." +.collectionquestcount+"_collectionexp["+(.@size+1)+"]",getarg(.@argcount

+1)); 
		set .@argcount, .@argcount+2;
		set .@size, getarraysize(getd("."+ .collectionquestcount + "_collectionitem"));
		while(getarg(.@argcount,-1)!=-1 && getarg(.@argcount+1,-1)!=-1){
			setd ("."+.collectionquestcount+"_collectionitem["+.@size+"]",getarg

(.@argcount)); 
			setd ("."+.collectionquestcount+"_collectionitem["+(.@size+1)+"]",getarg

(.@argcount+1));
			set .@argcount,.@argcount+2;
			set .@size, .@size+2;
		}
		return;
	}

	function AddHunting{
		set .huntingquestcount,.huntingquestcount+1;
		setd ("." +.huntingquestcount+"_huntingname$", getarg(0));
		setd ("." +.huntingquestcount+"_huntingmin", getarg(1));
		setd ("." +.huntingquestcount+"_huntingmax", getarg(2));
		setd ("." +.huntingquestcount+"_huntingprize", getarg(3));
		setd ("." +.huntingquestcount+"_huntingamount", getarg(4));
		setd ("." +.huntingquestcount+"_huntingzeny", getarg(5));
		set .@size, getarraysize(getd("."+ .huntingquestcount + "_huntingexp"));
		set .@argcount, 6;
		setd ("." +.huntingquestcount+"_huntingexp["+.@size+"]",getarg(.@argcount));
		setd ("." +.huntingquestcount+"_huntingexp["+(.@size+1)+"]",getarg(.@argcount+1)); 
		set .@argcount, .@argcount+2;
		set .@size, getarraysize(getd("."+ .huntingquestcount + "_huntingmob"));
		while(getarg(.@argcount,-1)!=-1 && getarg(.@argcount+1,-1)!=-1){
			setd ("."+.huntingquestcount+"_huntingmob["+.@size+"]",getarg(.@argcount)); 
			setd ("."+.huntingquestcount+"_huntingmob["+(.@size+1)+"]",getarg(.@argcount

+1));
			set .@argcount, .@argcount+2;
			set .@size, .@size+2;
		}
		return;
	}
}

2. Prize Giver

//======= 3ceam Script =======================================
//= Prize Giver NPC
//===== Modified By: =========================================
//= Keitenai
//===== Current Version: =====================================
//= 1.0
//===== Compatible With: =====================================
//= Athena Project
//===== Description: =========================================
//= Prize giver for single char, account and more.
//===== Additional Comments: =================================
//= 1.0 Modified Version for 3ceam compatibility
//============================================================
prontera,141,175,4	script	Server Reward	113,{
	//cutin "v_sprakki04",2;
	//Check if setups are loaded.
	if(!.Setup)
		{
			callsub OnLoadSetup;
		}

	//Show GM Panel if player is GM.
	if(getgmlevel() >= .GMin)
		menu("Take a prize as a player",-,"Give prize",
				OnManagement,"Reset Item Give",
				OnDelete,"IP Limit per Item",
				OnLimit);

	//Read attached player gifts from SQL table.
	if(select("Get Account Prize!:Get Character Prize!:Exit") == 1)
		{
			set .@query, query_sql("SELECT * FROM `" + .GiftTableName$ + "` WHERE account_id="+getcharid(3),
				.@gift_id,
				.@gift_account,
				.@gift_char,
				.@gift_item,
				.@gift_amount,
				.@gift_duration,
				.@gift_time
				); //Account gifts.
		}
		else if(@menu == 2)
		{
			set .@query, query_sql("SELECT * FROM `" + .GiftTableName$ + "` WHERE char_id="+getcharid(0),
				.@gift_id,
				.@gift_account,
				.@gift_char,
				.@gift_item,
				.@gift_amount,
				.@gift_duration,
				.@gift_time
				); //Char gifts.
		}
		else goto OnLeave;

	//Check if player don't have gifts.
	if(!.@query)
		{
			mes "[Reward Giver]";
			mes "Sorry, you don't have any prize";

			cutin "v_sprakki04",255;
			close;
		}

	//Build menu from query arrays.
		mes "[" + strnpcinfo(1) + "]";
		mes "^009900You got the prize^000000";
			for( set .@i, 0; .@i < .@query; set .@i, .@i + 1 )
			{
				mes "(" + .@gift_amount[.@i] + ") " + getitemname(.@gift_item[.@i]) + ".";
				set .@menu$, .@menu$ + getitemname(.@gift_item[.@i]) + ":";
			}
			next;
			set .@mid,select(.@menu$); //Show menu.
			set .@mid,.@mid-1;

	if (.@gift_time[.@mid] && .@gift_time[.@mid] < gettimetick(2))
	{
		mes "[Reward Giver]";
		mes "Sorry, this prize's claim time is already over.";

		cutin "v_sprakki04",255;
		close;
	}
	//Item is now selected. Choose what you want to do with it.
	mes "[" + strnpcinfo(1) + "]";
	mes "what you want do with (" + .@gift_amount[.@mid] + ") " + getitemname(.@gift_item[.@mid]) + "?";
	next;
	set .@Select,select("^009900Get it^000000:^ff0000Delete it! ^000000:nothings");

	//Receive gift selected.
	if(.@Select == 1)
	{
		//Check weight.
		if(checkweight( .@gift_item, .@gift_amount ) || .@gift_item[.@mid] == .ZenyID)
		{
			mes "[" + strnpcinfo(1) + "]";
			mes "^009900Get : (" + .@gift_amount[.@mid] + ") " + getitemname(.@gift_item[.@mid]) + ".^000000";
			if (.ip_limit)
			{
				// add ip_address to logs
				.@ipexist = query_sql("SELECT item_id, ip_address, claim_count FROM " + .GiftTableNameIP$ + " WHERE last_ip = (SELECT last_ip FROM login WHERE account_id="+getcharid(3)+") AND item_id = "+.@gift_item[.@mid]+" LIMIT 1", .@item,.@ip,.@claim_count);
				if (.@claim_count[0] >= .ip_limit)
				{
					next;
					mes "Sorry you have reached the maximum redeem limit for this IP address";
					cutin "v_sprakki04",255;
					close;
				}
				if (!.@claim_count[0])
				{
					query_sql("INSERT INTO " + .GiftTableNameIP$ + " (give_id,item_id,last_ip,claim_count) VALUES("+.@gift_id+","+.@gift_item+",'(SELECT last_ip FROM login WHERE account_id="+getcharid(3)+")',1)");		
				}
				else
				{
					query_sql("UPDATE " + .GiftTableNameIP$ + " SET claim_count = "+(.@claim_count[0]+1)+" WHERE item_id = "+.@gift_item[.@mid]+" AND last_ip = (SELECT last_ip FROM login WHERE account_id="+getcharid(3)+")");
				}
			}
			if (.@gift_item[.@mid] == .ZenyID) { // detects zeny ID and give zeny.
				if (Zeny+.@gift_amount[.@mid] > .MaxZeny)
				{
					mes "Please make sure that you have enough space to handle all these zennies and come back later.";
					cutin "v_sprakki04",255;
					close;
				}
				set Zeny,Zeny+.@gift_amount[.@mid];
			}
			else
			{
				if (!.@gift_duration)
				{
					getitem .@gift_item[.@mid], .@gift_amount[.@mid]; //Give item to player.
				}
				else
				{
					rentitem .@gift_item[.@mid], .@gift_duration * 60; 
				}
			}
			query_sql( "DELETE FROM `" + .GiftTableName$ + "` WHERE id = " + .@gift_id[.@mid] ); //Remove item from table.
			cutin "v_sprakki04",255;
			close;
		}
		else
		{
			//Overweight
			mes "^ff0000Sorry ^000000 You can't take it " + getitemname(.@gift_item[.@mid]);
			mes "Could lose some wight?";
			cutin "v_sprakki04",255;
			close;
		}
	}
	//Remove gift selected.
	else if(.@Select == 2) {
		mes "[" + strnpcinfo(1) + "]";
		mes "Are you sure you want dellet it?";
		mes "Gift: ("+.@gift_amount[.@mid]+") "+getitemname(.@gift_item[.@mid])+".";
		next;
		if(select("Yes:No") == 1) {
			mes "[" + strnpcinfo(1) + "]";
			mes "^ff0000Dellet: ("+.@gift_amount[.@mid]+") "+getitemname(.@gift_item[.@mid])+".^000000";
			query_sql("DELETE FROM `" + .GiftTableName$ + "` WHERE id = " + .@gift_id[.@mid]); //Remove item from table.
			cutin "v_sprakki04",255;
			close;
		} else {
			mes "[" + strnpcinfo(1) + "]";
			mes "we will save it";
			cutin "v_sprakki04",255;
			close;
		}
	}
	//Nothing selected.
	else
	{
		goto OnLeave;
	}

//GM Panel below:
OnManagement:
	if(getgmlevel() < .GMin) goto OnLeave;
	mes "[" + strnpcinfo(1) + "]";
	mes "Welvome " + strcharinfo(0) + "!";
	mes "How I can help you?";
	next;

	if(select("Make Gift:Nothing") != 1) goto OnLeave;

		//Make new gift.
		mes "[" + strnpcinfo(1) + "]";
		mes "Please input the item id.";
		mes "Default: 501";
	next;
		mes "What do you want to give?";
		set .@zenygive,0;
			if(select("Item:Zeny") == 1)
				{
					input .@new_item, 501, 30000;
				}
	next;
	mes "Do you want to add a claim timer?";
	if(select("No:Yes")==2)
	{
		next;
		mes "How many minutes do you want this reward to be claimable?";
		input(.@c);
		.@claimtime = gettimetick(2)+(.@c*60);
	}
	if(select("Continue:Cancel") != 1) goto OnLeave;
		mes "[" + strnpcinfo(1) + "]";
		mes "How many items/zeny?";
		mes "Default: 1";
	next;
	//item quantity range of 1 to 1,000.
	if(.@zenygive)
	{
		input .@new_value, 1, .MaxZeny;
	}
	else
	{
		input .@new_value, 1, 1000;
	}
	
	if(select("Continue:Cancel") != 1) goto OnLeave;
		mes "[" + strnpcinfo(1) + "]";
		mes "Please select input type:";
		mes "1. Single Account";
		mes "2. Single Character";
		mes "3. All ^009900Online^000000 Accounts.";
		mes "4. All Accounts.";
		mes "5. All ^009900Online^000000 Players/Characters.";
		mes "6. All Players/Characters.";
		mes "7. ^ff0000Cancel.^000000";
	next;
	switch(select("Single Account:Single Character:^009900Online^000000 Accounts:All Accounts:^009900Online^000000 Characters:All Characters:Cancel"))
	{
		//Account gift
		case 1:
			mes "[" + strnpcinfo(1) + "]";
			mes "Please select input type:";
			mes "By AID or Name?";
			next;
			if(select("Account ID:Character Name") == 1)
			{
				mes "[" + strnpcinfo(1) + "]";
				mes "Write account id:";
				next;
				input .@new_account, 2000000, 10000000; //Account id range from 2m to 10m.
				set .@query, query_sql("SELECT account_id FROM `" + .CharTableName$ + "` WHERE account_id = " + .@new_account, .@new_account);
				if(!.@query) goto OnNotExist;
				if(select("Continue:Cancel") != 1) goto OnLeave;
				mes "[" + strnpcinfo(1) + "]";
				mes "^009900Gift is ready to go!^000000";
				mes "AID: ^ff0000" + .@new_account + "^000000";
				mes "------------------";
				mes "Item: ^ff0000" + getitemname(.@new_item) + "^000000";
				mes "Quantity: ^ff0000" + .@new_value + "^000000";
				mes "Duration: " + .@duration + " Minutes";
				mes "Claim Time: " + .@c + " Minutes";
				next;
				if(select("Send Gift:Cancel") != 1) goto OnLeave;
				mes "[" + strnpcinfo(1) + "]";
				mes "Gift sending success!";
				//Create gift. <auto_id>, <account_id> <char_id> <item> <value>
				query_sql("INSERT INTO `" + .GiftTableName$ + "` (account_id, item, value, duration, timestamp) VALUES(" + .@new_account + ", " + .@new_item + ", " + .@new_value + ", " + .@duration + ", " + .@claimtime + ")");
			}
			else
			{
				mes "[" + strnpcinfo(1) + "]";
				mes "Write player name:";
				next;
				input .@new_name$;
				set .@query, query_sql("SELECT account_id FROM `" + .CharTableName$ + "` WHERE name = '" + .@new_name$ + "'", .@new_account);
				if(!.@query) goto OnNotExist;
				if(select("Continue:Cancel") != 1) goto OnLeave;
				mes "[" + strnpcinfo(1) + "]";
				mes "^009900Gift is ready to go!^000000";
				mes "AID: ^ff0000" + .@new_account + "^000000";
				mes "Name: ^ff0000"+ .@new_name$ + "^000000";
				mes "------------------";
				mes "Item: ^ff0000" + getitemname(.@new_item) + "^000000";
				mes "Quantity: ^ff0000" + .@new_value + "^000000";
				mes "Duration: " + .@duration + " Minutes";
				mes "Claim Time: " + .@c + " Minutes";
				next;
				if(select("Send Gift:Cancel") != 1) goto OnLeave;
				//Check if player is logged in.
				if(isloggedin(.@new_account)) {
					mes "[" + strnpcinfo(1) + "]";
					mes "Gift sending success!";
					query_sql("INSERT INTO `" + .GiftTableName$ + "` (account_id, item, value, duration, timestamp) VALUES(" + .@new_account + ", " + .@new_item + ", " + .@new_value + ", " + .@duration + ", " + .@claimtime + ")");
				} else {
					//Account was not online.
					mes "[" + strnpcinfo(1) + "]";
					mes "Gift sending success!";
					query_sql("INSERT INTO `" + .GiftTableName$ + "` (account_id, item, value, duration, timestamp) VALUES(" + .@new_account + ", " + .@new_item + ", " + .@new_value + ", " + .@duration + ", " + .@claimtime + ")"); // duplicate to other menus - continue here on giver side
				}
			}
			break;

		//Character gift.
		case 2:
			mes "[" + strnpcinfo(1) + "]";
			mes "Please select input type:";
			mes "By CID or Name?";
			next;
			if(select("Character ID:Character Name") == 1)
			{
				mes "[" + strnpcinfo(1) + "]";
				mes "Write character id:";
				next;
				input .@new_char,150000, 10000000; //Char id range from 150k to 10m.
				set .@query, query_sql("SELECT account_id, name FROM `" + .CharTableName$ + "` WHERE char_id = " + .@new_char, .@new_accountid, .@new_name$);
				if(!.@query) goto OnNotExist;
				if(select("Continue:Cancel") != 1) goto OnLeave;
					mes "[" + strnpcinfo(1) + "]";
					mes "^009900Gift is ready to go!^000000";
					mes "CID: ^ff0000" + .@new_char + "^000000";
					mes "Name: ^ff0000" + .@new_name$ + "^000000";
					mes "------------------";
					mes "Item: ^ff0000" + getitemname(.@new_item) + "^000000";
					mes "Quantity: ^ff0000" + .@new_value + "^000000";
					mes "Duration: " + .@duration + " Minutes";
					mes "Claim Time: " + .@c + " Minutes";
				next;
				if(select("Send Gift:Cancel") != 1) goto OnLeave;
				//Check if player is logged in.
				if(isloggedin(.@new_accountid)) {
					mes "[" + strnpcinfo(1) + "]";
					mes "Gift sending success!";

					//Create gift. <auto_id>, <account_id> <char_id> <item> <value>
					query_sql("INSERT INTO `" + .GiftTableName$ + "` (char_id, item, value, duration, timestamp) VALUES (" + .@new_char + ", " + .@new_item + ", " + .@new_value + "," + .@duration + "," + .@claimtime + ")");
				} else {
					//not online ask if we still give the gift.
					mes "[" + strnpcinfo(1) + "]";
					mes "The character is not online!";
					mes "Would you still like to send the gift?";
					next;
					if(select("Yes:No") != 1) goto OnLeave;
					mes "[" + strnpcinfo(1) + "]";
					mes "Gift sending success!";
					//Create gift. <auto_id>, <account_id> <char_id> <item> <value>
					query_sql("INSERT INTO `" + .GiftTableName$ + "` (char_id, item, value, duration, timestamp) VALUES (" + .@new_char + ", " + .@new_item + ", " + .@new_value + "," + .@duration + "," + .@claimtime + ")");
				}

			}
			else
			{
				mes "[" + strnpcinfo(1) + "]";
				mes "Write player name:";
				next;
				input .@new_name$;
				set .@query, query_sql("SELECT char_id, account_id FROM `" + .CharTableName$ + "` WHERE name = '" + .@new_name$ + "'", .@new_char, .@new_accountid);
				if(!.@query) goto OnNotExist;
				if(select("Continue:Cancel") != 1) goto OnLeave;
					mes "[" + strnpcinfo(1) + "]";
					mes "^009900Gift is ready to go!^000000";
					mes "CID: ^ff0000" + .@new_char + "^000000";
					mes "Name: ^ff0000"+ .@new_name$ + "^000000";
					mes "------------------";
					mes "Item: ^ff0000" + getitemname(.@new_item) + "^000000";
					mes "Quantity: ^ff0000" + .@new_value + "^000000";
					mes "Duration: " + .@duration + " Minutes";
					mes "Claim Time: " + .@c + " Minutes";
				next;
				if(select("Send Gift:Cancel") != 1) goto OnLeave;
				//Check if player is logged in.
				if(isloggedin(.@new_accountid))
				{
					mes "[" + strnpcinfo(1) + "]";
					mes "Gift sending success!";
					query_sql("INSERT INTO `" + .GiftTableName$ + "` (char_id, item, value, duration, timestamp) VALUES (" + .@new_char + ", " + .@new_item + ", " + .@new_value + "," + .@duration + "," + .@claimtime + ")");
				}
				else
				{
					//not online ask if we still give the gift.
					mes "[" + strnpcinfo(1) + "]";
					mes "The character is not online!";
					mes "Would you still like to give the gift?";
					next;
					if(select("Yes:No") != 1) goto OnLeave;
					mes "[" + strnpcinfo(1) + "]";
					mes "Gift sending success!";
					//Create gift. <auto_id>, <account_id> <char_id> <item> <value>
					query_sql("INSERT INTO `" + .GiftTableName$ + "` (char_id, item, value, duration, timestamp) VALUES (" + .@new_char + ", " + .@new_item + ", " + .@new_value + "," + .@duration + "," + .@claimtime + ")");
				}
			}
			announce strcharinfo(0)+" successfully sent " + .@new_value + "x " + getitemname(.@new_item) + " to " + .@new_name$,bc_all;
			break;

		//Register gift to all online accounts!
		case 3:
			mes "[" + strnpcinfo(1) + "]";
			mes "^009900Gift is ready to go!^000000";
			mes "Item: ^ff0000" + getitemname(.@new_item) + "^000000";
			mes "Quantity: ^ff0000" + .@new_value + "^000000";
			mes "Duration: " + .@duration + " Minutes";	
			mes "Claim Time: " + .@c + " Minutes";
			next;
			if(select("Send Gift:Cancel") != 1) goto OnLeave;
			mes "[" + strnpcinfo(1) + "]";
			mes "Please hold...";
			set .@c, 0; //Counting success.
			set .@query, query_sql("SELECT account_id FROM `"+.CharTableName$+"` WHERE online=1",.@account);
			for(set .@i, 0; .@i < .@query; set .@i, .@i + 1) {
				sleep2 25; //Slowdown the loop abit.
				.@at = query_sql("SELECT account_id, char_id FROM "+$GiftTableNameAT$+" WHERE account_id = "+.@account[.@i]+"", .@account_id, .@char_id); // check if in the table
				if (!.@at) {		
					query_sql("INSERT INTO `" + .GiftTableName$ + "` (account_id, item, value, duration, timestamp) VALUES(" + .@account[.@i] + ", " + .@new_item + ", " + .@new_value + ", " + .@duration + ", " + .@claimtime + ")");
				}
			}
			mes "Gift registered to (" + .@i + ") accounts!";
			break;

		//Register gift to all accounts!
		case 4:
			mes "[" + strnpcinfo(1) + "]";
			mes "^009900Gift is ready to go!^000000";
			mes "Item: ^ff0000" + getitemname(.@new_item) + "^000000";
			mes "Quantity: ^ff0000" + .@new_value + "^000000";
			mes "Claim Time: " + .@c + " Minutes";		
			next;
			if(select("Send Gift:Cancel") != 1) goto OnLeave;
			mes "[" + strnpcinfo(1) + "]";
			mes "Please hold...";
			set .@query, query_sql("SELECT account_id FROM `"+.LoginTableName$+"`",.@account);
			for(set .@i, 0; .@i < .@query; set .@i, .@i + 1) {
				sleep2 25; //Slowdown the loop abit.
					query_sql("INSERT INTO `" + .GiftTableName$ + "` (account_id, item, value, duration, timestamp) VALUES(" + .@account[.@i] + ", " + .@new_item + ", " + .@new_value + ", " + .@duration + ", " + .@claimtime + ")");
			}
			mes "Gift registered to (" + .@i + ") accounts!";
			break;

		//Register gift to all online characters!
		case 5:
			mes "[" + strnpcinfo(1) + "]";
			mes "^009900Gift is ready to go!^000000";
			mes "Item: ^ff0000" + getitemname(.@new_item) + "^000000";
			mes "Quantity: ^ff0000" + .@new_value + "^000000";
			mes "Claim Time: " + .@c + " Minutes";		
			next;
			if(select("Send Gift:Cancel") != 1) goto OnLeave;
			mes "[" + strnpcinfo(1) + "]";
			mes "Please hold...";
			set .@c, 0; //Counting success.
			set .@query, query_sql("SELECT char_id FROM `"+.CharTableName$+"` WHERE online=1",.@char);
			for(set .@i, 0; .@i < .@query; set .@i, .@i + 1) {
				sleep2 25; //Slowdown the loop abit.
				.@at = query_sql("SELECT account_id, char_id FROM "+$GiftTableNameAT$+" WHERE char_id = "+.@char[.@i]+"", .@account_id, .@char_id); // check if in the table
				if (!.@at) {
					query_sql("INSERT INTO `" + .GiftTableName$ + "` (char_id, item, value, duration, timestamp) VALUES (" + .@char[.@i] + ", " + .@new_item + ", " + .@new_value + "," + .@duration + "," + .@claimtime + ")");
				}
			}
			mes "Gift registered to (" + .@i + ") players!";
			break;

		//Register gift to all characters!
		case 6:
			mes "[" + strnpcinfo(1) + "]";
			mes "^009900Gift is ready to go!^000000";
			mes "Item: ^ff0000" + getitemname(.@new_item) + "^000000";
			mes "Quantity: ^ff0000" + .@new_value + "^000000";
			mes "Claim Time: " + .@c + " Minutes";	
			next;
			if(select("Send Gift:Cancel") != 1) goto OnLeave;
			mes "[" + strnpcinfo(1) + "]";
			mes "Please hold...";
			set .@query, query_sql("SELECT char_id FROM `"+.CharTableName$+"`",.@char);
			for(set .@i, 0; .@i < .@query; set .@i, .@i + 1) {
				sleep2 25; //Slowdown the loop abit.
				query_sql("INSERT INTO `" + .GiftTableName$ + "` (char_id, item, value, duration, timestamp) VALUES (" + .@char[.@i] + ", " + .@new_item + ", " + .@new_value + "," + .@duration + "," + .@claimtime + ")");
			}
			mes "Gift registered to (" + .@i + ") players!";
			break;

		//Cancel.
		Default:
				mes "[Reward Giver]";
				mes "See you later";
				break;
	}
	close;

OnLeave:
		mes "[Reward Giver]";
		mes "See you later";
		cutin "v_sprakki04",255;
		close;

OnNotExist:
		mes "[" + strnpcinfo(1) + "]";
		mes "This account does not exist!";
		cutin "v_sprakki04",255;
		close;
	
//============Reset Function=========================
OnDelete:
		mes "Which gifts do you want to reset?";
		mes "1. Single Account";
		mes "2. Single Character";
		mes "3. All ^009900Online^000000 Accounts.";
		mes "4. All Accounts.";
		mes "5. All ^009900Online^000000 Players/Characters.";
		mes "6. All Players/Characters.";
		mes "7. All cancel";
		switch(select("Single Account:Single Character:^009900Online^000000 Accounts:All Accounts:^009900Online^000000 Characters:All Characters:Specific Item:IPLimit Logs:Cancel"))
			{
			case 1: //Single Account
				mes "[" + strnpcinfo(1) + "]";
				mes "Please select input type:";
				mes "By AID or Name?";
				next;
				if(select("Account ID:Character Name") == 1)
				{
					mes "[" + strnpcinfo(1) + "]";
					mes "Write account id:";
					next;
					input .@new_account, 2000000, 10000000; //Account id range from 2m to 10m.
					set .@query, query_sql("SELECT account_id FROM `" + .CharTableName$ + "` WHERE account_id = " + .@new_account, .@new_account);
					if(!.@query) goto OnNotExist;
					if(select("Continue:Cancel") != 1) goto OnLeave;
						query_sql("DELETE FROM " + .GiftTableName$ + " WHERE account_id = " + .@new_account);
				}
				else
				{
					mes "[" + strnpcinfo(1) + "]";
					mes "Write player name:";
					next;
					input .@new_name$;
					set .@query, query_sql("SELECT account_id FROM `" + .CharTableName$ + "` WHERE name = '" + .@new_name$ + "'", .@new_account);
					if(!.@query) goto OnNotExist;
					if(select("Continue:Cancel") != 1) goto OnLeave;
						query_sql("DELETE FROM " + .GiftTableName$ + " WHERE account_id = " + .@new_account);
				}
				break;
			case 2: //Single Character
				mes "[" + strnpcinfo(1) + "]";
				mes "Please select input type:";
				mes "By CID or Name?";
				next;
				if(select("Character ID:Character Name") == 1)
				{
					mes "[" + strnpcinfo(1) + "]";
					mes "Write character id:";
					next;
					input .@new_char,150000, 10000000; //Char id range from 150k to 10m.
					set .@query, query_sql("SELECT account_id, name FROM `" + .CharTableName$ + "` WHERE char_id = " + .@new_char, .@new_accountid, .@new_name$);
					if(!.@query) goto OnNotExist;
					if(select("Continue:Cancel") != 1) goto OnLeave;
						query_sql("DELETE FROM " + .GiftTableName$ + " WHERE char_id = " + .@new_char);
				}
				else
				{
					mes "[" + strnpcinfo(1) + "]";
					mes "Write player name:";
					next;
					input .@new_name$;
					set .@query, query_sql("SELECT char_id, account_id FROM `" + .CharTableName$ + "` WHERE name = '" + .@new_name$ + "'", .@new_char, .@new_accountid);
					if(!.@query) goto OnNotExist;
					if(select("Continue:Cancel") != 1) goto OnLeave;
						query_sql("DELETE FROM " + .GiftTableName$ + " WHERE char_id = " + .@new_char);
				}
				break;
			case 3: //All Online Accounts.
				mes "[" + strnpcinfo(1) + "]";
				mes "Please hold...";
				set .@c, 0; //Counting success.
				set .@query, query_sql("SELECT account_id FROM `"+.CharTableName$+"` WHERE online=1",.@account);
				for(set .@i, 0; .@i < .@query; set .@i, .@i + 1) {
					sleep2 25; //Slowdown the loop abit.
					query_sql("DELETE FROM " + .GiftTableName$ + " WHERE account_id = " + .@account[.@i]);
				}
				break;
			case 4: //All Accounts.
				query_sql("DELETE FROM " + .GiftTableName$ + " WHERE account_id >= 1");
				break;
			case 5: //All Online Players/Characters.
				mes "[" + strnpcinfo(1) + "]";
				mes "Please hold...";
				set .@c, 0; //Counting success.
				set .@query, query_sql("SELECT char_id FROM `"+.CharTableName$+"` WHERE online=1",.@char);
				for(set .@i, 0; .@i < .@query; set .@i, .@i + 1)
					{
						sleep2 25; //Slowdown the loop abit.
						query_sql("DELETE FROM " + .GiftTableName$ + " WHERE char_id = " + .@char[.@i]);
					}
				break;
			case 6: //All Players/Characters.
				query_sql("TRUNCATE TABLE " + .GiftTableName$);
				break;
			case 7: // Delete specific item
				mes "Please type the id of the item you wish to delete";
				mes "This will delete all entries with the item id you typed";
				input(.@deletethis);
				next;
				mes "Are you sure you want to delete all entries of " + .@deletethis;
				if (select("Yes:No")==1)
					{
						query_sql("DELETE FROM " + .GiftTableName$ + " WHERE item = " + .@deletethis + "");
					}
					else
					{
						mes "Deletion cancelled";
						close;
					}
			case 8: //All ip logs
				query_sql("TRUNCATE TABLE " + .GiftTableNameIP$);
				break;
			default:
				break;
		}
		next;
		mes "deletion finished";
		cutin "v_sprakki04",255;
		close;

OnLimit:
	mes "Please enter an ip limit, current limit is " + .ip_limit;
	input(.ip_limit);
	mes "Done!";
	cutin "v_sprakki04",255;
	close;

//============================================================ 
// Config/Edit:
//============================================================ 
OnLoadSetup:
	set .Setup, 1;	//OnInit is loaded check.
	set .GMin, 60;	//Minimum GM level to use gm panel.
	set .ZenyID,23500; // put this when asked for which item to give zeny.
	set .MaxZeny,1000000000;
	//Your table names:
	set .CharTableName$, "char";	//Character table name(SQL).
	set .LoginTableName$, "login";
	set .GiftTableName$, "reward";	//Gift table name(SQL).
	set .GiftTableNameIP$, "reward_ip";	//Gift table name for ip tracker
	set $GiftTableNameAT$, "reward_at";	//Gift table name for auto trade tracker
	//Create gift table <auto_id>, <account_id>, <char_id>, <item>, <value>

	query_sql("CREATE TABLE IF NOT EXISTS `reward` (`id` int(11) NOT NULL AUTO_INCREMENT,`account_id` int(11) unsigned NOT NULL DEFAULT '0',`char_id` int(11) unsigned NOT NULL DEFAULT '0',`item` int(11) NOT NULL DEFAULT '0',`value` int(11) NOT NULL DEFAULT '0',`duration` int(11) NOT NULL DEFAULT '0',`timestamp` int(23) NOT NULL DEFAULT '0',PRIMARY KEY (`id`))");
	query_sql("CREATE TABLE IF NOT EXISTS `reward_ip` ( `give_id` int(11) NOT NULL,  `item_id` int(11) NOT NULL,  `ip_address` varchar(23) NOT NULL, `claim_count` int(11) NOT NULL,  PRIMARY KEY (`give_id`))");
	query_sql("CREATE TABLE IF NOT EXISTS `reward_at` (`account_id` int(11) NOT NULL,`char_id` int(11) NOT NULL)");
	return;

OnInit:
	callsub OnLoadSetup;
	end;
}

/* Manual table update for at tracker 
CREATE TABLE IF NOT EXISTS `reward_at` (
  `account_id` int(11) NOT NULL,
  `char_id` int(11) NOT NULL
);
*/
-	script	anti_trader	-1,{
	
OnInit:
	.is_anti_trade = 1; // 0 to disable
	end;
	
}
function	script	PG_30Seconds	{
	//dispbottom "anti trader 30sec";
	//Check if Vending (normal or @at)
	if(checkvending() >= 1)
	{
	   // mark as auto trader
	   	.@query = query_sql("SELECT account_id, char_id FROM "+$GiftTableNameAT$+" WHERE account_id = "+getcharid(3)+"", .@account_id, .@char_id); // check if in the table
		if (!.@query)
		{ // add if not there yet
			query_sql("INSERT INTO "+$GiftTableNameAT$+"(account_id,char_id) VALUES("+getcharid(3)+","+getcharid(0)+")");
			//dispbottom "you have been marked as auto trader";
			stopnpctimer;
			detachnpctimer;
			end;
		}
	}
	return;
}
function	script	PG_Login	{
	//dispbottom "at delete";
	.@query = query_sql("SELECT account_id, char_id FROM "+$GiftTableNameAT$+" WHERE account_id = "+getcharid(3)+"", .@account_id, .@char_id); // check if in the table
	if (.@query)
	{ // remove to reverify vending status
		query_sql("DELETE FROM "+$GiftTableNameAT$+" WHERE account_id = "+getcharid(3)+"");
	}
}

Please. I need your help master scripters

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  34
  • Topics Per Day:  0.02
  • Content Count:  101
  • Reputation:   3
  • Joined:  04/15/20
  • Last Seen:  

2 hours ago, Haruka Mayumi said:

1. Quest Board


//===== rAthena Script =======================================
//= tr0n's Questboard
//===== By: ==================================================
//= tr0n
//===== Current Version: =====================================
//= 1.6.5
//===== Description: =========================================
//= Easily add collection and hunting quests.
//===== Changelogs: ==========================================
// 1.0.0 Release
// 1.1.0 Added zeny reward
// 1.2.0 Rewrote checkmob and killcounter
// 1.3.1 Added level restriction
// 1.3.4 Added Reward Item Amount
// 1.4.4 Added Quest delay
// 1.5.4 Added repeatable Quests
// 1.6.4 Added party support
// 1.6.5 Bug fixes for party support
//============================================================
prontera,147,173,5	script	Event Monsters	676,{

	if(c_run==true){
		mes "[^FF7700Questboard^000000]";
		mes "^0000FF"+getd("." + currentquest$ + "_collectionname$")+"^000000";
		mes "--------------------------------";
		set .@size, getarraysize(getd("."+ currentquest$ + "_collectionitem"));
		for( set .@j, 0; .@j < .@size; set .@j,.@j+2){
			mes "^FF0000"+getitemname(getd("."+currentquest$+"_collectionitem["+.@j

+"]"))+" - "+countitem(getd("."+currentquest$+"_collectionitem["+.@j+"]"))+"/"+getd("."+currentquest

$+"_collectionitem["+(.@j+1)+"]")+" ea.^000000";
		}
		mes "--------------------------------";
		mes "[Reward]";
		mes "Item: ^0000FF"+((getd("." +currentquest$+"_collectionprize"))?getitemname(getd

("." +currentquest$+"_collectionprize"))+" - "+getd("." +currentquest$+"_collectionamount")+" 

ea.^000000":"Nothing^000000");
		mes "Zeny: ^0000FF"+getd("." +currentquest$+"_collectionzeny")+"^000000";
		mes "Base EXP: ^0000FF"+getd("." +currentquest$+"_collectionexp["+0+"]")+"^000000";
		mes "Job EXP: ^0000FF"+getd("." +currentquest$+"_collectionexp["+1+"]")+"^000000";
		next;
		if(select("Finish:Abort") == 2){
			mes "[^FF7700Questboard^000000]";
			mes "Quest aborted.";
			set currentquest$, "";
			set c_run, false;
			close;
		}
		goto L_checkitems;
	}

	if(h_run==true){
		mes "[^FF7700Questboard^000000]";
		mes "^0000FF"+getd("." + currentquest$ + "_huntingname$")+"^000000";
		mes "--------------------------------";
		set .@size, getarraysize(getd("."+ currentquest$ + "_huntingmob"));
		for( set .@j, 0; .@j < .@size; set .@j,.@j+2){
			set .@currentmob, getd("."+currentquest$+"_huntingmob["+(.@j)+"]");
			mes "^FF0000"+strmobinfo(1,getd("."+currentquest$+"_huntingmob["+.@j+"]"))+" 

- "+getd(currentquest$+"_"+.@currentmob+"_"+(.@j+1)+"_killcount")+"/"+getd("."+currentquest$

+"_huntingmob["+(.@j+1)+"]")+" ea.^000000";
		}
		mes "--------------------------------";
		mes "[Reward]";
		mes "Item: ^0000FF"+((getd("." +currentquest$+"_huntingprize"))?getitemname(getd("." 

+currentquest$+"_huntingprize"))+" - "+getd("." +currentquest$+"_huntingamount")+" 

ea.^000000":"Nothing^000000");
		mes "Zeny: ^0000FF"+getd("." +currentquest$+"_huntingzeny")+"^000000";
		mes "Base EXP: ^0000FF"+getd("." +currentquest$+"_huntingexp["+0+"]")+"^000000";
		mes "Job EXP: ^0000FF"+getd("." +currentquest$+"_huntingexp["+1+"]")+"^000000";
		next;
		if(select("Finish:Abort") == 2){
			mes "[^FF7700Questboard^000000]";
			mes "Quest aborted.";
			for(set .@x, 1; .@x < .@size; set .@x,.@x+2){
				set .@currentmob, getd("."+currentquest$+"_huntingmob["+(.@x-1)+"]");
				setd(currentquest$+"_"+.@currentmob+"_"+.@x+"_killcount", 0);
			}
			set currentquest$, "";
			set h_run, false;
			close;
		}
		goto L_checkmobs;
	}

	mes "[^FF7700Questboard^000000]";
	mes "Select category:";
	next;

	switch(select((.collection)?"Collection Quests":"",
				  (.hunting)?"Hunting Quests":"",
				  "Exit")) {

	case 1:
		set .@collectmenu$, "";
		for( set .@i,0; .@i < .collectionquestcount; set .@i,.@i+1){
			if (.@i) set .@collectmenu$,.@collectmenu$+":";
			set .@collectmenu$, .@collectmenu$ + "[" + getd("." +(.@i

+1)+"_collectionmin") + " - " + getd("." +(.@i+1)+"_collectionmax") + "] " + getd("." + (.@i+1) + 

"_collectionname$");
		}
		set .@selection,select(.@collectmenu$);
		if(.quest_repeat == true){
			if(gettimetick(2) < getd(.@selection + "_collection_delay")){
				set .@time_left, getd(.@selection + "_collection_delay")-gettimetick

(2);
				mes "[^FF7700Questboard^000000]";
				mes "You have to wait ^0000FF"+Time2Str(.@time_left)+"^000000 to do 

this quest again.";
				close;
			}
		}
		else{
			if(getd(.@selection + "_collection_repeat") == true){
				mes "[^FF7700Questboard^000000]";
				mes "You already did this quest.";
				mes "Please choose another one.";
				close;
			}
		}
		mes "[^FF7700Questboard^000000]";
		mes "^0000FF"+getd("." + .@selection + "_collectionname$")+"^000000";
		mes "--------------------------------";
		set .@size, getarraysize(getd("."+ .@selection + "_collectionitem"));
		for( set .@j, 0; .@j < .@size; set .@j,.@j+2){
			mes "^FF0000"+getitemname(getd("."+.@selection+"_collectionitem["+.@j+"]"))+" 

- "+getd("."+.@selection+"_collectionitem["+(.@j+1)+"]")+" ea.^000000";
		}
		mes "--------------------------------";
		mes "[Reward]";
		mes "Item: ^0000FF"+((getd("." +.@selection+"_collectionprize"))?getitemname(getd("." 

+.@selection+"_collectionprize"))+" - "+getd("." +.@selection+"_collectionamount")+" 

ea.^000000":"Nothing^000000");
		mes "Zeny: ^0000FF"+getd("." +.@selection+"_collectionzeny")+"^000000";
		mes "Base EXP: ^0000FF"+getd("." +.@selection+"_collectionexp["+0+"]")+"^000000";
		mes "Job EXP: ^0000FF"+getd("." +.@selection+"_collectionexp["+1+"]")+"^000000";
		next;
		if(select("Accept:Decline") == 2){
			close;
		}
		if(BaseLevel >= getd("." +.@selection+"_collectionmin") && BaseLevel <= getd("." 

+.@selection+"_collectionmax")){
			mes "[^FF7700Questboard^000000]";
			mes "Quest accepted.";
			set c_run, true;
			set currentquest$, .@selection;
			close;
		}
		else{
			mes "[^FF7700Questboard^000000]";
			mes "You don't have the required";
			mes "level to do this quest.";
			close;
		}

	case 2:
		set .@huntmenu$, "";
		for( set .@i,0; .@i < .huntingquestcount; set .@i,.@i+1){
			if (.@i) set .@huntmenu$,.@huntmenu$+":";
			set .@huntmenu$, .@huntmenu$ + "[" + getd("." +(.@i+1)+"_huntingmin") + " - " 

+ getd("." +(.@i+1)+"_huntingmax") + "] " + getd("." + (.@i+1) + "_huntingname$");
		}
		set .@selection,select(.@huntmenu$);
		if(.quest_repeat == true){
			if(gettimetick(2) < getd(.@selection + "_hunting_delay")){
				set .@time_left, getd(.@selection + "_hunting_delay")-gettimetick(2);
				mes "[^FF7700Questboard^000000]";
				mes "You have to wait ^0000FF"+Time2Str(.@time_left)+"^000000 to do 

this quest again.";
				close;
			}
		}
		else{
			if(getd(.@selection + "_hunting_repeat") == true){
				mes "[^FF7700Questboard^000000]";
				mes "You already did this quest.";
				mes "Please choose another one.";
				close;
			}
		}
		mes "[^FF7700Questboard^000000]";
		mes "^0000FF"+getd("." + .@selection + "_huntingname$")+"^000000";
		mes "--------------------------------";
		set .@size, getarraysize(getd("."+ .@selection + "_huntingmob"));
		for( set .@j, 0; .@j < .@size; set .@j,.@j+2){
			mes "^FF0000"+strmobinfo(1,getd("."+.@selection+"_huntingmob["+.@j+"]"))+" - 

"+getd("."+.@selection+"_huntingmob["+(.@j+1)+"]")+" ea.^000000";
		}
		mes "--------------------------------";
		mes "[Reward]";
		mes "Item: ^0000FF"+((getd("." +.@selection+"_huntingprize"))?getitemname(getd("." 

+.@selection+"_huntingprize"))+" - "+getd("." +.@selection+"_huntingamount")+" 

ea.^000000":"Nothing^000000");
		mes "Zeny: ^0000FF"+getd("." +.@selection+"_huntingzeny")+"^000000";
		mes "Base EXP: ^0000FF"+getd("." +.@selection+"_huntingexp["+0+"]")+"^000000";
		mes "Job EXP: ^0000FF"+getd("." +.@selection+"_huntingexp["+1+"]")+"^000000";
		next;
		if(select("Accept:Decline") == 2){
			close;
		}
		if(BaseLevel >= getd("." +.@selection+"_huntingmin") && BaseLevel <= getd("." 

+.@selection+"_huntingmax")){
			mes "[^FF7700Questboard^000000]";
			mes "Quest accepted.";
			set h_run, true;
			set currentquest$, .@selection;
			close;
		}
		else{
			mes "[^FF7700Questboard^000000]";
			mes "You don't have the required";
			mes "level to do this quest.";
			close;
		}

	case 3:
		close;
	}

L_checkitems:
	set .@size, getarraysize(getd("."+currentquest$+"_collectionitem"));
	for( set .@k,0; .@k < .@size; set .@k,.@k+2){
		if(countitem(getd("."+currentquest$+"_collectionitem["+.@k+"]"))>=getd

("."+currentquest$+"_collectionitem["+(.@k+1)+"]")){
			set .@checkitem,.@checkitem+2;
		}
	}
	if(.@checkitem<.@size){
		mes "[^FF7700Questboard^000000]";
		mes "You don't have everything.";
		close;
	}
	for( set .@delcount,0; .@delcount < .@size; set .@delcount,.@delcount+2){
		delitem getd("."+currentquest$+"_collectionitem["+.@delcount+"]"),getd

("."+currentquest$+"_collectionitem["+(.@delcount+1)+"]");
	}
	mes "[^FF7700Questboard^000000]";
	mes "Congratulation! Here is your Reward.";
	if(getd("." +currentquest$+"_collectionprize")!=0) getitem(getd("." +currentquest$

+"_collectionprize"),getd("." +currentquest$+"_collectionamount"));
	set Zeny,Zeny+getd("." +currentquest$+"_collectionzeny");
	getexp getd("." +currentquest$+"_collectionexp["+0+"]"),getd("." +currentquest$

+"_collectionexp["+1+"]");
	setd(currentquest$ + "_collection_delay"),gettimetick(2)+.quest_delay;
	setd(currentquest$ + "_collection_repeat"),true;
	set currentquest$, "";
	set c_run, false;
	close;

L_checkmobs:
	set .@size, getarraysize(getd("."+currentquest$+"_huntingmob"));
	set .@goal, .@size/2;
	for(set .@i, 1; .@i < .@size; set .@i,.@i+2){
		set .@currentmob, getd("."+currentquest$+"_huntingmob["+(.@i-1)+"]");
		if(getd(currentquest$+"_"+.@currentmob+"_"+.@i+"_killcount")==getd("."+currentquest$

+"_huntingmob["+.@i+"]")){
			set .@checkmonster, .@checkmonster+1;
			if(.@checkmonster==.@goal){
				goto L_checkmobs2;
			}
			continue;
		}
		goto L_checkmobs2;
	}

L_checkmobs2:
	if(.@checkmonster<.@goal){
		mes "[^FF7700Questboard^000000]";
		mes "You didn't kill everything.";
		close;
	}
	mes "[^FF7700Questboard^000000]";
	mes "Congratulation! Here is your Reward.";
	set .@size, getarraysize(getd("."+currentquest$+"_huntingmob"));
	for(set .@x, 1; .@x < .@size; set .@x,.@x+2){
		set .@currentmob, getd("."+currentquest$+"_huntingmob["+(.@x-1)+"]");
		setd(currentquest$+"_"+.@currentmob+"_"+.@x+"_killcount", 0);
	}
	if(getd("." +currentquest$+"_huntingprize")!=0) getitem(getd("." +currentquest$

+"_huntingprize"),getd("." +currentquest$+"_huntingamount"));
	set Zeny, Zeny+getd("." +currentquest$+"_huntingzeny");
	getexp getd("." +currentquest$+"_huntingexp["+0+"]"),getd("." +currentquest$+"_huntingexp

["+1+"]");
	setd(currentquest$ + "_hunting_delay"),gettimetick(2)+.quest_delay;
	setd(currentquest$ + "_hunting_repeat"),true;
	set currentquest$, "";
	set h_run, false;
	close;

OnNPCKillEvent:
	if(h_run!=true) end;
	set .@size, getarraysize(getd("."+currentquest$+"_huntingmob"));
	for(set .@i, 1; .@i < .@size; set .@i,.@i+2){
		if(killedrid==getd("."+currentquest$+"_huntingmob["+(.@i-1)+"]")){
			set .@currentmob, getd("."+currentquest$+"_huntingmob["+(.@i-1)+"]");
			if(getd(currentquest$+"_"+.@currentmob+"_"+.@i+"_killcount")<getd

("."+currentquest$+"_huntingmob["+.@i+"]")){
				setd(currentquest$+"_"+.@currentmob+"_"+.@i+"_killcount", getd

(currentquest$+"_"+.@currentmob+"_"+.@i+"_killcount")+1);
				dispbottom getd("."+currentquest$+"_huntingname$")+": ["+strmobinfo

(1,.@currentmob)+"] ("+ getd(currentquest$+"_"+.@currentmob+"_"+.@i+"_killcount")+"/"+getd

("."+currentquest$+"_huntingmob["+.@i+"]")+")";
			}
			if(getcharid(1) != 0 && .party_support == true){
				getmapxy(.@map1$,.@x1,.@y1);
				set .@killerid, getcharid(3);
				set .@currentquest$, currentquest$;
				getpartymember getcharid(1),1;
				getpartymember getcharid(1),2;
				for(set .@j, 0; .@j < $@partymembercount; .@j++){
					if(isloggedin($@partymemberaid[.@j], $@partymembercid[.@j])){
						if(h_run==true && $@partymemberaid[.@j] != .@killerid 

&& .@currentquest$ == getvar(currentquest$, $@partymembercid[.@j]) && readparam(HP, $@partymembercid

[.@j]) > 0){
							getmapxy(.@map2$,.@x2,.@y2,BL_PC,rid2name

($@partymemberaid[.@j]));
							if(.@map1$ == .@map2$ && distance

(.@x1,.@y1,.@x2,.@y2) < .party_range){
								set .@kill_amt,getvar(getd

(.@currentquest$+"_"+.@currentmob+"_"+.@i+"_killcount"), $@partymembercid[.@j]);
								set .@kill_goal,getd

("."+.@currentquest$+"_huntingmob["+.@i+"]");
								if(.@kill_amt<.@kill_goal)
								{
									setd(.@currentquest$

+"_"+.@currentmob+"_"+.@i+"_killcount", .@kill_amt+1, $@partymembercid[.@j]);
									dispbottom getd

("."+.@currentquest$+"_huntingname$")+": ["+strmobinfo(1,.@currentmob)+"] ("+(.@kill_amt

+1)+"/"+.@kill_goal+")", 0xB6FF00, $@partymembercid[.@j];
								}
							}
						}
					}
				}
			}
			break;
		}
	}
	end;

OnInit:
	waitingroom "Quest Board",0;
	function AddCollection;
	function AddHunting;

	//Activate/Deactivate quest categories (true/1 - activated, false/0 - deactivated)
	set .collection, false;
	set .hunting, true;

	//Quest Delay (seconds)
	//24 hours = 86400 seconds
	set .quest_delay, 0;

	//Activate/Deactivate repeatable quests (true/1 - activated, false/0 - deactivated)
	set .quest_repeat, true;

	//Activate/Deactivate party support (true/1 - activated, false/0 - deactivated)
	set .party_support, true;

	//Max range for party support (+- x & y coordinations)
	set .party_range, 25;

	//Checks if quests are loaded (prevents out of index)
	if(.questsloaded==true) end;
	set .questsloaded, true;

	//Add Collection Quests here (You can add as many required items as you want)
	//AddCollection("<Quest Name>",<Min Lvl>,<Max Lvl>,<Reward|Item ID>,<Reward|Item 

Amount>,<Zeny Reward>,<Base EXP>,<Job EXP>,<Item ID>,<Item Amount>,...);


	//Add Hunting Quests here (You can add as many required mobs as you want)
	//AddHunting("<Quest Name>",<Min Lvl>,<Max Lvl>,<Reward|Item ID>,<Reward|Item Amount>,<Zeny 

Reward>,<Base EXP>,<Job EXP>,<Monster ID>,<Monster Amount>,...);
	Addhunting("Mid-difficulty",1,99,7711,10,50000,50000,40000,1310,100);
	Addhunting("High-difficulty",1,99,7711,20,50000,100000,80000,1098,100);
	Addhunting("Extreme-difficulty",1,99,7711,30,100000,200000,160000,1833,100);
	end;


	function AddCollection{
		set .collectionquestcount,.collectionquestcount+1;
		setd ("." +.collectionquestcount+"_collectionname$", getarg(0));
		setd ("." +.collectionquestcount+"_collectionmin", getarg(1));
		setd ("." +.collectionquestcount+"_collectionmax", getarg(2));
		setd ("." +.collectionquestcount+"_collectionprize", getarg(3));
		setd ("." +.collectionquestcount+"_collectionamount", getarg(4));
		setd ("." +.collectionquestcount+"_collectionzeny", getarg(5));
		set .@argcount, 6;
		set .@size, getarraysize(getd("."+ .collectionquestcount + "_collectionexp"));
		setd ("." +.collectionquestcount+"_collectionexp["+.@size+"]",getarg(.@argcount)); 
		setd ("." +.collectionquestcount+"_collectionexp["+(.@size+1)+"]",getarg(.@argcount

+1)); 
		set .@argcount, .@argcount+2;
		set .@size, getarraysize(getd("."+ .collectionquestcount + "_collectionitem"));
		while(getarg(.@argcount,-1)!=-1 && getarg(.@argcount+1,-1)!=-1){
			setd ("."+.collectionquestcount+"_collectionitem["+.@size+"]",getarg

(.@argcount)); 
			setd ("."+.collectionquestcount+"_collectionitem["+(.@size+1)+"]",getarg

(.@argcount+1));
			set .@argcount,.@argcount+2;
			set .@size, .@size+2;
		}
		return;
	}

	function AddHunting{
		set .huntingquestcount,.huntingquestcount+1;
		setd ("." +.huntingquestcount+"_huntingname$", getarg(0));
		setd ("." +.huntingquestcount+"_huntingmin", getarg(1));
		setd ("." +.huntingquestcount+"_huntingmax", getarg(2));
		setd ("." +.huntingquestcount+"_huntingprize", getarg(3));
		setd ("." +.huntingquestcount+"_huntingamount", getarg(4));
		setd ("." +.huntingquestcount+"_huntingzeny", getarg(5));
		set .@size, getarraysize(getd("."+ .huntingquestcount + "_huntingexp"));
		set .@argcount, 6;
		setd ("." +.huntingquestcount+"_huntingexp["+.@size+"]",getarg(.@argcount));
		setd ("." +.huntingquestcount+"_huntingexp["+(.@size+1)+"]",getarg(.@argcount+1)); 
		set .@argcount, .@argcount+2;
		set .@size, getarraysize(getd("."+ .huntingquestcount + "_huntingmob"));
		while(getarg(.@argcount,-1)!=-1 && getarg(.@argcount+1,-1)!=-1){
			setd ("."+.huntingquestcount+"_huntingmob["+.@size+"]",getarg(.@argcount)); 
			setd ("."+.huntingquestcount+"_huntingmob["+(.@size+1)+"]",getarg(.@argcount

+1));
			set .@argcount, .@argcount+2;
			set .@size, .@size+2;
		}
		return;
	}
}

2. Prize Giver


//======= 3ceam Script =======================================
//= Prize Giver NPC
//===== Modified By: =========================================
//= Keitenai
//===== Current Version: =====================================
//= 1.0
//===== Compatible With: =====================================
//= Athena Project
//===== Description: =========================================
//= Prize giver for single char, account and more.
//===== Additional Comments: =================================
//= 1.0 Modified Version for 3ceam compatibility
//============================================================
prontera,141,175,4	script	Server Reward	113,{
	//cutin "v_sprakki04",2;
	//Check if setups are loaded.
	if(!.Setup)
		{
			callsub OnLoadSetup;
		}

	//Show GM Panel if player is GM.
	if(getgmlevel() >= .GMin)
		menu("Take a prize as a player",-,"Give prize",
				OnManagement,"Reset Item Give",
				OnDelete,"IP Limit per Item",
				OnLimit);

	//Read attached player gifts from SQL table.
	if(select("Get Account Prize!:Get Character Prize!:Exit") == 1)
		{
			set .@query, query_sql("SELECT * FROM `" + .GiftTableName$ + "` WHERE account_id="+getcharid(3),
				.@gift_id,
				.@gift_account,
				.@gift_char,
				.@gift_item,
				.@gift_amount,
				.@gift_duration,
				.@gift_time
				); //Account gifts.
		}
		else if(@menu == 2)
		{
			set .@query, query_sql("SELECT * FROM `" + .GiftTableName$ + "` WHERE char_id="+getcharid(0),
				.@gift_id,
				.@gift_account,
				.@gift_char,
				.@gift_item,
				.@gift_amount,
				.@gift_duration,
				.@gift_time
				); //Char gifts.
		}
		else goto OnLeave;

	//Check if player don't have gifts.
	if(!.@query)
		{
			mes "[Reward Giver]";
			mes "Sorry, you don't have any prize";

			cutin "v_sprakki04",255;
			close;
		}

	//Build menu from query arrays.
		mes "[" + strnpcinfo(1) + "]";
		mes "^009900You got the prize^000000";
			for( set .@i, 0; .@i < .@query; set .@i, .@i + 1 )
			{
				mes "(" + .@gift_amount[.@i] + ") " + getitemname(.@gift_item[.@i]) + ".";
				set .@menu$, .@menu$ + getitemname(.@gift_item[.@i]) + ":";
			}
			next;
			set .@mid,select(.@menu$); //Show menu.
			set .@mid,.@mid-1;

	if (.@gift_time[.@mid] && .@gift_time[.@mid] < gettimetick(2))
	{
		mes "[Reward Giver]";
		mes "Sorry, this prize's claim time is already over.";

		cutin "v_sprakki04",255;
		close;
	}
	//Item is now selected. Choose what you want to do with it.
	mes "[" + strnpcinfo(1) + "]";
	mes "what you want do with (" + .@gift_amount[.@mid] + ") " + getitemname(.@gift_item[.@mid]) + "?";
	next;
	set .@Select,select("^009900Get it^000000:^ff0000Delete it! ^000000:nothings");

	//Receive gift selected.
	if(.@Select == 1)
	{
		//Check weight.
		if(checkweight( .@gift_item, .@gift_amount ) || .@gift_item[.@mid] == .ZenyID)
		{
			mes "[" + strnpcinfo(1) + "]";
			mes "^009900Get : (" + .@gift_amount[.@mid] + ") " + getitemname(.@gift_item[.@mid]) + ".^000000";
			if (.ip_limit)
			{
				// add ip_address to logs
				.@ipexist = query_sql("SELECT item_id, ip_address, claim_count FROM " + .GiftTableNameIP$ + " WHERE last_ip = (SELECT last_ip FROM login WHERE account_id="+getcharid(3)+") AND item_id = "+.@gift_item[.@mid]+" LIMIT 1", .@item,.@ip,.@claim_count);
				if (.@claim_count[0] >= .ip_limit)
				{
					next;
					mes "Sorry you have reached the maximum redeem limit for this IP address";
					cutin "v_sprakki04",255;
					close;
				}
				if (!.@claim_count[0])
				{
					query_sql("INSERT INTO " + .GiftTableNameIP$ + " (give_id,item_id,last_ip,claim_count) VALUES("+.@gift_id+","+.@gift_item+",'(SELECT last_ip FROM login WHERE account_id="+getcharid(3)+")',1)");		
				}
				else
				{
					query_sql("UPDATE " + .GiftTableNameIP$ + " SET claim_count = "+(.@claim_count[0]+1)+" WHERE item_id = "+.@gift_item[.@mid]+" AND last_ip = (SELECT last_ip FROM login WHERE account_id="+getcharid(3)+")");
				}
			}
			if (.@gift_item[.@mid] == .ZenyID) { // detects zeny ID and give zeny.
				if (Zeny+.@gift_amount[.@mid] > .MaxZeny)
				{
					mes "Please make sure that you have enough space to handle all these zennies and come back later.";
					cutin "v_sprakki04",255;
					close;
				}
				set Zeny,Zeny+.@gift_amount[.@mid];
			}
			else
			{
				if (!.@gift_duration)
				{
					getitem .@gift_item[.@mid], .@gift_amount[.@mid]; //Give item to player.
				}
				else
				{
					rentitem .@gift_item[.@mid], .@gift_duration * 60; 
				}
			}
			query_sql( "DELETE FROM `" + .GiftTableName$ + "` WHERE id = " + .@gift_id[.@mid] ); //Remove item from table.
			cutin "v_sprakki04",255;
			close;
		}
		else
		{
			//Overweight
			mes "^ff0000Sorry ^000000 You can't take it " + getitemname(.@gift_item[.@mid]);
			mes "Could lose some wight?";
			cutin "v_sprakki04",255;
			close;
		}
	}
	//Remove gift selected.
	else if(.@Select == 2) {
		mes "[" + strnpcinfo(1) + "]";
		mes "Are you sure you want dellet it?";
		mes "Gift: ("+.@gift_amount[.@mid]+") "+getitemname(.@gift_item[.@mid])+".";
		next;
		if(select("Yes:No") == 1) {
			mes "[" + strnpcinfo(1) + "]";
			mes "^ff0000Dellet: ("+.@gift_amount[.@mid]+") "+getitemname(.@gift_item[.@mid])+".^000000";
			query_sql("DELETE FROM `" + .GiftTableName$ + "` WHERE id = " + .@gift_id[.@mid]); //Remove item from table.
			cutin "v_sprakki04",255;
			close;
		} else {
			mes "[" + strnpcinfo(1) + "]";
			mes "we will save it";
			cutin "v_sprakki04",255;
			close;
		}
	}
	//Nothing selected.
	else
	{
		goto OnLeave;
	}

//GM Panel below:
OnManagement:
	if(getgmlevel() < .GMin) goto OnLeave;
	mes "[" + strnpcinfo(1) + "]";
	mes "Welvome " + strcharinfo(0) + "!";
	mes "How I can help you?";
	next;

	if(select("Make Gift:Nothing") != 1) goto OnLeave;

		//Make new gift.
		mes "[" + strnpcinfo(1) + "]";
		mes "Please input the item id.";
		mes "Default: 501";
	next;
		mes "What do you want to give?";
		set .@zenygive,0;
			if(select("Item:Zeny") == 1)
				{
					input .@new_item, 501, 30000;
				}
	next;
	mes "Do you want to add a claim timer?";
	if(select("No:Yes")==2)
	{
		next;
		mes "How many minutes do you want this reward to be claimable?";
		input(.@c);
		.@claimtime = gettimetick(2)+(.@c*60);
	}
	if(select("Continue:Cancel") != 1) goto OnLeave;
		mes "[" + strnpcinfo(1) + "]";
		mes "How many items/zeny?";
		mes "Default: 1";
	next;
	//item quantity range of 1 to 1,000.
	if(.@zenygive)
	{
		input .@new_value, 1, .MaxZeny;
	}
	else
	{
		input .@new_value, 1, 1000;
	}
	
	if(select("Continue:Cancel") != 1) goto OnLeave;
		mes "[" + strnpcinfo(1) + "]";
		mes "Please select input type:";
		mes "1. Single Account";
		mes "2. Single Character";
		mes "3. All ^009900Online^000000 Accounts.";
		mes "4. All Accounts.";
		mes "5. All ^009900Online^000000 Players/Characters.";
		mes "6. All Players/Characters.";
		mes "7. ^ff0000Cancel.^000000";
	next;
	switch(select("Single Account:Single Character:^009900Online^000000 Accounts:All Accounts:^009900Online^000000 Characters:All Characters:Cancel"))
	{
		//Account gift
		case 1:
			mes "[" + strnpcinfo(1) + "]";
			mes "Please select input type:";
			mes "By AID or Name?";
			next;
			if(select("Account ID:Character Name") == 1)
			{
				mes "[" + strnpcinfo(1) + "]";
				mes "Write account id:";
				next;
				input .@new_account, 2000000, 10000000; //Account id range from 2m to 10m.
				set .@query, query_sql("SELECT account_id FROM `" + .CharTableName$ + "` WHERE account_id = " + .@new_account, .@new_account);
				if(!.@query) goto OnNotExist;
				if(select("Continue:Cancel") != 1) goto OnLeave;
				mes "[" + strnpcinfo(1) + "]";
				mes "^009900Gift is ready to go!^000000";
				mes "AID: ^ff0000" + .@new_account + "^000000";
				mes "------------------";
				mes "Item: ^ff0000" + getitemname(.@new_item) + "^000000";
				mes "Quantity: ^ff0000" + .@new_value + "^000000";
				mes "Duration: " + .@duration + " Minutes";
				mes "Claim Time: " + .@c + " Minutes";
				next;
				if(select("Send Gift:Cancel") != 1) goto OnLeave;
				mes "[" + strnpcinfo(1) + "]";
				mes "Gift sending success!";
				//Create gift. <auto_id>, <account_id> <char_id> <item> <value>
				query_sql("INSERT INTO `" + .GiftTableName$ + "` (account_id, item, value, duration, timestamp) VALUES(" + .@new_account + ", " + .@new_item + ", " + .@new_value + ", " + .@duration + ", " + .@claimtime + ")");
			}
			else
			{
				mes "[" + strnpcinfo(1) + "]";
				mes "Write player name:";
				next;
				input .@new_name$;
				set .@query, query_sql("SELECT account_id FROM `" + .CharTableName$ + "` WHERE name = '" + .@new_name$ + "'", .@new_account);
				if(!.@query) goto OnNotExist;
				if(select("Continue:Cancel") != 1) goto OnLeave;
				mes "[" + strnpcinfo(1) + "]";
				mes "^009900Gift is ready to go!^000000";
				mes "AID: ^ff0000" + .@new_account + "^000000";
				mes "Name: ^ff0000"+ .@new_name$ + "^000000";
				mes "------------------";
				mes "Item: ^ff0000" + getitemname(.@new_item) + "^000000";
				mes "Quantity: ^ff0000" + .@new_value + "^000000";
				mes "Duration: " + .@duration + " Minutes";
				mes "Claim Time: " + .@c + " Minutes";
				next;
				if(select("Send Gift:Cancel") != 1) goto OnLeave;
				//Check if player is logged in.
				if(isloggedin(.@new_account)) {
					mes "[" + strnpcinfo(1) + "]";
					mes "Gift sending success!";
					query_sql("INSERT INTO `" + .GiftTableName$ + "` (account_id, item, value, duration, timestamp) VALUES(" + .@new_account + ", " + .@new_item + ", " + .@new_value + ", " + .@duration + ", " + .@claimtime + ")");
				} else {
					//Account was not online.
					mes "[" + strnpcinfo(1) + "]";
					mes "Gift sending success!";
					query_sql("INSERT INTO `" + .GiftTableName$ + "` (account_id, item, value, duration, timestamp) VALUES(" + .@new_account + ", " + .@new_item + ", " + .@new_value + ", " + .@duration + ", " + .@claimtime + ")"); // duplicate to other menus - continue here on giver side
				}
			}
			break;

		//Character gift.
		case 2:
			mes "[" + strnpcinfo(1) + "]";
			mes "Please select input type:";
			mes "By CID or Name?";
			next;
			if(select("Character ID:Character Name") == 1)
			{
				mes "[" + strnpcinfo(1) + "]";
				mes "Write character id:";
				next;
				input .@new_char,150000, 10000000; //Char id range from 150k to 10m.
				set .@query, query_sql("SELECT account_id, name FROM `" + .CharTableName$ + "` WHERE char_id = " + .@new_char, .@new_accountid, .@new_name$);
				if(!.@query) goto OnNotExist;
				if(select("Continue:Cancel") != 1) goto OnLeave;
					mes "[" + strnpcinfo(1) + "]";
					mes "^009900Gift is ready to go!^000000";
					mes "CID: ^ff0000" + .@new_char + "^000000";
					mes "Name: ^ff0000" + .@new_name$ + "^000000";
					mes "------------------";
					mes "Item: ^ff0000" + getitemname(.@new_item) + "^000000";
					mes "Quantity: ^ff0000" + .@new_value + "^000000";
					mes "Duration: " + .@duration + " Minutes";
					mes "Claim Time: " + .@c + " Minutes";
				next;
				if(select("Send Gift:Cancel") != 1) goto OnLeave;
				//Check if player is logged in.
				if(isloggedin(.@new_accountid)) {
					mes "[" + strnpcinfo(1) + "]";
					mes "Gift sending success!";

					//Create gift. <auto_id>, <account_id> <char_id> <item> <value>
					query_sql("INSERT INTO `" + .GiftTableName$ + "` (char_id, item, value, duration, timestamp) VALUES (" + .@new_char + ", " + .@new_item + ", " + .@new_value + "," + .@duration + "," + .@claimtime + ")");
				} else {
					//not online ask if we still give the gift.
					mes "[" + strnpcinfo(1) + "]";
					mes "The character is not online!";
					mes "Would you still like to send the gift?";
					next;
					if(select("Yes:No") != 1) goto OnLeave;
					mes "[" + strnpcinfo(1) + "]";
					mes "Gift sending success!";
					//Create gift. <auto_id>, <account_id> <char_id> <item> <value>
					query_sql("INSERT INTO `" + .GiftTableName$ + "` (char_id, item, value, duration, timestamp) VALUES (" + .@new_char + ", " + .@new_item + ", " + .@new_value + "," + .@duration + "," + .@claimtime + ")");
				}

			}
			else
			{
				mes "[" + strnpcinfo(1) + "]";
				mes "Write player name:";
				next;
				input .@new_name$;
				set .@query, query_sql("SELECT char_id, account_id FROM `" + .CharTableName$ + "` WHERE name = '" + .@new_name$ + "'", .@new_char, .@new_accountid);
				if(!.@query) goto OnNotExist;
				if(select("Continue:Cancel") != 1) goto OnLeave;
					mes "[" + strnpcinfo(1) + "]";
					mes "^009900Gift is ready to go!^000000";
					mes "CID: ^ff0000" + .@new_char + "^000000";
					mes "Name: ^ff0000"+ .@new_name$ + "^000000";
					mes "------------------";
					mes "Item: ^ff0000" + getitemname(.@new_item) + "^000000";
					mes "Quantity: ^ff0000" + .@new_value + "^000000";
					mes "Duration: " + .@duration + " Minutes";
					mes "Claim Time: " + .@c + " Minutes";
				next;
				if(select("Send Gift:Cancel") != 1) goto OnLeave;
				//Check if player is logged in.
				if(isloggedin(.@new_accountid))
				{
					mes "[" + strnpcinfo(1) + "]";
					mes "Gift sending success!";
					query_sql("INSERT INTO `" + .GiftTableName$ + "` (char_id, item, value, duration, timestamp) VALUES (" + .@new_char + ", " + .@new_item + ", " + .@new_value + "," + .@duration + "," + .@claimtime + ")");
				}
				else
				{
					//not online ask if we still give the gift.
					mes "[" + strnpcinfo(1) + "]";
					mes "The character is not online!";
					mes "Would you still like to give the gift?";
					next;
					if(select("Yes:No") != 1) goto OnLeave;
					mes "[" + strnpcinfo(1) + "]";
					mes "Gift sending success!";
					//Create gift. <auto_id>, <account_id> <char_id> <item> <value>
					query_sql("INSERT INTO `" + .GiftTableName$ + "` (char_id, item, value, duration, timestamp) VALUES (" + .@new_char + ", " + .@new_item + ", " + .@new_value + "," + .@duration + "," + .@claimtime + ")");
				}
			}
			announce strcharinfo(0)+" successfully sent " + .@new_value + "x " + getitemname(.@new_item) + " to " + .@new_name$,bc_all;
			break;

		//Register gift to all online accounts!
		case 3:
			mes "[" + strnpcinfo(1) + "]";
			mes "^009900Gift is ready to go!^000000";
			mes "Item: ^ff0000" + getitemname(.@new_item) + "^000000";
			mes "Quantity: ^ff0000" + .@new_value + "^000000";
			mes "Duration: " + .@duration + " Minutes";	
			mes "Claim Time: " + .@c + " Minutes";
			next;
			if(select("Send Gift:Cancel") != 1) goto OnLeave;
			mes "[" + strnpcinfo(1) + "]";
			mes "Please hold...";
			set .@c, 0; //Counting success.
			set .@query, query_sql("SELECT account_id FROM `"+.CharTableName$+"` WHERE online=1",.@account);
			for(set .@i, 0; .@i < .@query; set .@i, .@i + 1) {
				sleep2 25; //Slowdown the loop abit.
				.@at = query_sql("SELECT account_id, char_id FROM "+$GiftTableNameAT$+" WHERE account_id = "+.@account[.@i]+"", .@account_id, .@char_id); // check if in the table
				if (!.@at) {		
					query_sql("INSERT INTO `" + .GiftTableName$ + "` (account_id, item, value, duration, timestamp) VALUES(" + .@account[.@i] + ", " + .@new_item + ", " + .@new_value + ", " + .@duration + ", " + .@claimtime + ")");
				}
			}
			mes "Gift registered to (" + .@i + ") accounts!";
			break;

		//Register gift to all accounts!
		case 4:
			mes "[" + strnpcinfo(1) + "]";
			mes "^009900Gift is ready to go!^000000";
			mes "Item: ^ff0000" + getitemname(.@new_item) + "^000000";
			mes "Quantity: ^ff0000" + .@new_value + "^000000";
			mes "Claim Time: " + .@c + " Minutes";		
			next;
			if(select("Send Gift:Cancel") != 1) goto OnLeave;
			mes "[" + strnpcinfo(1) + "]";
			mes "Please hold...";
			set .@query, query_sql("SELECT account_id FROM `"+.LoginTableName$+"`",.@account);
			for(set .@i, 0; .@i < .@query; set .@i, .@i + 1) {
				sleep2 25; //Slowdown the loop abit.
					query_sql("INSERT INTO `" + .GiftTableName$ + "` (account_id, item, value, duration, timestamp) VALUES(" + .@account[.@i] + ", " + .@new_item + ", " + .@new_value + ", " + .@duration + ", " + .@claimtime + ")");
			}
			mes "Gift registered to (" + .@i + ") accounts!";
			break;

		//Register gift to all online characters!
		case 5:
			mes "[" + strnpcinfo(1) + "]";
			mes "^009900Gift is ready to go!^000000";
			mes "Item: ^ff0000" + getitemname(.@new_item) + "^000000";
			mes "Quantity: ^ff0000" + .@new_value + "^000000";
			mes "Claim Time: " + .@c + " Minutes";		
			next;
			if(select("Send Gift:Cancel") != 1) goto OnLeave;
			mes "[" + strnpcinfo(1) + "]";
			mes "Please hold...";
			set .@c, 0; //Counting success.
			set .@query, query_sql("SELECT char_id FROM `"+.CharTableName$+"` WHERE online=1",.@char);
			for(set .@i, 0; .@i < .@query; set .@i, .@i + 1) {
				sleep2 25; //Slowdown the loop abit.
				.@at = query_sql("SELECT account_id, char_id FROM "+$GiftTableNameAT$+" WHERE char_id = "+.@char[.@i]+"", .@account_id, .@char_id); // check if in the table
				if (!.@at) {
					query_sql("INSERT INTO `" + .GiftTableName$ + "` (char_id, item, value, duration, timestamp) VALUES (" + .@char[.@i] + ", " + .@new_item + ", " + .@new_value + "," + .@duration + "," + .@claimtime + ")");
				}
			}
			mes "Gift registered to (" + .@i + ") players!";
			break;

		//Register gift to all characters!
		case 6:
			mes "[" + strnpcinfo(1) + "]";
			mes "^009900Gift is ready to go!^000000";
			mes "Item: ^ff0000" + getitemname(.@new_item) + "^000000";
			mes "Quantity: ^ff0000" + .@new_value + "^000000";
			mes "Claim Time: " + .@c + " Minutes";	
			next;
			if(select("Send Gift:Cancel") != 1) goto OnLeave;
			mes "[" + strnpcinfo(1) + "]";
			mes "Please hold...";
			set .@query, query_sql("SELECT char_id FROM `"+.CharTableName$+"`",.@char);
			for(set .@i, 0; .@i < .@query; set .@i, .@i + 1) {
				sleep2 25; //Slowdown the loop abit.
				query_sql("INSERT INTO `" + .GiftTableName$ + "` (char_id, item, value, duration, timestamp) VALUES (" + .@char[.@i] + ", " + .@new_item + ", " + .@new_value + "," + .@duration + "," + .@claimtime + ")");
			}
			mes "Gift registered to (" + .@i + ") players!";
			break;

		//Cancel.
		Default:
				mes "[Reward Giver]";
				mes "See you later";
				break;
	}
	close;

OnLeave:
		mes "[Reward Giver]";
		mes "See you later";
		cutin "v_sprakki04",255;
		close;

OnNotExist:
		mes "[" + strnpcinfo(1) + "]";
		mes "This account does not exist!";
		cutin "v_sprakki04",255;
		close;
	
//============Reset Function=========================
OnDelete:
		mes "Which gifts do you want to reset?";
		mes "1. Single Account";
		mes "2. Single Character";
		mes "3. All ^009900Online^000000 Accounts.";
		mes "4. All Accounts.";
		mes "5. All ^009900Online^000000 Players/Characters.";
		mes "6. All Players/Characters.";
		mes "7. All cancel";
		switch(select("Single Account:Single Character:^009900Online^000000 Accounts:All Accounts:^009900Online^000000 Characters:All Characters:Specific Item:IPLimit Logs:Cancel"))
			{
			case 1: //Single Account
				mes "[" + strnpcinfo(1) + "]";
				mes "Please select input type:";
				mes "By AID or Name?";
				next;
				if(select("Account ID:Character Name") == 1)
				{
					mes "[" + strnpcinfo(1) + "]";
					mes "Write account id:";
					next;
					input .@new_account, 2000000, 10000000; //Account id range from 2m to 10m.
					set .@query, query_sql("SELECT account_id FROM `" + .CharTableName$ + "` WHERE account_id = " + .@new_account, .@new_account);
					if(!.@query) goto OnNotExist;
					if(select("Continue:Cancel") != 1) goto OnLeave;
						query_sql("DELETE FROM " + .GiftTableName$ + " WHERE account_id = " + .@new_account);
				}
				else
				{
					mes "[" + strnpcinfo(1) + "]";
					mes "Write player name:";
					next;
					input .@new_name$;
					set .@query, query_sql("SELECT account_id FROM `" + .CharTableName$ + "` WHERE name = '" + .@new_name$ + "'", .@new_account);
					if(!.@query) goto OnNotExist;
					if(select("Continue:Cancel") != 1) goto OnLeave;
						query_sql("DELETE FROM " + .GiftTableName$ + " WHERE account_id = " + .@new_account);
				}
				break;
			case 2: //Single Character
				mes "[" + strnpcinfo(1) + "]";
				mes "Please select input type:";
				mes "By CID or Name?";
				next;
				if(select("Character ID:Character Name") == 1)
				{
					mes "[" + strnpcinfo(1) + "]";
					mes "Write character id:";
					next;
					input .@new_char,150000, 10000000; //Char id range from 150k to 10m.
					set .@query, query_sql("SELECT account_id, name FROM `" + .CharTableName$ + "` WHERE char_id = " + .@new_char, .@new_accountid, .@new_name$);
					if(!.@query) goto OnNotExist;
					if(select("Continue:Cancel") != 1) goto OnLeave;
						query_sql("DELETE FROM " + .GiftTableName$ + " WHERE char_id = " + .@new_char);
				}
				else
				{
					mes "[" + strnpcinfo(1) + "]";
					mes "Write player name:";
					next;
					input .@new_name$;
					set .@query, query_sql("SELECT char_id, account_id FROM `" + .CharTableName$ + "` WHERE name = '" + .@new_name$ + "'", .@new_char, .@new_accountid);
					if(!.@query) goto OnNotExist;
					if(select("Continue:Cancel") != 1) goto OnLeave;
						query_sql("DELETE FROM " + .GiftTableName$ + " WHERE char_id = " + .@new_char);
				}
				break;
			case 3: //All Online Accounts.
				mes "[" + strnpcinfo(1) + "]";
				mes "Please hold...";
				set .@c, 0; //Counting success.
				set .@query, query_sql("SELECT account_id FROM `"+.CharTableName$+"` WHERE online=1",.@account);
				for(set .@i, 0; .@i < .@query; set .@i, .@i + 1) {
					sleep2 25; //Slowdown the loop abit.
					query_sql("DELETE FROM " + .GiftTableName$ + " WHERE account_id = " + .@account[.@i]);
				}
				break;
			case 4: //All Accounts.
				query_sql("DELETE FROM " + .GiftTableName$ + " WHERE account_id >= 1");
				break;
			case 5: //All Online Players/Characters.
				mes "[" + strnpcinfo(1) + "]";
				mes "Please hold...";
				set .@c, 0; //Counting success.
				set .@query, query_sql("SELECT char_id FROM `"+.CharTableName$+"` WHERE online=1",.@char);
				for(set .@i, 0; .@i < .@query; set .@i, .@i + 1)
					{
						sleep2 25; //Slowdown the loop abit.
						query_sql("DELETE FROM " + .GiftTableName$ + " WHERE char_id = " + .@char[.@i]);
					}
				break;
			case 6: //All Players/Characters.
				query_sql("TRUNCATE TABLE " + .GiftTableName$);
				break;
			case 7: // Delete specific item
				mes "Please type the id of the item you wish to delete";
				mes "This will delete all entries with the item id you typed";
				input(.@deletethis);
				next;
				mes "Are you sure you want to delete all entries of " + .@deletethis;
				if (select("Yes:No")==1)
					{
						query_sql("DELETE FROM " + .GiftTableName$ + " WHERE item = " + .@deletethis + "");
					}
					else
					{
						mes "Deletion cancelled";
						close;
					}
			case 8: //All ip logs
				query_sql("TRUNCATE TABLE " + .GiftTableNameIP$);
				break;
			default:
				break;
		}
		next;
		mes "deletion finished";
		cutin "v_sprakki04",255;
		close;

OnLimit:
	mes "Please enter an ip limit, current limit is " + .ip_limit;
	input(.ip_limit);
	mes "Done!";
	cutin "v_sprakki04",255;
	close;

//============================================================ 
// Config/Edit:
//============================================================ 
OnLoadSetup:
	set .Setup, 1;	//OnInit is loaded check.
	set .GMin, 60;	//Minimum GM level to use gm panel.
	set .ZenyID,23500; // put this when asked for which item to give zeny.
	set .MaxZeny,1000000000;
	//Your table names:
	set .CharTableName$, "char";	//Character table name(SQL).
	set .LoginTableName$, "login";
	set .GiftTableName$, "reward";	//Gift table name(SQL).
	set .GiftTableNameIP$, "reward_ip";	//Gift table name for ip tracker
	set $GiftTableNameAT$, "reward_at";	//Gift table name for auto trade tracker
	//Create gift table <auto_id>, <account_id>, <char_id>, <item>, <value>

	query_sql("CREATE TABLE IF NOT EXISTS `reward` (`id` int(11) NOT NULL AUTO_INCREMENT,`account_id` int(11) unsigned NOT NULL DEFAULT '0',`char_id` int(11) unsigned NOT NULL DEFAULT '0',`item` int(11) NOT NULL DEFAULT '0',`value` int(11) NOT NULL DEFAULT '0',`duration` int(11) NOT NULL DEFAULT '0',`timestamp` int(23) NOT NULL DEFAULT '0',PRIMARY KEY (`id`))");
	query_sql("CREATE TABLE IF NOT EXISTS `reward_ip` ( `give_id` int(11) NOT NULL,  `item_id` int(11) NOT NULL,  `ip_address` varchar(23) NOT NULL, `claim_count` int(11) NOT NULL,  PRIMARY KEY (`give_id`))");
	query_sql("CREATE TABLE IF NOT EXISTS `reward_at` (`account_id` int(11) NOT NULL,`char_id` int(11) NOT NULL)");
	return;

OnInit:
      waitingroom "Prize Giver",0;
	callsub OnLoadSetup;
	end;
}

/* Manual table update for at tracker 
CREATE TABLE IF NOT EXISTS `reward_at` (
  `account_id` int(11) NOT NULL,
  `char_id` int(11) NOT NULL
);
*/
-	script	anti_trader	-1,{
	
OnInit:
	.is_anti_trade = 1; // 0 to disable
	end;
	
}
function	script	PG_30Seconds	{
	//dispbottom "anti trader 30sec";
	//Check if Vending (normal or @at)
	if(checkvending() >= 1)
	{
	   // mark as auto trader
	   	.@query = query_sql("SELECT account_id, char_id FROM "+$GiftTableNameAT$+" WHERE account_id = "+getcharid(3)+"", .@account_id, .@char_id); // check if in the table
		if (!.@query)
		{ // add if not there yet
			query_sql("INSERT INTO "+$GiftTableNameAT$+"(account_id,char_id) VALUES("+getcharid(3)+","+getcharid(0)+")");
			//dispbottom "you have been marked as auto trader";
			stopnpctimer;
			detachnpctimer;
			end;
		}
	}
	return;
}
function	script	PG_Login	{
	//dispbottom "at delete";
	.@query = query_sql("SELECT account_id, char_id FROM "+$GiftTableNameAT$+" WHERE account_id = "+getcharid(3)+"", .@account_id, .@char_id); // check if in the table
	if (.@query)
	{ // remove to reverify vending status
		query_sql("DELETE FROM "+$GiftTableNameAT$+" WHERE account_id = "+getcharid(3)+"");
	}
}

I only put Waitingroom due to the fact that your request for announcement is not precise or accurate. doesn't even know when you want to announce or what to announce..

As i've seen that you always Request for Waitingrooms.. you can do it by Looking for the OnInit of the script and add the line waitingroom.. if there's no OnInit, you can create one and add the OnInit: waitingroom end;

i was able to put on some npc with waiting room. but some I cant really handle. Thank you again.  The prize giver worked perfect! YOURE SUPER DUPER AWESOME!.   

I got problems on quest board.  Npc didn't show up. also got errors.  if its not too much to ask, is it possible to put announce global after get reward from Quest Board? like "thisplayer" completed the monster quest and received Event Ticket"

image.png.e8ed208fa895930866db6f92b3c836b7.png

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  477
  • Reputation:   269
  • Joined:  06/13/17
  • Last Seen:  

You need to click the CODEBOX first before you insert/paste the script. you must not highlight then click CODEBOX, this will make the code broken..

Simply add this 

OnInit:
	waitingroom "Quest Board",0;
	function AddCollection;
	function AddHunting;
  • MVP 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  34
  • Topics Per Day:  0.02
  • Content Count:  101
  • Reputation:   3
  • Joined:  04/15/20
  • Last Seen:  

6 minutes ago, Haruka Mayumi said:

You need to click the CODEBOX first before you insert/paste the script. you must not highlight then click CODEBOX, this will make the code broken..

Simply add this 


OnInit:
	waitingroom "Quest Board",0;
	function AddCollection;
	function AddHunting;

Unbelievable. I tried it earlier on my end. didnt worked. But your touches makes my day and server complete. Thank You so much! Youre the best!!!!

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  30
  • Topics Per Day:  0.01
  • Content Count:  108
  • Reputation:   1
  • Joined:  02/10/12
  • Last Seen:  

try this one..

//======= 3ceam Script =======================================
//= Prize Giver NPC
//===== Modified By: =========================================
//= Keitenai
//===== Current Version: =====================================
//= 1.0
//===== Compatible With: =====================================
//= Athena Project
//===== Description: =========================================
//= Prize giver for single char, account and more.
//===== Additional Comments: =================================
//= 1.0 Modified Version for 3ceam compatibility
//============================================================

prontera,147,173,4	script	Server Reward	544,{
	//cutin "v_sprakki04",2;
	//Check if setups are loaded.
	if(!.Setup)
		{
			callsub OnLoadSetup;
		}

	//Show GM Panel if player is GM.
	if(getgmlevel() >= .GMin)
		menu("Take a prize as a player",-,"Give prize",
				OnManagement,"Reset Item Give",
				OnDelete,"IP Limit per Item",
				OnLimit);

	//Read attached player gifts from SQL table.
	if(select("Get Account Prize!:Get Character Prize!:Exit") == 1)
		{
			set .@query, query_sql("SELECT * FROM `" + .GiftTableName$ + "` WHERE account_id="+getcharid(3),
				.@gift_id,
				.@gift_account,
				.@gift_char,
				.@gift_item,
				.@gift_amount,
				.@gift_duration,
				.@gift_time
				); //Account gifts.
		}
		else if(@menu == 2)
		{
			set .@query, query_sql("SELECT * FROM `" + .GiftTableName$ + "` WHERE char_id="+getcharid(0),
				.@gift_id,
				.@gift_account,
				.@gift_char,
				.@gift_item,
				.@gift_amount,
				.@gift_duration,
				.@gift_time
				); //Char gifts.
		}
		else goto OnLeave;

	//Check if player don't have gifts.
	if(!.@query)
		{
			mes "[Reward Giver]";
			mes "Sorry, you don't have any prize";

			cutin "v_sprakki04",255;
			close;
		}

	//Build menu from query arrays.
		mes "[" + strnpcinfo(1) + "]";
		mes "^009900You got the prize^000000";
			for( set .@i, 0; .@i < .@query; set .@i, .@i + 1 )
			{
				mes "(" + .@gift_amount[.@i] + ") " + getitemname(.@gift_item[.@i]) + ".";
				set .@menu$, .@menu$ + getitemname(.@gift_item[.@i]) + ":";
			}
			next;
			set .@mid,select(.@menu$); //Show menu.
			set .@mid,.@mid-1;

	if (.@gift_time[.@mid] && .@gift_time[.@mid] < gettimetick(2))
	{
		mes "[Reward Giver]";
		mes "Sorry, this prize's claim time is already over.";

		cutin "v_sprakki04",255;
		close;
	}
	//Item is now selected. Choose what you want to do with it.
	mes "[" + strnpcinfo(1) + "]";
	mes "what you want do with (" + .@gift_amount[.@mid] + ") " + getitemname(.@gift_item[.@mid]) + "?";
	next;
	set .@Select,select("^009900Get it^000000:^ff0000Delete it! ^000000:nothings");

	//Receive gift selected.
	
	if(.@Select == 1)
	{
		//Check weight.
		if(checkweight( .@gift_item, .@gift_amount ) || .@gift_item[.@mid] == .ZenyID)
		{
			mes "[" + strnpcinfo(1) + "]";
			mes "^009900Get : (" + .@gift_amount[.@mid] + ") " + getitemname(.@gift_item[.@mid]) + ".^000000";
			if (.ip_limit)
			{
				// add ip_address to logs
				.@ipexist = query_sql("SELECT item_id, ip_address, claim_count FROM " + .GiftTableNameIP$ + " WHERE last_ip = (SELECT last_ip FROM login WHERE account_id="+getcharid(3)+") AND item_id = "+.@gift_item[.@mid]+" LIMIT 1", .@item,.@ip,.@claim_count);
				if (.@claim_count[0] >= .ip_limit)
				{
					next;
					mes "Sorry you have reached the maximum redeem limit for this IP address";
					cutin "v_sprakki04",255;
					close;
				}
				if (!.@claim_count[0])
				{
					query_sql("INSERT INTO " + .GiftTableNameIP$ + " (give_id,item_id,last_ip,claim_count) VALUES("+.@gift_id+","+.@gift_item+",'(SELECT last_ip FROM login WHERE account_id="+getcharid(3)+")',1)");		
				}
				else
				{
					query_sql("UPDATE " + .GiftTableNameIP$ + " SET claim_count = "+(.@claim_count[0]+1)+" WHERE item_id = "+.@gift_item[.@mid]+" AND last_ip = (SELECT last_ip FROM login WHERE account_id="+getcharid(3)+")");
				}
			}
			if (.@gift_item[.@mid] == .ZenyID) { // detects zeny ID and give zeny.
				if (Zeny+.@gift_amount[.@mid] > .MaxZeny)
				{
					mes "Please make sure that you have enough space to handle all these zennies and come back later.";
					cutin "v_sprakki04",255;
					close;
				}
				set Zeny,Zeny+.@gift_amount[.@mid];
			}
			else
			{
				if (!.@gift_duration)
				{
					getitem .@gift_item[.@mid], .@gift_amount[.@mid]; //Give item to player.
				}
				else
				{
					rentitem .@gift_item[.@mid], .@gift_duration * 60; 
				}
			}
			query_sql( "DELETE FROM `" + .GiftTableName$ + "` WHERE id = " + .@gift_id[.@mid] ); //Remove item from table.
			cutin "v_sprakki04",255;
			close;
		}
		else
		{
			//Overweight
			mes "^ff0000Sorry ^000000 You can't take it " + getitemname(.@gift_item[.@mid]);
			mes "Could lose some wight?";
			cutin "v_sprakki04",255;
			close;
		}
	}
	//Remove gift selected.
	else if(.@Select == 2) {
		mes "[" + strnpcinfo(1) + "]";
		mes "Are you sure you want dellet it?";
		mes "Gift: ("+.@gift_amount[.@mid]+") "+getitemname(.@gift_item[.@mid])+".";
		next;
		if(select("Yes:No") == 1) {
			mes "[" + strnpcinfo(1) + "]";
			mes "^ff0000Dellet: ("+.@gift_amount[.@mid]+") "+getitemname(.@gift_item[.@mid])+".^000000";
			query_sql("DELETE FROM `" + .GiftTableName$ + "` WHERE id = " + .@gift_id[.@mid]); //Remove item from table.
			cutin "v_sprakki04",255;
			close;
		} else {
			mes "[" + strnpcinfo(1) + "]";
			mes "we will save it";
			cutin "v_sprakki04",255;
			close;
		}
	}
	//Nothing selected.
	else
	{
		goto OnLeave;
	}

//GM Panel below:
OnManagement:
	if(getgmlevel() < .GMin) goto OnLeave;
	mes "[" + strnpcinfo(1) + "]";
	mes "Welvome " + strcharinfo(0) + "!";
	mes "How I can help you?";
	next;

	if(select("Make Gift:Nothing") != 1) goto OnLeave;

		//Make new gift.
		mes "[" + strnpcinfo(1) + "]";
		mes "Please input the item id.";
		mes "Default: 501";
	next;
		mes "What do you want to give?";
		set .@zenygive,0;
			if(select("Item:Zeny") == 1)
				{
					input .@new_item, 501, 30000;
				}
	next;
	mes "Do you want to add a claim timer?";
	if(select("No:Yes")==2)
	{
		next;
		mes "How many minutes do you want this reward to be claimable?";
		input(.@c);
		.@claimtime = gettimetick(2)+(.@c*60);
	}
	if(select("Continue:Cancel") != 1) goto OnLeave;
		mes "[" + strnpcinfo(1) + "]";
		mes "How many items/zeny?";
		mes "Default: 1";
	next;
	//item quantity range of 1 to 1,000.
	if(.@zenygive)
	{
		input .@new_value, 1, .MaxZeny;
	}
	else
	{
		input .@new_value, 1, 1000;
	}
	
	if(select("Continue:Cancel") != 1) goto OnLeave;
		mes "[" + strnpcinfo(1) + "]";
		mes "Please select input type:";
		mes "1. Single Account";
		mes "2. Single Character";
		mes "3. All ^009900Online^000000 Accounts.";
		mes "4. All Accounts.";
		mes "5. All ^009900Online^000000 Players/Characters.";
		mes "6. All Players/Characters.";
		mes "7. ^ff0000Cancel.^000000";
	next;
	switch(select("Single Account:Single Character:^009900Online^000000 Accounts:All Accounts:^009900Online^000000 Characters:All Characters:Cancel"))
	{
		//Account gift
		case 1:
			mes "[" + strnpcinfo(1) + "]";
			mes "Please select input type:";
			mes "By AID or Name?";
			next;
			if(select("Account ID:Character Name") == 1)
			{
				mes "[" + strnpcinfo(1) + "]";
				mes "Write account id:";
				next;
				input .@new_account, 2000000, 10000000; //Account id range from 2m to 10m.
				set .@query, query_sql("SELECT account_id FROM `" + .CharTableName$ + "` WHERE account_id = " + .@new_account, .@new_account);
				if(!.@query) goto OnNotExist;
				if(select("Continue:Cancel") != 1) goto OnLeave;
				mes "[" + strnpcinfo(1) + "]";
				mes "^009900Gift is ready to go!^000000";
				mes "AID: ^ff0000" + .@new_account + "^000000";
				mes "------------------";
				mes "Item: ^ff0000" + getitemname(.@new_item) + "^000000";
				mes "Quantity: ^ff0000" + .@new_value + "^000000";
				mes "Duration: " + .@duration + " Minutes";
				mes "Claim Time: " + .@c + " Minutes";
				next;
				if(select("Send Gift:Cancel") != 1) goto OnLeave;
				mes "[" + strnpcinfo(1) + "]";
				mes "Gift sending success!";
				//Create gift. <auto_id>, <account_id> <char_id> <item> <value>
				query_sql("INSERT INTO `" + .GiftTableName$ + "` (account_id, item, value, duration, timestamp) VALUES(" + .@new_account + ", " + .@new_item + ", " + .@new_value + ", " + .@duration + ", " + .@claimtime + ")");
			}
			else
			{
				mes "[" + strnpcinfo(1) + "]";
				mes "Write player name:";
				next;
				input .@new_name$;
				set .@query, query_sql("SELECT account_id FROM `" + .CharTableName$ + "` WHERE name = '" + .@new_name$ + "'", .@new_account);
				if(!.@query) goto OnNotExist;
				if(select("Continue:Cancel") != 1) goto OnLeave;
				mes "[" + strnpcinfo(1) + "]";
				mes "^009900Gift is ready to go!^000000";
				mes "AID: ^ff0000" + .@new_account + "^000000";
				mes "Name: ^ff0000"+ .@new_name$ + "^000000";
				mes "------------------";
				mes "Item: ^ff0000" + getitemname(.@new_item) + "^000000";
				mes "Quantity: ^ff0000" + .@new_value + "^000000";
				mes "Duration: " + .@duration + " Minutes";
				mes "Claim Time: " + .@c + " Minutes";
				next;
				if(select("Send Gift:Cancel") != 1) goto OnLeave;
				//Check if player is logged in.
				if(isloggedin(.@new_account)) {
					mes "[" + strnpcinfo(1) + "]";
					mes "Gift sending success!";
					query_sql("INSERT INTO `" + .GiftTableName$ + "` (account_id, item, value, duration, timestamp) VALUES(" + .@new_account + ", " + .@new_item + ", " + .@new_value + ", " + .@duration + ", " + .@claimtime + ")");
				} else {
					//Account was not online.
					mes "[" + strnpcinfo(1) + "]";
					mes "Gift sending success!";
					query_sql("INSERT INTO `" + .GiftTableName$ + "` (account_id, item, value, duration, timestamp) VALUES(" + .@new_account + ", " + .@new_item + ", " + .@new_value + ", " + .@duration + ", " + .@claimtime + ")"); // duplicate to other menus - continue here on giver side
				}
			}
			announce "[GM] "+strcharinfo(0)+" successfully sent " + .@new_value + "x as a Gift " + getitemname(.@new_item) + " to " + .@new_name$,bc_all;
			break;

		//Character gift.
		case 2:
			mes "[" + strnpcinfo(1) + "]";
			mes "Please select input type:";
			mes "By CID or Name?";
			next;
			if(select("Character ID:Character Name") == 1)
			{
				mes "[" + strnpcinfo(1) + "]";
				mes "Write character id:";
				next;
				input .@new_char,150000, 10000000; //Char id range from 150k to 10m.
				set .@query, query_sql("SELECT account_id, name FROM `" + .CharTableName$ + "` WHERE char_id = " + .@new_char, .@new_accountid, .@new_name$);
				if(!.@query) goto OnNotExist;
				if(select("Continue:Cancel") != 1) goto OnLeave;
					mes "[" + strnpcinfo(1) + "]";
					mes "^009900Gift is ready to go!^000000";
					mes "CID: ^ff0000" + .@new_char + "^000000";
					mes "Name: ^ff0000" + .@new_name$ + "^000000";
					mes "------------------";
					mes "Item: ^ff0000" + getitemname(.@new_item) + "^000000";
					mes "Quantity: ^ff0000" + .@new_value + "^000000";
					mes "Duration: " + .@duration + " Minutes";
					mes "Claim Time: " + .@c + " Minutes";
				next;
				if(select("Send Gift:Cancel") != 1) goto OnLeave;
				//Check if player is logged in.
				if(isloggedin(.@new_accountid)) {
					mes "[" + strnpcinfo(1) + "]";
					mes "Gift sending success!";

					//Create gift. <auto_id>, <account_id> <char_id> <item> <value>
					query_sql("INSERT INTO `" + .GiftTableName$ + "` (char_id, item, value, duration, timestamp) VALUES (" + .@new_char + ", " + .@new_item + ", " + .@new_value + "," + .@duration + "," + .@claimtime + ")");
				} else {
					//not online ask if we still give the gift.
					mes "[" + strnpcinfo(1) + "]";
					mes "The character is not online!";
					mes "Would you still like to send the gift?";
					next;
					if(select("Yes:No") != 1) goto OnLeave;
					mes "[" + strnpcinfo(1) + "]";
					mes "Gift sending success!";
					//Create gift. <auto_id>, <account_id> <char_id> <item> <value>
					query_sql("INSERT INTO `" + .GiftTableName$ + "` (char_id, item, value, duration, timestamp) VALUES (" + .@new_char + ", " + .@new_item + ", " + .@new_value + "," + .@duration + "," + .@claimtime + ")");
				}

			}
			else
			{
				mes "[" + strnpcinfo(1) + "]";
				mes "Write player name:";
				next;
				input .@new_name$;
				set .@query, query_sql("SELECT char_id, account_id FROM `" + .CharTableName$ + "` WHERE name = '" + .@new_name$ + "'", .@new_char, .@new_accountid);
				if(!.@query) goto OnNotExist;
				if(select("Continue:Cancel") != 1) goto OnLeave;
					mes "[" + strnpcinfo(1) + "]";
					mes "^009900Gift is ready to go!^000000";
					mes "CID: ^ff0000" + .@new_char + "^000000";
					mes "Name: ^ff0000"+ .@new_name$ + "^000000";
					mes "------------------";
					mes "Item: ^ff0000" + getitemname(.@new_item) + "^000000";
					mes "Quantity: ^ff0000" + .@new_value + "^000000";
					mes "Duration: " + .@duration + " Minutes";
					mes "Claim Time: " + .@c + " Minutes";
				next;
				if(select("Send Gift:Cancel") != 1) goto OnLeave;
				//Check if player is logged in.
				if(isloggedin(.@new_accountid))
				{
					mes "[" + strnpcinfo(1) + "]";
					mes "Gift sending success!";
					query_sql("INSERT INTO `" + .GiftTableName$ + "` (char_id, item, value, duration, timestamp) VALUES (" + .@new_char + ", " + .@new_item + ", " + .@new_value + "," + .@duration + "," + .@claimtime + ")");
				}
				else
				{
					//not online ask if we still give the gift.
					mes "[" + strnpcinfo(1) + "]";
					mes "The character is not online!";
					mes "Would you still like to give the gift?";
					next;
					if(select("Yes:No") != 1) goto OnLeave;
					mes "[" + strnpcinfo(1) + "]";
					mes "Gift sending success!";
					//Create gift. <auto_id>, <account_id> <char_id> <item> <value>
					query_sql("INSERT INTO `" + .GiftTableName$ + "` (char_id, item, value, duration, timestamp) VALUES (" + .@new_char + ", " + .@new_item + ", " + .@new_value + "," + .@duration + "," + .@claimtime + ")");
				}
			}
			announce "[GM] "+strcharinfo(0)+" successfully sent " + .@new_value + "x as a Gift " + getitemname(.@new_item) + " to " + .@new_name$,bc_all;
			break;

		//Register gift to all online accounts!
		case 3:
			mes "[" + strnpcinfo(1) + "]";
			mes "^009900Gift is ready to go!^000000";
			mes "Item: ^ff0000" + getitemname(.@new_item) + "^000000";
			mes "Quantity: ^ff0000" + .@new_value + "^000000";
			mes "Duration: " + .@duration + " Minutes";	
			mes "Claim Time: " + .@c + " Minutes";
			next;
			if(select("Send Gift:Cancel") != 1) goto OnLeave;
			mes "[" + strnpcinfo(1) + "]";
			mes "Please hold...";
			set .@c, 0; //Counting success.
			set .@query, query_sql("SELECT account_id FROM `"+.CharTableName$+"` WHERE online=1",.@account);
			for(set .@i, 0; .@i < .@query; set .@i, .@i + 1) {
				sleep2 25; //Slowdown the loop abit.
				.@at = query_sql("SELECT account_id, char_id FROM "+$GiftTableNameAT$+" WHERE account_id = "+.@account[.@i]+"", .@account_id, .@char_id); // check if in the table
				if (!.@at) {		
					query_sql("INSERT INTO `" + .GiftTableName$ + "` (account_id, item, value, duration, timestamp) VALUES(" + .@account[.@i] + ", " + .@new_item + ", " + .@new_value + ", " + .@duration + ", " + .@claimtime + ")");
				}
			}
			mes "Gift registered to (" + .@i + ") accounts!";
			announce "[GM] "+strcharinfo(0)+" successfully sent " + .@new_value + "x as a Gift " + getitemname(.@new_item) + " to all Online!",bc_all;
			break;

		//Register gift to all accounts!
		case 4:
			mes "[" + strnpcinfo(1) + "]";
			mes "^009900Gift is ready to go!^000000";
			mes "Item: ^ff0000" + getitemname(.@new_item) + "^000000";
			mes "Quantity: ^ff0000" + .@new_value + "^000000";
			mes "Claim Time: " + .@c + " Minutes";		
			next;
			if(select("Send Gift:Cancel") != 1) goto OnLeave;
			mes "[" + strnpcinfo(1) + "]";
			mes "Please hold...";
			set .@query, query_sql("SELECT account_id FROM `"+.LoginTableName$+"`",.@account);
			for(set .@i, 0; .@i < .@query; set .@i, .@i + 1) {
				sleep2 25; //Slowdown the loop abit.
					query_sql("INSERT INTO `" + .GiftTableName$ + "` (account_id, item, value, duration, timestamp) VALUES(" + .@account[.@i] + ", " + .@new_item + ", " + .@new_value + ", " + .@duration + ", " + .@claimtime + ")");
			}
			mes "Gift registered to (" + .@i + ") accounts!";
			announce "[GM] "+strcharinfo(0)+" successfully sent " + .@new_value + "x as a Gift " + getitemname(.@new_item) + " to Everyone.",bc_all;
			break;

		//Register gift to all online characters!
		case 5:
			mes "[" + strnpcinfo(1) + "]";
			mes "^009900Gift is ready to go!^000000";
			mes "Item: ^ff0000" + getitemname(.@new_item) + "^000000";
			mes "Quantity: ^ff0000" + .@new_value + "^000000";
			mes "Claim Time: " + .@c + " Minutes";		
			next;
			if(select("Send Gift:Cancel") != 1) goto OnLeave;
			mes "[" + strnpcinfo(1) + "]";
			mes "Please hold...";
			set .@c, 0; //Counting success.
			set .@query, query_sql("SELECT char_id FROM `"+.CharTableName$+"` WHERE online=1",.@char);
			for(set .@i, 0; .@i < .@query; set .@i, .@i + 1) {
				sleep2 25; //Slowdown the loop abit.
				.@at = query_sql("SELECT account_id, char_id FROM "+$GiftTableNameAT$+" WHERE char_id = "+.@char[.@i]+"", .@account_id, .@char_id); // check if in the table
				if (!.@at) {
					query_sql("INSERT INTO `" + .GiftTableName$ + "` (char_id, item, value, duration, timestamp) VALUES (" + .@char[.@i] + ", " + .@new_item + ", " + .@new_value + "," + .@duration + "," + .@claimtime + ")");
				}
			}
			mes "Gift registered to (" + .@i + ") players!";
			announce "[GM] "+strcharinfo(0)+" successfully sent " + .@new_value + "x as a Gift " + getitemname(.@new_item) + " to all Online Characters",bc_all;
			break;

		//Register gift to all characters!
		case 6:
			mes "[" + strnpcinfo(1) + "]";
			mes "^009900Gift is ready to go!^000000";
			mes "Item: ^ff0000" + getitemname(.@new_item) + "^000000";
			mes "Quantity: ^ff0000" + .@new_value + "^000000";
			mes "Claim Time: " + .@c + " Minutes";	
			next;
			if(select("Send Gift:Cancel") != 1) goto OnLeave;
			mes "[" + strnpcinfo(1) + "]";
			mes "Please hold...";
			set .@query, query_sql("SELECT char_id FROM `"+.CharTableName$+"`",.@char);
			for(set .@i, 0; .@i < .@query; set .@i, .@i + 1) {
				sleep2 25; //Slowdown the loop abit.
				query_sql("INSERT INTO `" + .GiftTableName$ + "` (char_id, item, value, duration, timestamp) VALUES (" + .@char[.@i] + ", " + .@new_item + ", " + .@new_value + "," + .@duration + "," + .@claimtime + ")");
			}
			mes "Gift registered to (" + .@i + ") players!";
			announce "[GM] "+strcharinfo(0)+" successfully sent " + .@new_value + "x as a Gift " + getitemname(.@new_item) + " to " + .@new_name$,bc_all;
			break;

		//Cancel.
		Default:
				mes "[Reward Giver]";
				mes "See you later";
				break;
	}
	close;

OnLeave:
		mes "[Reward Giver]";
		mes "See you later";
		cutin "v_sprakki04",255;
		close;

OnNotExist:
		mes "[" + strnpcinfo(1) + "]";
		mes "This account does not exist!";
		cutin "v_sprakki04",255;
		close;
	
//============Reset Function=========================
OnDelete:
		mes "Which gifts do you want to reset?";
		mes "1. Single Account";
		mes "2. Single Character";
		mes "3. All ^009900Online^000000 Accounts.";
		mes "4. All Accounts.";
		mes "5. All ^009900Online^000000 Players/Characters.";
		mes "6. All Players/Characters.";
		mes "7. All cancel";
		switch(select("Single Account:Single Character:^009900Online^000000 Accounts:All Accounts:^009900Online^000000 Characters:All Characters:Specific Item:IPLimit Logs:Cancel"))
			{
			case 1: //Single Account
				mes "[" + strnpcinfo(1) + "]";
				mes "Please select input type:";
				mes "By AID or Name?";
				next;
				if(select("Account ID:Character Name") == 1)
				{
					mes "[" + strnpcinfo(1) + "]";
					mes "Write account id:";
					next;
					input .@new_account, 2000000, 10000000; //Account id range from 2m to 10m.
					set .@query, query_sql("SELECT account_id FROM `" + .CharTableName$ + "` WHERE account_id = " + .@new_account, .@new_account);
					if(!.@query) goto OnNotExist;
					if(select("Continue:Cancel") != 1) goto OnLeave;
						query_sql("DELETE FROM " + .GiftTableName$ + " WHERE account_id = " + .@new_account);
				}
				else
				{
					mes "[" + strnpcinfo(1) + "]";
					mes "Write player name:";
					next;
					input .@new_name$;
					set .@query, query_sql("SELECT account_id FROM `" + .CharTableName$ + "` WHERE name = '" + .@new_name$ + "'", .@new_account);
					if(!.@query) goto OnNotExist;
					if(select("Continue:Cancel") != 1) goto OnLeave;
						query_sql("DELETE FROM " + .GiftTableName$ + " WHERE account_id = " + .@new_account);
				}
				break;
			case 2: //Single Character
				mes "[" + strnpcinfo(1) + "]";
				mes "Please select input type:";
				mes "By CID or Name?";
				next;
				if(select("Character ID:Character Name") == 1)
				{
					mes "[" + strnpcinfo(1) + "]";
					mes "Write character id:";
					next;
					input .@new_char,150000, 10000000; //Char id range from 150k to 10m.
					set .@query, query_sql("SELECT account_id, name FROM `" + .CharTableName$ + "` WHERE char_id = " + .@new_char, .@new_accountid, .@new_name$);
					if(!.@query) goto OnNotExist;
					if(select("Continue:Cancel") != 1) goto OnLeave;
						query_sql("DELETE FROM " + .GiftTableName$ + " WHERE char_id = " + .@new_char);
				}
				else
				{
					mes "[" + strnpcinfo(1) + "]";
					mes "Write player name:";
					next;
					input .@new_name$;
					set .@query, query_sql("SELECT char_id, account_id FROM `" + .CharTableName$ + "` WHERE name = '" + .@new_name$ + "'", .@new_char, .@new_accountid);
					if(!.@query) goto OnNotExist;
					if(select("Continue:Cancel") != 1) goto OnLeave;
						query_sql("DELETE FROM " + .GiftTableName$ + " WHERE char_id = " + .@new_char);
				}
				break;
			case 3: //All Online Accounts.
				mes "[" + strnpcinfo(1) + "]";
				mes "Please hold...";
				set .@c, 0; //Counting success.
				set .@query, query_sql("SELECT account_id FROM `"+.CharTableName$+"` WHERE online=1",.@account);
				for(set .@i, 0; .@i < .@query; set .@i, .@i + 1) {
					sleep2 25; //Slowdown the loop abit.
					query_sql("DELETE FROM " + .GiftTableName$ + " WHERE account_id = " + .@account[.@i]);
				}
				break;
			case 4: //All Accounts.
				query_sql("DELETE FROM " + .GiftTableName$ + " WHERE account_id >= 1");
				break;
			case 5: //All Online Players/Characters.
				mes "[" + strnpcinfo(1) + "]";
				mes "Please hold...";
				set .@c, 0; //Counting success.
				set .@query, query_sql("SELECT char_id FROM `"+.CharTableName$+"` WHERE online=1",.@char);
				for(set .@i, 0; .@i < .@query; set .@i, .@i + 1)
					{
						sleep2 25; //Slowdown the loop abit.
						query_sql("DELETE FROM " + .GiftTableName$ + " WHERE char_id = " + .@char[.@i]);
					}
				break;
			case 6: //All Players/Characters.
				query_sql("TRUNCATE TABLE " + .GiftTableName$);
				break;
			case 7: // Delete specific item
				mes "Please type the id of the item you wish to delete";
				mes "This will delete all entries with the item id you typed";
				input(.@deletethis);
				next;
				mes "Are you sure you want to delete all entries of " + .@deletethis;
				if (select("Yes:No")==1)
					{
						query_sql("DELETE FROM " + .GiftTableName$ + " WHERE item = " + .@deletethis + "");
					}
					else
					{
						mes "Deletion cancelled";
						close;
					}
			case 8: //All ip logs
				query_sql("TRUNCATE TABLE " + .GiftTableNameIP$);
				break;
			default:
				break;
		}
		next;
		mes "deletion finished";
		cutin "v_sprakki04",255;
		close;

OnLimit:
	mes "Please enter an ip limit, current limit is " + .ip_limit;
	input(.ip_limit);
	mes "Done!";
	cutin "v_sprakki04",255;
	close;

//============================================================ 
// Config/Edit:
//============================================================ 
OnLoadSetup:
	set .Setup, 1;	//OnInit is loaded check.
	set .GMin, 60;	//Minimum GM level to use gm panel.
	set .ZenyID,23500; // put this when asked for which item to give zeny.
	set .MaxZeny,1000000000;
	//Your table names:
	set .CharTableName$, "char";	//Character table name(SQL).
	set .LoginTableName$, "login";
	set .GiftTableName$, "reward";	//Gift table name(SQL).
	set .GiftTableNameIP$, "reward_ip";	//Gift table name for ip tracker
	set $GiftTableNameAT$, "reward_at";	//Gift table name for auto trade tracker
	//Create gift table <auto_id>, <account_id>, <char_id>, <item>, <value>

	query_sql("CREATE TABLE IF NOT EXISTS `reward` (`id` int(11) NOT NULL AUTO_INCREMENT,`account_id` int(11) unsigned NOT NULL DEFAULT '0',`char_id` int(11) unsigned NOT NULL DEFAULT '0',`item` int(11) NOT NULL DEFAULT '0',`value` int(11) NOT NULL DEFAULT '0',`duration` int(11) NOT NULL DEFAULT '0',`timestamp` int(23) NOT NULL DEFAULT '0',PRIMARY KEY (`id`))");
	query_sql("CREATE TABLE IF NOT EXISTS `reward_ip` ( `give_id` int(11) NOT NULL,  `item_id` int(11) NOT NULL,  `ip_address` varchar(23) NOT NULL, `claim_count` int(11) NOT NULL,  PRIMARY KEY (`give_id`))");
	query_sql("CREATE TABLE IF NOT EXISTS `reward_at` (`account_id` int(11) NOT NULL,`char_id` int(11) NOT NULL)");
	return;

OnInit:
	callsub OnLoadSetup;
	waitingroom "Prize Giver",0;
	end;
}

/* Manual table update for at tracker 
CREATE TABLE IF NOT EXISTS `reward_at` (
  `account_id` int(11) NOT NULL,
  `char_id` int(11) NOT NULL
);
*/
-	script	anti_trader	-1,{
	
OnInit:
	.is_anti_trade = 1; // 0 to disable
	end;
	
}
function	script	PG_30Seconds	{
	//dispbottom "anti trader 30sec";
	//Check if Vending (normal or @at)
	if(checkvending() >= 1)
	{
	   // mark as auto trader
	   	.@query = query_sql("SELECT account_id, char_id FROM "+$GiftTableNameAT$+" WHERE account_id = "+getcharid(3)+"", .@account_id, .@char_id); // check if in the table
		if (!.@query)
		{ // add if not there yet
			query_sql("INSERT INTO "+$GiftTableNameAT$+"(account_id,char_id) VALUES("+getcharid(3)+","+getcharid(0)+")");
			//dispbottom "you have been marked as auto trader";
			stopnpctimer;
			detachnpctimer;
			end;
		}
	}
	return;
}
function	script	PG_Login	{
	//dispbottom "at delete";
	.@query = query_sql("SELECT account_id, char_id FROM "+$GiftTableNameAT$+" WHERE account_id = "+getcharid(3)+"", .@account_id, .@char_id); // check if in the table
	if (.@query)
	{ // remove to reverify vending status
		query_sql("DELETE FROM "+$GiftTableNameAT$+" WHERE account_id = "+getcharid(3)+"");
	}
}
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...