Jump to content
  • 0
Sign in to follow this  
Harmony

How to make Happy's Freebies NPC account-bound?

Question


So I modified Happy's Script abit but I found out that the script was char-bound not account-bound. I wanted to prevent abuse so does anyone here know how to make this account-bound?
 
//===== Happy Scripts ================================== 
//= Freebee
//===== By: ================================================== 
//= Happy
//===== Current Version: ===================================== 
//= 1.0
//===== Compatible With: ===================================== 
//= Hercules
//===== Description: =========================================
// Resettable Freebie Giver. More freeee stuffs!
//===== Comments: ============================================
//= Change npc coordinates and item ids/amounts etcs
//===== Additional Comments: =================================
//= 1.00 Initial Release
//===== Contact Ifo: =========================================
//= http://hercules.ws/board/user/164-happy/
//============================================================
new_2-1,55,115,4	script	Freebies NPC	123,{
		
	mes "[Freebie NPC]";
	mes "What's up? Are you new?";
	mes "What do you wanna do?";
	if(getgmlevel() >= .GM){
		set .@i,select("I'd like to claim my freebies:Leave:Reset Variables");
	} else {  
		set .@i,select("I'd like to claim my freebies:Leave"); 
	}
	switch(.@i) {
		case 3:
			next;
			mes "Are you sure you want to delete";
			mes "ALL freebie records?";
			if(select("No:Yes")==1) close;
			next;
			mes "Wait one Moment...";
			mes ".....";
			query_sql("DELETE FROM `char_reg_num_db` WHERE `key` = 'hpy_got_freebie'");
			set .@self, getcharid(3);
			set .@size, query_sql("select account_id from `char` where online = 1", .@aid);
			for(set .@i,0; .@i<.@size; set .@i,.@i+1) {
				if(attachrid(.@aid[.@i])){
					set hpy_got_freebie,0;
				}	
			}
			attachrid(.@self);
			mes "Cleared";
			close;
		case 1:
			next;
			if (!hpy_got_freebie) {
				set hpy_got_freebie,1;
				for (set .@i,0; .@i < getarraysize(.hpy_freebie); set .@i, .@i +1) {
					getitem .hpy_freebie[.@i],.hpy_freebie_amt[.@i];
				}
				mes "Enjoy!";
			} else {
				mes "You already got your freebie!";
			}
			close;
		case 2:
			close;
	}
	
	OnInit:
		/* *CONFIG */
		set .GM,99; 					  // Group required to reset
		setarray .hpy_freebie[0],607,608; // enter the itemids
		setarray .hpy_freebie_amt[0],3,5; // enter the amount of the items
		/* on the example above, it gives 3x 607(ygg) and 5x 608(yggseed) */
}

 

Edited by Harmony

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0

I'm sorry, I might've constructed my question wrong. I mean one account can only get the freebies once not make the item itself account bound

Share this post


Link to post
Share on other sites
  • 0

Change all hpy_got_freebie to #hpy_got_freebie
 

if (!#hpy_got_freebie) {
                set #hpy_got_freebie,1;

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.