Jump to content
  • 0

Guild Pack NPC Giver (Help please)


fallen0519

Question


  • Group:  Members
  • Topic Count:  20
  • Topics Per Day:  0.01
  • Content Count:  52
  • Reputation:   2
  • Joined:  02/15/14
  • Last Seen:  

//Script Name: Guild Package NPC Giver
//Developer: ShogS
//Description:  This NPC will Give a Package for each Guild Member take Note: this NPC will record each player IP address to avoid abuse on players side by getting 2 Package in 1 IP
//Version: 1.0
//Some Explanation: Do not forget to set the items to a not tradeable Sample: 17638,91,99 = Can not be droped,sell,trade

//======================================================================================================
// - SQL TABLE
/*
CREATE TABLE IF NOT EXISTS `guildpack` (
  `id` int(11) NOT NULL auto_increment,
  `account_id` int(11) NOT NULL default '0',
  `name` varchar(23) NOT NULL default '',
  `last_ip` varchar(100) NOT NULL default '',
  PRIMARY KEY (`account_id`),
  KEY (`id`)
) ENGINE=MyISAM;
*/
//======================================================================================================

prontera,130,172,5	script	Guild Pack Info	468,{

set .@frnd2$,strcharinfo(0);
if(##Gpack == 1) goto L_AG;
	mes "[Guild Pack NPC]";
	mes "Hello there, it seems you are claiming for a Guild Pack.";
	next;
	mes "[Guild Pack NPC]";
	mes "Let me gift you a guild pack for joining and";
	mes "playing in Lunar RO, we hope you enjoy them.";
	next;
	mes "These guild pack is not duplicable and not dropable.";
	next;
	switch(select("Yes:No")) {
			case 1:

				query_sql("SELECT last_ip FROM `login` WHERE account_id = "+getcharid(3)+"", .@lip$);	// recruits ip address
				query_sql("SELECT last_ip FROM `guildpack`", .@flip$);	// recruiter ip address and information
				if ( .@lip$ == .@flip$ ) {
					mes "^616D7EIt seems you have same IP Address among Guild Mates: ^ff0000" + .@flip$ + "^000000. Sorry, but its not allowed.";
					close;
				}
				query_sql("INSERT INTO `guildpack` VALUES (NULL," + getcharid(3) + ",'" + escape_sql(strcharinfo(0)) + "','" + .@lip$ + "')");
				
				//THIS PART WERE all items they will get

				getitem 29828,1;
				getitem 29851,1;
				getitem 29868,1;
				getitem 29834,1;
				getitem 29804,1;
				getitem 29835,1;
				getitem2 5170,1,1,7,0,0,0,0,0;
				getitem2 2319,1,1,7,0,4141,0,0,0;
				getitem2 2114,1,1,7,0,4058,0,0,0;
				getitem2 2528,1,1,7,0,4133,0,0,0;
				getitem2 2424,1,1,7,0,4097,0,0,0;
				getitem 2607,2;
				getitem 4035,5;
				getitem 4064,2;
				getitem 4079,2;
				getitem 14175,1;
				getitem 671,1;
				getitem 607,300;
				getitem 12045,100;
				getitem 12060,100;
				getitem 12050,100;
				getitem 12055,100;
				getitem 12065,100;
				getitem 12070,100;
				set ##Gpack, 1;
				warp "prontera",156,172;
				close;

			case 2:
				mes "^616D7ENevermind~, You can come back again later!";
				close;
				
set .@GID,getcharid(2);
if (.@GID <= 0) {
	mes "You have no guild!";
	close;
}
		}end;

L_AG:
	mes "^616D7EYou already given a Guild Package";
	close;

OnInit:
waitingroom "Guild Package",0;
end;

}

Hi, top is my guild pack script, I have problem about this script. Players can get the guild pack even when they are not in guild. And besides that, players who create another account can get the g.pack as well. I already execute the sql table, anyone please help me yea... I really don't know how to fix this bug~~

Link to comment
Share on other sites

8 answers to this question

Recommended Posts


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

Thinking about it now, I should set an account variable to prevent the player using an ip dynamic

/*
CREATE TABLE IF NOT EXISTS `guildpack` (
  `id` int(11) NOT NULL auto_increment,
  `account_id` int(11) NOT NULL default '0',
  `name` varchar(23) NOT NULL default '',
  `last_ip` varchar(100) NOT NULL default '',
  PRIMARY KEY (`account_id`),
  KEY (`id`)
) ENGINE=MyISAM;
*/
//======================================================================================================

prontera,130,172,5	script	Guild Pack Info	468,{

	if ( getcharid(2) == 0 ) {
		mes "You have no guild!";
		close;
	}
	if ( #gpack || callsub( L_check ) ) {
		#gpack = 1;
		mes "^616D7EYou already given a Guild Package";
		close;
	}
	mes "[Guild Pack NPC]";
	mes "Hello there, it seems you are claiming for a Guild Pack.";
	next;
	mes "[Guild Pack NPC]";
	mes "Let me gift you a guild pack for joining and";
	mes "playing in Lunar RO, we hope you enjoy them.";
	next;
	mes "These guild pack is not duplicable and not dropable.";
	next;
	switch(select("Yes:No")) {
		case 1:
			.@myip$ = getcharip();
			if ( callsub( L_check ) ) {
				mes "^616D7EIt seems you have same IP Address among Guild Mates: ^ff0000" + .@myip$ + "^000000. Sorry, but its not allowed.";
				close;
			}
			query_sql("INSERT INTO `guildpack` VALUES (NULL," + getcharid(3) + ",'" + escape_sql(strcharinfo(0)) + "','" + .@myip$ + "')");
			
			//THIS PART WERE all items they will get

			getitem 29828,1;
			getitem 29851,1;
			getitem 29868,1;
			getitem 29834,1;
			getitem 29804,1;
			getitem 29835,1;
			getitem2 5170,1,1,7,0,0,0,0,0;
			getitem2 2319,1,1,7,0,4141,0,0,0;
			getitem2 2114,1,1,7,0,4058,0,0,0;
			getitem2 2528,1,1,7,0,4133,0,0,0;
			getitem2 2424,1,1,7,0,4097,0,0,0;
			getitem 2607,2;
			getitem 4035,5;
			getitem 4064,2;
			getitem 4079,2;
			getitem 14175,1;
			getitem 671,1;
			getitem 607,300;
			getitem 12045,100;
			getitem 12060,100;
			getitem 12050,100;
			getitem 12055,100;
			getitem 12065,100;
			getitem 12070,100;
			set #gpack, 1;
			warp "prontera",156,172;
			close;

		case 2:
			mes "^616D7ENevermind~, You can come back again later!";
			close;
	}
	end;
L_check:
	return query_sql("SELECT 1 FROM `guildpack` join login on login.`last_ip` = `guildpack`.`last_ip` where login.account_id = "+ getcharid(3), .@tmp );
OnInit:
	waitingroom "Guild Package",0;
	end;
}
Link to comment
Share on other sites

  • 1

  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  


/*

CREATE TABLE IF NOT EXISTS `guildpack` (

`id` int(11) NOT NULL auto_increment,

`account_id` int(11) NOT NULL default '0',

`name` varchar(23) NOT NULL default '',

`last_ip` varchar(100) NOT NULL default '',

PRIMARY KEY (`account_id`),

KEY (`id`)

) ENGINE=MyISAM;

*/

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

prontera,130,172,5 script Guild Pack Info 468,{

if ( getcharid(2) == 0 ) {

mes "You have no guild!";

close;

}

if ( @gpack || callsub( L_check ) ) {

@gpack = 1;

mes "^616D7EYou already given a Guild Package";

close;

}

mes "[Guild Pack NPC]";

mes "Hello there, it seems you are claiming for a Guild Pack.";

next;

mes "[Guild Pack NPC]";

mes "Let me gift you a guild pack for joining and";

mes "playing in Lunar RO, we hope you enjoy them.";

next;

mes "These guild pack is not duplicable and not dropable.";

next;

switch(select("Yes:No")) {

case 1:

.@myip$ = getcharip();

if ( callsub( L_check ) ) {

mes "^616D7EIt seems you have same IP Address among Guild Mates: ^ff0000" + .@myip$ + "^000000. Sorry, but its not allowed.";

close;

}

query_sql("INSERT INTO `guildpack` VALUES (NULL," + getcharid(3) + ",'" + escape_sql(strcharinfo(0)) + "','" + .@myip$ + "')");

//THIS PART WERE all items they will get

getitem 29828,1;

getitem 29851,1;

getitem 29868,1;

getitem 29834,1;

getitem 29804,1;

getitem 29835,1;

getitem2 5170,1,1,7,0,0,0,0,0;

getitem2 2319,1,1,7,0,4141,0,0,0;

getitem2 2114,1,1,7,0,4058,0,0,0;

getitem2 2528,1,1,7,0,4133,0,0,0;

getitem2 2424,1,1,7,0,4097,0,0,0;

getitem 2607,2;

getitem 4035,5;

getitem 4064,2;

getitem 4079,2;

getitem 14175,1;

getitem 671,1;

getitem 607,300;

getitem 12045,100;

getitem 12060,100;

getitem 12050,100;

getitem 12055,100;

getitem 12065,100;

getitem 12070,100;

set @gpack, 1;

warp "prontera",156,172;

close;

case 2:

mes "^616D7ENevermind~, You can come back again later!";

close;

}

end;

L_check:

return query_sql("SELECT 1 FROM `guildpack` join login on login.`last_ip` = `guildpack`.`last_ip` where login.account_id = "+ getcharid(3), .@tmp );

OnInit:

waitingroom "Guild Package",0;

end;

}

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  20
  • Topics Per Day:  0.01
  • Content Count:  52
  • Reputation:   2
  • Joined:  02/15/14
  • Last Seen:  

bump ~~~

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  20
  • Topics Per Day:  0.01
  • Content Count:  52
  • Reputation:   2
  • Joined:  02/15/14
  • Last Seen:  

It solved !! Thanks much !!

Edited by fallen0519
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  20
  • Topics Per Day:  0.01
  • Content Count:  52
  • Reputation:   2
  • Joined:  02/15/14
  • Last Seen:  

Capuche, is there anyway to check if players have enough space to got the item? Because whenever player have almost full inventory, it cause server crash when claiming the g.pack. Thanks~

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  


/*

CREATE TABLE IF NOT EXISTS `guildpack` (

`id` int(11) NOT NULL auto_increment,

`account_id` int(11) NOT NULL default '0',

`name` varchar(23) NOT NULL default '',

`last_ip` varchar(100) NOT NULL default '',

PRIMARY KEY (`account_id`),

KEY (`id`)

) ENGINE=MyISAM;

*/

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

prontera,130,172,5 script Guild Pack Info 468,{

if ( getcharid(2) == 0 ) {

mes "You have no guild!";

close;

}

if ( #gpack || callsub( L_check ) ) {

#gpack = 1;

mes "^616D7EYou already given a Guild Package";

close;

}

mes "[Guild Pack NPC]";

mes "Hello there, it seems you are claiming for a Guild Pack.";

next;

mes "[Guild Pack NPC]";

mes "Let me gift you a guild pack for joining and";

mes "playing in Lunar RO, we hope you enjoy them.";

next;

mes "These guild pack is not duplicable and not dropable.";

next;

switch(select("Yes:No")) {

case 1:

.@myip$ = getcharip();

if ( callsub( L_check ) ) {

mes "^616D7EIt seems you have same IP Address among Guild Mates: ^ff0000" + .@myip$ + "^000000. Sorry, but its not allowed.";

close;

}

setarray .@item_id[0], 29828,29851,29868,29834,29804,29835,2607,4035,4064,4079,

14175,671,607,12045,12060,12050,12055,12065,12070;

setarray .@amount[0], 1,1,1,1,1,1,2,5,2,2,

1,1,300,100,100,100,100,100,100;

.@size = getarraysize( .@item_id );

// add items getitem2

setarray .@item_id[.@size], 5170,2319,2114,2528,2424;

setarray .@amount[.@size], 1,1,1,1,1;

if ( checkweight2( .@item_id,.@amount ) == 0 ) {

mes "you can't carry all the items";

close;

}

query_sql("INSERT INTO `guildpack` VALUES (NULL," + getcharid(3) + ",'" + escape_sql(strcharinfo(0)) + "','" + .@myip$ + "')");

//THIS PART WERE all items they will get

for ( ; .@i < .@size; .@i++ )

getitem .@item_id[.@i], .@amount[.@i];

getitem2 5170,1,1,7,0,0,0,0,0;

getitem2 2319,1,1,7,0,4141,0,0,0;

getitem2 2114,1,1,7,0,4058,0,0,0;

getitem2 2528,1,1,7,0,4133,0,0,0;

getitem2 2424,1,1,7,0,4097,0,0,0;

set #gpack, 1;

warp "prontera",156,172;

close;

case 2:

mes "^616D7ENevermind~, You can come back again later!";

close;

}

end;

L_check:

return query_sql("SELECT 1 FROM `guildpack` join login on login.`last_ip` = `guildpack`.`last_ip` where login.account_id = "+ getcharid(3), .@tmp );

OnInit:

waitingroom "Guild Package",0;

end;

}

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  20
  • Topics Per Day:  0.01
  • Content Count:  52
  • Reputation:   2
  • Joined:  02/15/14
  • Last Seen:  

Why the item ID like changed to another script? >_< Nvm, I'll just use the previous script because its only the item check problem. TQ!!

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  17
  • Reputation:   0
  • Joined:  08/09/14
  • Last Seen:  

how to execute the sql table?

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