Jump to content

Haruka Mayumi

Members
  • Posts

    485
  • Joined

  • Last visited

  • Days Won

    27

Posts posted by Haruka Mayumi

  1. 9 hours ago, Mice said:

     

    Try add this somewhere in your script maybe before the OnInit

    OnClock0001:
    	query_sql "UPDATE `acc_reg_num` SET `value` = '0' WHERE `key` = '#lastTimeTalked'";
    end;

     

    Using query_sql alone will give you the bug of other players that are currently online save and about to save their #lastTimeTalked after the OnClock0001:
    If you want to clear that. you should make sure that online players account variable #lastTimeTalked is also set using the addrid(0); then set #lastTimeTalked,0;

    Also i don't recommend this kind of checking for daily.

    The best way to deal with daily is gettime(DT_YYYYMMDD) if the reset is 12:00AM which changes the date

    prontera,155,181,3	script	Daily Reward	94,{
    	setarray .@items,501,502,503;
    	setarray .@amounts,10,10,10;
    
    	if(#DailyReward != gettime(DT_YYYYMMDD)){
    		mes "[Daily Reward]";
    		mes "Here's your daily rewards!";
    		for(.@i=0;.@i<getarraysize(.@items);.@i++)
    			getitem .@items[.@i],.@amounts[.@i];
    		set #DailyReward = gettime(DT_YYYYMMDD);
    	} else {
    		mes "[Daily Reward]";
    		mes "You already received your daily reward today.";
    		mes "Time until next reward: "+callfunc("Time2Str",86400-gettimetick(1));
    	}
    end;
    }

    If you want to change the daily reset to let's say 5:00AM, you just simply need to change the if condition into these. Adding the check !#DailyReward to make sure that new players can get it before 5AM.

    if(!#DailyReward || (#DailyReward != gettime(DT_YYYYMMDD) && gettime(DT_HOUR) >= 5)){
  2. Please use code box when pasting codes so if someone wants to help you. The tabs/indents are still intact and won't give error due to it.

    // ===== Donation Npc 1.0 ===================== //
    // ===== Credits : Jhosef and trOn ============ //
    // ===== Change Logs ========================== //
    // ============================================ //
    
    // ==== NPC Location ========================== // 
    prontera,99,64,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,1; 	// 0 for Item or 1 for Cash Point
    	set .Announce,1;		// Announce quest completion? (1: yes / 0: no)
    	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:Remove used donation codes: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:
    				mes .@npcname$;
    				mes "Are you sure you want to reset your donation code table?";
    				if(select("Yes, I'm sure:Cancel")==2) close;
    				query_sql("DELETE FROM `donate` WHERE `status` = '0';");
    			case 3:
    				goto PlayerPanel;
    				
    			case 4:
    				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$;
    					if (.Announce) announce strcharinfo(0)+" has Donated to our Server and get "+ (@Donation_Code$)  + getitemname(.donate_item),0;
    					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";
    }

    Upon reviewing the code. There are a lot of unused declarations such and even the 'donation' table which is just added but never used.

    The code already have an auto delete code once it was redeemed. But it was commented.

    //query_sql "DELETE FROM `donate` WHERE `code`='"+@donate_code$+"'";

    To enable the auto delete, just remove the comment //

    I added an option in the menu for the GM to remove all the codes that are already used.

  3. you can use a mapflag if it's in town or an event map.

    *nopenalty
    *noexppenalty
    *nozenypenalty
    
    Disables the loss of experience and Zeny upon death on a map.
    'nopenalty' is the same as 'noexppenalty' and 'nozenypenalty' combined.
    
    Notes:
    'noexppenalty' also affects pets, and skills PR_REDEMPTIO and LG_INSPIRATION will not deduct EXP.
    'nozenypenalty' only applies if 'zeny_penalty' is enabled in '/conf/battle/exp.conf'.

     

  4. located in battle.cpp

    	uint16 anger_level;
    	if (sd != nullptr && anger_id < MAX_PC_FEELHATE && (anger_level = pc_checkskill(sd, sg_info[anger_id].anger_id))) {
    -		int skillratio = sd->status.base_level + sstatus->dex + sstatus->luk;
    +		int skillratio = (sd->status.base_level/3) + sstatus->dex + sstatus->luk;
    
    		if (anger_id == 2)

     

  5.     setarray .C_PetEggs,
        9150, 9151, 9152, 9153, 9154, 9155, 9156, 9157, 9158, 9159, 9198, 9200, 9201, 9203, 9204, 9206, 9210;
    
    	getinventorylist();
    	for(.@i=0;.@i<@inventorylist_count;.@i++){
    		if(inarray(.C_PetEggs,@inventorylist_id[.@i]) < 0) continue; // If the item is not an egg from the array list. continue the loop
    		if(!@inventorylist_attribute[.@i]){ // Check if the egg is not hatched, Attribute 1 if it is hatched, 0 if not.
    			delitemidx @inventorylist_idx[.@i],1; // Delete the item via the index
    			.@delete++;	// Add a counter for deleted eggs
    		}
    		if(.@deleted >= 10) break; // if the deleted eggs is more than 10. exit the loop
    	}
    
    	mes "10 Unhatched eggs are deleted.";

     

  6. The reason that it isn't working is because of the variables on that code.
    Here's the simplified code for that.

    EDIT: This code won't work on maps without loadevent flags

    -	script	rmvbuff	-1,{
    
    OnPCLoadMapEvent:
    	if(@rmvmap$ == strcharinfo(3)) end;
    	//sc_end sc_spirit;
    	sc_end sc_gospel;
    	sc_end SC_POEMBRAGI;
    	sc_end SC_APPLEIDUN;
    	sc_end SC_ASSNCROS;
    	sc_end SC_WHISTLE;
    	sc_end SC_SERVICE4U;
    	//sc_end 37; // holy weapon
    	//sc_end 38; // holy armor
    	sc_end 187; // increase all stat
    	sc_end 194; // increase hit
    	sc_end 196; // increase flee
    	sc_end 198; // max hp increase
    	sc_end 199; // max sp increase
    	sc_end 200; // attach strength
    	sc_end 202; // increase def	
    	sc_end 214; // SC_SCRESIST
    	sc_end 175; // POEMBRAGI
    	sc_end 181; // SERVICE4U
    	specialeffect2 235;
    	@rmvmap$ = strcharinfo(3);
    	end; 
    }
  7. 4 hours ago, f_fman said:

    I gonna create one in the correct section, can some one delete this one,

     

    and sorry about that

    I moved it to the correct section. you even created another post on another WRONG SECTION.. please use report button next time.

  8. The problem is your option is skipping a space of random options.. 

    E.G: This will only show the Str + 1 because the Option 1 has no data in it.
    - Option 0: Str + 1
    - Option 1: None
    - Option 2:  Dex + 1

    Edit: You can check your inventory database to see how the random option looks when skipping.

×
×
  • Create New...