Jump to content
  • 0

Donation NPC HELP!


lelouchxv

Question


  • Group:  Members
  • Topic Count:  30
  • Topics Per Day:  0.01
  • Content Count:  120
  • Reputation:   8
  • Joined:  09/16/18
  • Last Seen:  

// ===== Donation Npc 1.0 ===================== //
// ===== Credits : Jhosef and trOn ============ //
// ===== Change Logs ========================== //
// ============================================ //



// ==== NPC Location ========================== // 
prontera,143,171,5	script	Donation NPC	807,{

// === Configuration ========================== //
	set .gms_level, 99;
	set .code_length,10; // Length for the Donation Code
	set .code_length2,3; // Length for the Validation Code
	set .donate_item, 7179; // Donation Item
	set .@itemORcash, 0; // 0 for Item or 1 for Cash Point
	set .@npc_name$, "Donation Npc";
	setarray .coupon_code$[0],"A","B","C","D","E","F","G","H","I","J","K","L",
							  "M","N","O","P","Q","R","S","T","U","V","W","X",
							  "Y","Z","0","1","2","3","4","5","6","7","8","9";
							  
	setarray .validation_code$[0],"A","B","C","D","E","F","G","H","I","J","K","L",
							  "M","N","O","P","Q","R","S","T","U","V","W","X",
							  "Y","Z","0","1","2","3","4","5","6","7","8","9";

							 
// ==== NPC Talk ============================== //
	if( getgmlevel() >= .gms_level) goto AdminPanel;
	if( getgmlevel() < .gms_level) goto PlayerPanel;
	
// ==== Don't Edit This ======================= //
	set .@stats$,"0";
// ==== Admin Panel =========================== //
	AdminPanel:
	
	mes .@npc_name$;
	mes "Welcome " + strcharinfo(0) + ".";
	next;
	switch(select("Add Donation Code:Player View:Exit"))
		{
			case 1:
				for(set @i, 0; @i < .code_length; set @i, @i+1)
				{
					set @random_char, rand(0,(getarraysize(.coupon_code$)-1));
					set @new_donation$, @new_donation$ + .coupon_code$[@random_char];
				}
				
				for(set @i, 0; @i< .code_length2; set @i, @i+1)
				{
					set @random_char, rand(0,(getarraysize(.validation_code$)-1));
					set @new_validation$, @new_validation$ + .validation_code$[@random_char];
				}
				mes .@npc_name$;
				mes "Enter Item Amount:";
				input @donate_amount;
				next;
				mes .@npc_name$;
				mes "Coupon added.";
				
				query_sql "INSERT INTO `donate` (`code`, `item_amount`,`validation_code`,`status`) VALUES ('"+@new_donation$+"', "+@donate_amount+", '"+@new_validation$+"' , '"+.@stats$+"')";
				set @new_donation$, "";
				set @new_validation$, "";
				next;		
				mes "This is the list of code logs";
				query_sql "SELECT `code` , `item_amount` , `validation_code` , `status` FROM `donate` ORDER BY `code` DESC", .@codelist$, .@status$, .@validation$;
				if(.@codelist)
				{
					mes .@npcname$;
					mes "There are no entrys in the Code List.";
					close;
				} 
				else 
				{
					next;
					mes .@npcname$;
					mes "The list will spawn at your main chat box.";
					dispbottom "Codelist | Amount | Validation";
					for(set @ei,0; @ei < getarraysize(.@codelist$); set @ei,@ei + 1) 
					{
						dispbottom ""+.@codelist$[@ei]+" | "+.@status$[@ei]+" | "+.@validation$[@ei]+" "; 
					}					
				}
				next;
				close;
				
			case 2:
				goto PlayerPanel;
			case 3:
				mes .@npc_name$;
				mes "Have a nice day.";
				close;
		}
	

// ==== Player Panel ========================== //
PlayerPanel:

	mes .@npc_name$;
	mes "Welcome to the Donation System. How can I help you?";
	next;
	switch(Select("View My Donation Code:Enter My Donation Code:Exit"))
	{
		case 1:
			mes .@npc_name$;
			mes "Please enter your Validation Code:";
			input @my_code$;
			next;
			query_sql "SELECT `validation_code` FROM `donate` WHERE `validation_code` = '"+@my_code$+"'", @available_code$;
			next;
			
				if(@my_code$ == @available_code$)
				{
					query_sql "SELECT `code` FROM `donate` WHERE `validation_code` = '"+@my_code$+"'", @available_code2$;
					mes .@npc_name$;
					mes "Your Donation Code is : [^FF7700"  + @available_code2$+ "^000000].";
					close2;
					end;
				}
				else
				{
				mes .@npc_name$;
				mes "Your Validation Code is Invalid.";
				close;
				}
			
		case 2:
			mes .@npc_name$;
			mes "Please enter your Donation Code:";
			input @donate_code$;
			next;
			query_sql "SELECT `code` FROM `donate` WHERE `code` = '"+@donate_code$+"'", @donation_code$;
			query_sql "SELECT `status` FROM `donate` WHERE `code` = '"+@donate_code$+"'", @donate_status;
			if(strtoupper(@donate_code$)==@donation_code$ && @donate_status == 0)
			{
				if( .itemORcash == 0)
				{
					query_sql "SELECT `item_amount` FROM `donate` WHERE `code` = '"+@donate_code$+"'", @Donation_Code$;
					mes .@npc_name$;
					mes "You get ^0000FF" + getitemname(.donate_item) + " - " + @Donation_Code$ + " ea.^000000";
					query_sql "UPDATE `donate` SET `status`=1 WHERE `code`='"+@donate_code$+"'";
					close2;
					//query_sql "DELETE FROM `donate` WHERE `code`='"+@donate_code$+"'";
					getitem .donate_item,@Donation_Code$;
					end;
				}
				else
				{
					query_sql "SELECT `item_amount` FROM `donate` WHERE `code` = '"+@donate_code$+"'", @Donation_Code$;
					mes .@npc_name$;
					mes "You get ^0000FF" + @Donation_Code$ + " Cash Point.^000000";
					query_sql "UPDATE `donate` SET `status`=1 WHERE `code`='"+@donate_code$+"'";
					close2;
					//query_sql "DELETE FROM `donate` WHERE `code`='"+@donate_code$+"'";
					set #CASHPOINTS, @Donation_Code$;
					end;
				
				}
			}
			else
			{
				mes .@npc_name$;
				mes "This Donation Code doesn't exist.";
				close;
			}
			
		case 3:
			mes .@npc_name$;
			mes "Have a nice day.";
			close;
	}

// ============================================ //

OnInit:
	query_sql "CREATE TABLE IF NOT EXISTS `donate` (`code` TINYTEXT NOT NULL, `item_amount` INT NOT NULL, `validation_code` TEXT NOT NULL, `status` TEXT NOT NULL, INDEX `code` (`code`(32)) ) ENGINE=MyISAM";
	query_sql "CREATE TABLE IF NOT EXISTS `donation` (`name` TEXT NOT NULL, `code` TEXT NOT NULL, `item_amount` INT NOT NULL, `validation_code` TEXT NOT NULL, INDEX `code` (`code`(32)) ) ENGINE=MyISAM";
waitingroom "Donation Reedeem",0;
end;
}

im using this Donation Script when i try to add a code this error pop ups >

 error1.JPG.c804249893941353fe4a40436e589e9b.JPG

 

when i tried to use a donation code this error will pop up in my map server id still get the Proof of donation but when i redeemed it it showing that error anyone who can help? ?  sorry for my bad english..
error2.JPG.2cb231998181d357eb188649a2057b91.JPG

 

 

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  113
  • Reputation:   47
  • Joined:  06/02/12
  • Last Seen:  

Find:

query_sql "SELECT `code` , `item_amount` , `validation_code` , `status` FROM `donate` ORDER BY `code` DESC", .@codelist$, .@status$, .@validation$;

Replace:

query_sql "SELECT `code` , `item_amount` , `validation_code` FROM `donate` ORDER BY `code` DESC", .@codelist$, .@status$, .@validation$;

 

Find:

getitem .donate_item,@Donation_Code$;

Replace:

getitem .donate_item, atoi(@Donation_Code$);

 

  • Love 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  19
  • Topics Per Day:  0.00
  • Content Count:  292
  • Reputation:   46
  • Joined:  10/30/12
  • Last Seen:  

Why don't you just use the Donation System?

Just add your item on item_cash_db.txt

For pre-renewal:
db/pre-re/item_cash_db.txt

For renewal:
db/re/item_cash_db.txt

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  30
  • Topics Per Day:  0.01
  • Content Count:  120
  • Reputation:   8
  • Joined:  09/16/18
  • Last Seen:  

1 hour ago, mrfizi said:

Why don't you just use the Donation System?

Just add your item on item_cash_db.txt

For pre-renewal:
db/pre-re/item_cash_db.txt

For renewal:
db/re/item_cash_db.txt

Do u mean the FluxCP Donation NPC?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  19
  • Topics Per Day:  0.00
  • Content Count:  292
  • Reputation:   46
  • Joined:  10/30/12
  • Last Seen:  

Put all your donation item here:
 

Spoiler

Untitled.jpg.2a1ee6a98dfd965d10cb0e0c3fdc1874.jpg

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  30
  • Topics Per Day:  0.01
  • Content Count:  120
  • Reputation:   8
  • Joined:  09/16/18
  • Last Seen:  

On 4/8/2021 at 8:17 PM, mrfizi said:

Put all your donation item here:
 

  Hide contents

Untitled.jpg.2a1ee6a98dfd965d10cb0e0c3fdc1874.jpg

 


 

// ===== Donation Npc 1.0 ===================== //
// ===== Credits : Jhosef and trOn ============ //
// ===== Change Logs ========================== //
// ============================================ //



// ==== NPC Location ========================== // 
prontera,143,171,5	script	Donation NPC	807,{

// === Configuration ========================== //
	set .gms_level, 99;
	set .code_length,10; // Length for the Donation Code
	set .code_length2,3; // Length for the Validation Code
	set .donate_item, 7179; // Donation Item
	set .@itemORcash, 0; // 0 for Item or 1 for Cash Point
	set .@npc_name$, "Donation Npc";
	setarray .coupon_code$[0],"A","B","C","D","E","F","G","H","I","J","K","L",
							  "M","N","O","P","Q","R","S","T","U","V","W","X",
							  "Y","Z","0","1","2","3","4","5","6","7","8","9";
							  
	setarray .validation_code$[0],"A","B","C","D","E","F","G","H","I","J","K","L",
							  "M","N","O","P","Q","R","S","T","U","V","W","X",
							  "Y","Z","0","1","2","3","4","5","6","7","8","9";

							 
// ==== NPC Talk ============================== //
	if( getgmlevel() >= .gms_level) goto AdminPanel;
	if( getgmlevel() < .gms_level) goto PlayerPanel;
	
// ==== Don't Edit This ======================= //
	set .@stats$,"0";
// ==== Admin Panel =========================== //
	AdminPanel:
	
	mes .@npc_name$;
	mes "Welcome " + strcharinfo(0) + ".";
	next;
	switch(select("Add Donation Code:Player View:Exit"))
		{
			case 1:
				for(set @i, 0; @i < .code_length; set @i, @i+1)
				{
					set @random_char, rand(0,(getarraysize(.coupon_code$)-1));
					set @new_donation$, @new_donation$ + .coupon_code$[@random_char];
				}
				
				for(set @i, 0; @i< .code_length2; set @i, @i+1)
				{
					set @random_char, rand(0,(getarraysize(.validation_code$)-1));
					set @new_validation$, @new_validation$ + .validation_code$[@random_char];
				}
				mes .@npc_name$;
				mes "Enter Item Amount:";
				input @donate_amount;
				next;
				mes .@npc_name$;
				mes "Coupon added.";
				
				query_sql "INSERT INTO `donate` (`code`, `item_amount`,`validation_code`,`status`) VALUES ('"+@new_donation$+"', "+@donate_amount+", '"+@new_validation$+"' , '"+.@stats$+"')";
				set @new_donation$, "";
				set @new_validation$, "";
				next;		
				mes "This is the list of code logs";
				query_sql "SELECT `code` , `item_amount` , `validation_code` , `status` FROM `donate` ORDER BY `code` DESC", .@codelist$, .@status$, .@validation$;
				if(.@codelist)
				{
					mes .@npcname$;
					mes "There are no entrys in the Code List.";
					close;
				} 
				else 
				{
					next;
					mes .@npcname$;
					mes "The list will spawn at your main chat box.";
					dispbottom "Codelist | Amount | Validation";
					for(set @ei,0; @ei < getarraysize(.@codelist$); set @ei,@ei + 1) 
					{
						dispbottom ""+.@codelist$[@ei]+" | "+.@status$[@ei]+" | "+.@validation$[@ei]+" "; 
					}					
				}
				next;
				close;
				
			case 2:
				goto PlayerPanel;
			case 3:
				mes .@npc_name$;
				mes "Have a nice day.";
				close;
		}


this npc is for coupon reedemer item (7179)  this is where theyh can redeem their PODS. they need to Convert their pods to Cashpoints. but i'll do your suggestion to put my item donations in the cash shop. i just need to fix this npc

 

On 4/8/2021 at 9:44 PM, Racaae said:

Find:


query_sql "SELECT `code` , `item_amount` , `validation_code` , `status` FROM `donate` ORDER BY `code` DESC", .@codelist$, .@status$, .@validation$;

Replace:


query_sql "SELECT `code` , `item_amount` , `validation_code` FROM `donate` ORDER BY `code` DESC", .@codelist$, .@status$, .@validation$;

 

Find:


getitem .donate_item,@Donation_Code$;

Replace:


getitem .donate_item, atoi(@Donation_Code$);

 

i'll try this! Thankyou so much!

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