Jump to content
  • 0
ThyroDree

Making Guild Package NPC - Latest Hercules Compatible

Question

Hello!

I found this script on my old hercules files, This script checks the Guild member online count, Guild Level, and Guild members Level. I also don't know if the sql still works properly.. So here..

 

Gpack.txt Script

//4_F_ZONDAGIRL,4_M_EIN_SOLDIER
prontera,164,155,4	script	Guild Package	4_ED_SCHMIDT,{	
query_sql "SELECT guild_lv FROM guild WHERE guild_id = "+getcharid(2), .@guild_lv;
.@req_online = 10; // how many players need to online to claim. 
.@req_lv = 255; // minimum level of .@online players that has to be. 
mes "[ ^007fffGuild Package^000000 ]";
mes "Are you here to claim Guild Package?";
mes "Here's our requirements:";
mes "- Minimum of 10 members and must be online";
mes "- All members must be ^ff0000Level 255^000000";
mes "- Guild Level must be ^ff000050^000000";
mes "All items you gain from Guild Package are ^ff8000Bound^000000 items.";
mes "meaning items that gained cannot be traded to other account, sold, nor dropped.";
next;
mes "[ ^007fffGuild Package^000000 ]";
mes "^007fff--- Guild Leader ---^000000";
mes "- ^ff00001x^000000 ^009a4dGhostring Card^000000 ^ff8000(Bound)^000000";
mes "- ^ff00001x^000000 ^009a4dThara Frog Card^000000 ^ff8000(Bound)^000000";
mes "- ^ff00001x^000000 ^009a4dOrc Hero Card^000000 ^ff8000(Bound)^000000";
mes "- ^ff00001x^000000 ^009a4dEvil Snake Lord Card^000000 ^ff8000(Bound)^000000";
mes "- ^ff00001x^000000 ^009a4dRaydric Card^000000 ^ff8000(Bound)^000000";
mes "- ^ff00001x^000000 ^009a4dGeneral Egnigem Cenia Card^000000 ^ff8000(Bound)^000000";
mes "- ^ff00001x^000000 ^009a4dHollow Mask^000000 ^ff8000(Bound)^000000";
mes "- ^ff00001x^000000 ^009a4dSilver Valkyrie Helm^000000 ^ff8000(Bound)^000000";
mes "- ^ff00001x^000000 ^009a4dSilver Valkyrie Armor^000000 ^ff8000(Bound)^000000";
mes "- ^ff00001x^000000 ^009a4dSilver Valkyrie Manteau^000000 ^ff8000(Bound)^000000";
mes "- ^ff00001x^000000 ^009a4dSilver Valkyrie Shield^000000 ^ff8000(Bound)^000000";
mes "- ^ff00001x^000000 ^009a4dSilver Valkyrie Shoes^000000 ^ff8000(Bound)^000000";
mes "- ^ff000010x^000000 ^009a4dYggdrasilberry Box^000000";
mes "- ^ff000010x^000000 ^009a4dCredits^000000";
mes "- ^ff000050^000000 ^009a4dGaming Point^000000";
mes "^0000FF[ Choose (1) Headprotector ]^000000";
mes "- ^ff00001x^000000 ^009a4dEarth Headprotector^000000";
mes "- ^ff00001x^000000 ^009a4dFire Headprotector^000000";
mes "- ^ff00001x^000000 ^009a4dLightning Headprotector^000000";
mes "- ^ff00001x^000000 ^009a4dSound Headprotector^000000";
mes "- ^ff00001x^000000 ^009a4dWater Headprotector^000000";
mes "- ^ff00001x^000000 ^009a4dWind Headprotector^000000";
next;
mes "[ ^007fffGuild Package^000000 ]";
mes "^007fff-- Each Member --^000000";
mes "- ^ff00001x^000000 ^009a4dGhostring Card^000000 ^ff8000(Bound)^000000";
mes "- ^ff00001x^000000 ^009a4dThara Frog Card^000000 ^ff8000(Bound)^000000";
mes "- ^ff00001x^000000 ^009a4dOrc Hero Card^000000 ^ff8000(Bound)^000000";
mes "- ^ff00001x^000000 ^009a4dEvil Snake Lord Card^000000 ^ff8000(Bound)^000000";
mes "- ^ff00001x^000000 ^009a4dRaydric Card^000000 ^ff8000(Bound)^000000";
mes "- ^ff00001x^000000 ^009a4dGeneral Egnigem Cenia Card^000000 ^ff8000(Bound)^000000";
mes "- ^ff00001x^000000 ^009a4dHollow Mask^000000 ^ff8000(Bound)^000000";
mes "- ^ff00001x^000000 ^009a4dSilver Valkyrie Helm^000000 ^ff8000(Bound)^000000";
mes "- ^ff00001x^000000 ^009a4dSilver Valkyrie Armor^000000 ^ff8000(Bound)^000000";
mes "- ^ff00001x^000000 ^009a4dSilver Valkyrie Manteau^000000 ^ff8000(Bound)^000000";
mes "- ^ff00001x^000000 ^009a4dSilver Valkyrie Shield^000000 ^ff8000(Bound)^000000";
mes "- ^ff00001x^000000 ^009a4dSilver Valkyrie Shoes^000000 ^ff8000(Bound)^000000";
mes "- ^ff00005x^000000 ^009a4dYggdrasilberry Box^000000";
mes "- ^ff00005x^000000 ^009a4dCredits^000000";
mes "- ^ff000050^000000 ^009a4dGaming Point^000000";
mes "^0000FF[ Choose (1) Headprotector ]^000000";
mes "- ^ff00001x^000000 ^009a4dEarth Headprotector^000000";
mes "- ^ff00001x^000000 ^009a4dFire Headprotector^000000";
mes "- ^ff00001x^000000 ^009a4dLightning Headprotector^000000";
mes "- ^ff00001x^000000 ^009a4dSound Headprotector^000000";
mes "- ^ff00001x^000000 ^009a4dWater Headprotector^000000";
mes "- ^ff00001x^000000 ^009a4dWind Headprotector^000000";
next;
if ( !getcharid(2) ) 
{		
mes "[ ^007fffGuild Package^000000 ]";
mes "You must have a guild";		
close;	
} else
if (.@guild_lv < 50) 
{
mes "[ ^007fffGuild Package^000000 ]";
mes "Your Guild must be level 50.";
} else
if ( getguildinfo(GUILDINFO_MASTER_NAME, getcharid( getcharid(2) ) != getcharid(0) ) 
{		
mes "[ ^007fffGuild Package^000000 ]";
mes "You are not a Guild Leader";		
close;	
}
getguildmember getcharid(2), 1;	
getguildmember getcharid(2), 2;	
for ( .@i = 0; .@i < $@guildmembercount; .@i++ )		
if ( isloggedin( $@guildmemberaid[.@i], $@guildmembercid[.@i] ) )			
.@online++;	if ( .@online < .@req_online ) 
{		
mes "[ ^007fffGuild Package^000000 ]";
mes "Your Guild must have "+ .@req_online +" guild members online";		
close;	
}	
	.@origin = getcharid(3);	
		for ( .@i = 0; .@i < $@guildmembercount; .@i++ ) 
	{		
		if ( isloggedin( $@guildmemberaid[.@i], $@guildmembercid[.@i] ) ) 
		{			
			attachrid $@guildmemberaid[.@i];			
			if ( BaseLevel < .@req_lv ) 
		{				
			.@deny_name$[.@c] = strcharinfo(0);				
			.@c++;			
		}		
	}	
}	attachrid .@origin;	if ( .@c ) 
		{		
			mes "[ ^007fffGuild Package^000000 ]";
			mes "^ff0000"+ .@c +"^000000 of your Guild member does not meet the ^ff0000255^000000 level requirement";		
			mes implode( .@deny_name$, "," );		
			close;	
		}	
			for ( .@i = 0; .@i < $@guildmembercount; .@i++ ) 
		{		
			if ( isloggedin( $@guildmemberaid[.@i], $@guildmembercid[.@i] ) ) 
			{			
				attachrid $@guildmemberaid[.@i];			
				if ( #guild_package_claimed ) 
				{				
				.@deny_name$[.@c] = strcharinfo(0);				
				.@c++;			
				}		
			}	
		}	
		attachrid .@origin;	if ( .@c ) 
		{		
		mes "[ ^007fffGuild Package^000000 ]";
		mes "there are "+ .@c +" members already claimed this package within their account";		
		mes implode( .@deny_name$, "," );		
		close;	
		}	if ( query_sql( "select account_id as aaa, ( select last_ip from login where account_id = aaa ) as last_ip from guild_member where guild_id = "+ getcharid(2) +" group by last_ip", .@aid, .@ip$ ) < .@req_online ) 
		{		
		mes "[ ^007fffGuild Package^000000 ]";
		mes "same ip detected";		
		.@nb = query_sql( "select name, account_id as aaa, ( select last_ip from login where account_id = aaa ) as last_ip from guild_member where guild_id = "+ getcharid(2), .@name$, .@aid, .@ip$ );		
		for ( .@i = 0; .@i < .@nb; .@i++ )			
		mes "[ ^007fffGuild Package^000000 ]";
		mes (.@i +1)+". "+ .@name$[.@i] +" ("+ .@ip$ +")";		
		next;	
		}	
		mes "[ ^007fffGuild Package^000000 ]";
		mes "Congratulations! Your Guild Package has been claimed!";	for ( .@i = 0; .@i < $@guildmembercount; .@i++ ) 
		{		
		if ( isloggedin( $@guildmemberaid[.@i], $@guildmembercid[.@i] ) ) 
		{			
		attachrid $@guildmemberaid[.@i];			
		if ( getguildinfo(GUILDINFO_MASTER_NAME, getcharid( getcharid(2) ) != $@guildmembercid[.@i] )	
		getitembound 13517,100,1; // Yggberry Box
		else
		getitembound 13517,50,1; // Yggberry Box
		getitembound 14524,500,1; //SUPER B	
		getitem 7227,500; // Voting Proof Ticket
		getitem 20030,50; // Credits
		getitembound 30110,50,1; // Box Of Thunder Box
		getitembound 13973,50,1; // EDP Box
		getitembound 4305,2,1; // Turtle
		getitembound 4121,2,1; // Phreeoni
		getitembound 4047,1,1; // Ghostring
		getitembound 4352,1,1; // Gen Egnihem
		getitembound 4058,1,1; //Thara Frog
		getitembound 4143,1,1; //ORC HERO
		getitembound 4330,1,1;//ESL
		getitembound 4133,1,1; //Raydric
		getitembound 20023,1,1; //Hollow
		getitembound 20009,1,1; //SilverV
		getitembound 20008,1,1; //SilverV
		getitembound 20007,1,1; //SilverV
		getitembound 20006,1,1; //SilverV
		#guild_package_claimed = 1;		
		}	
	}	
	attachrid .@origin;	close;
OnInit:
waitingroom "Guild Package? Claim it now!",0;
end;	
}

Changes I already made is the depreciation of

if ( getguildmasterid( getcharid(2) ) != getcharid(0) ) {

 

Error, im getting

Quote

[Error]: script error in file 'npc/custom/gpack.txt' line 77 column 1
    parse_simpleexpr: unmatched ')'
    74: mes "Your Guild must be level 50.";
    75: } else
    76: if ( getguildinfo(GUILDINFO_MASTER_NAME, getcharid( getcharid(2) ) != getcharid(0) )
*   77: {
        ^
    78: mes "[ ^007fffGuild Package^000000 ]";
    79: mes "You are not a Guild Leader";
    80: close;

 

Edited by ThyroDree

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

the error message already tells you what is wrong: you forgot a closing parenthesis

if ( getguildinfo(GUILDINFO_MASTER_NAME, getcharid( getcharid(2) ) != getcharid(0) )

the parenthesis for getguildinto() is never closed: (((()) != ())

 

you should add a ) closing parenthesis before the !=

Share this post


Link to post
Share on other sites
  • 0
12 hours ago, meko said:

the error message already tells you what is wrong: you forgot a closing parenthesis

if ( getguildinfo(GUILDINFO_MASTER_NAME, getcharid( getcharid(2) ) != getcharid(0) )

the parenthesis for getguildinto() is never closed: (((()) != ())

 

you should add a ) closing parenthesis before the !=

Thank you @meko, the script works without error now but I tried to claim by creating and changed the req_online into 2 to try it with max level dual

the NPC will say nothing and stucked at his dialogue box

 

Share this post


Link to post
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.   Restore formatting

  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.

Loading...

×
×
  • Create New...

Important Information

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