• 0
Sign in to follow this  
Followers 0
Harmony

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

Question

Posted (edited)


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 [email protected],select("I'd like to claim my freebies:Leave:Reset Variables");
	} else {  
		set [email protected],select("I'd like to claim my freebies:Leave"); 
	}
	switch([email protected]) {
		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 [email protected], getcharid(3);
			set [email protected], query_sql("select account_id from `char` where online = 1", [email protected]);
			for(set [email protected],0; [email protected]<[email protected]; set [email protected],[email protected]+1) {
				if(attachrid([email protected][[email protected]])){
					set hpy_got_freebie,0;
				}	
			}
			attachrid([email protected]);
			mes "Cleared";
			close;
		case 1:
			next;
			if (!hpy_got_freebie) {
				set hpy_got_freebie,1;
				for (set [email protected],0; [email protected] < getarraysize(.hpy_freebie); set [email protected], [email protected] +1) {
					getitem .hpy_freebie[[email protected]],.hpy_freebie_amt[[email protected]];
				}
				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

  • 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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0