Jump to content
  • 0

Freebie NPC SQL Problem?


Botaring

Question


  • Group:  Members
  • Topic Count:  13
  • Topics Per Day:  0.00
  • Content Count:  44
  • Reputation:   1
  • Joined:  09/30/15
  • Last Seen:  

So I have this NPC and it's working properly on my Test Server.

But when I tried using it on my online server it didn't work as much as I expected.

It still gives freebies when they already got it. But it records all of the transactions that's happening to him in the SQL.

It is a modified version of this.

SCRIPT CORE:

poring_w02,89,81,6	script	Freebies NPC	100,{
	mes "[ ^FF0000Administrator Helper^000000 ]";
	mes "Welcome to Ragnarok Online.";
	next;
	switch(select("~ How to claim Beginner Rewards:~ I have the items:~ Cancel")){
		Case 1:
			mes "[ ^FF0000Administrator Helper^000000 ]";
			mes "To claim your Beginner Rewards.";
			mes "Gather the following items:";
			mes "^FF000015 ^000000"+getitemname(4001);
			mes "^FF000015 ^000000"+getitemname(4037);
			mes "^FF000015 ^000000"+getitemname(4074);
			mes "^FF000010 ^000000"+getitemname(4275);
			mes "^FF000010 ^000000"+getitemname(4268);
			mes "^FF000010 ^000000"+getitemname(4194);
			mes "^FF0000150 ^000000"+getitemname(4129);
			mes "^FF00003 ^000000"+getitemname(4147);
			mes "^FF00001 ^000000"+getitemname(4305);
			close;
		
		Case 2:
			query_sql("SELECT last_ip FROM `login` WHERE account_id = "+getcharid(3)+"", .@lastip$);
			query_sql("SELECT last_ip FROM `freebies`", .@freebiesip$);
			if (.@lastip$ == .@freebiesip$) {
					mes "[ ^FF0000Administrator Helper^000000 ]";
					mes "Sorry, but you've already received your ^43572FBeginner Rewards^000000.";
					close;
				} else {
					mes "[ ^FF0000Administrator Helper^000000 ]";
					mes "Let me see if you have gathered all the following items.";
					mes "^FF000015 ^000000"+getitemname(4001);
					mes "^FF000015 ^000000"+getitemname(4037);
					mes "^FF000015 ^000000"+getitemname(4074);
					mes "^FF000010 ^000000"+getitemname(4275);
					mes "^FF000010 ^000000"+getitemname(4268);
					mes "^FF000010 ^000000"+getitemname(4194);
					mes "^FF0000150 ^000000"+getitemname(4129);
					mes "^FF00003 ^000000"+getitemname(4147);
					mes "^FF00001 ^000000"+getitemname(4305);
					next;
					if(countitem(4001) < 15) goto L_NoItem;
					if(countitem(4037) < 15) goto L_NoItem;
					if(countitem(4074) < 15) goto L_NoItem;
					if(countitem(4275) < 10) goto L_NoItem;
					if(countitem(4268) < 10) goto L_NoItem;
					if(countitem(4194) < 10) goto L_NoItem;
					if(countitem(4129) < 150) goto L_NoItem;
					if(countitem(4147) < 3) goto L_NoItem;
					if(countitem(4305) < 1) goto L_NoItem;
					mes "[ ^FF0000Administrator Helper^000000 ]";
					mes "It seems you've gathered all the items!";
					mes "Here's your ^43572FBeginner Rewards^000000.";
					delitem 4001,15;
					delitem 4037,15;
					delitem 4074,15;
					delitem 4275,10;
					delitem 4268,10;
					delitem 4194,10;
					delitem 4129,150;
					delitem 4147,3;
					delitem 4305,1;
					query_sql("INSERT INTO `freebies` VALUES (NULL," + getcharid(3) + ",'" + escape_sql(strcharinfo(0)) + "','" + .@lastip$ + "')");
					for ( set .@x,0; .@x < getarraysize(.freebie_item); set .@x,.@x + 1 ) {
						getitem .freebie_item[.@x], .quantity[.@x];
					}
				}
				close;
				
			L_NoItem:
				mes "You don't have:";
				if(countitem(4001) < 15) mes "^FF0000"+(15 - countitem(4001)) +"^000000 "+getitemname(4001);
				if(countitem(4037) < 15) mes "^FF0000"+(15 - countitem(4037)) +"^000000 "+getitemname(4037);
				if(countitem(4074) < 15) mes "^FF0000"+(15 - countitem(4074)) +"^000000 "+getitemname(4074);
				if(countitem(4275) < 10) mes "^FF0000"+(10 - countitem(4275)) +"^000000 "+getitemname(4275);
				if(countitem(4268) < 10) mes "^FF0000"+(10 - countitem(4268)) +"^000000 "+getitemname(4268);
				if(countitem(4194) < 10) mes "^FF0000"+(10 - countitem(4194)) +"^000000 "+getitemname(4194);
				if(countitem(4129) < 150) mes "^FF0000"+(150 - countitem(4129)) +"^000000 "+getitemname(4129);
				if(countitem(4147) < 3) mes "^FF0000"+(3 - countitem(4147)) +"^000000 "+getitemname(4147);
				if(countitem(4305) < 1) mes "^FF0000"+(1 - countitem(4305)) +"^000000 "+getitemname(4305);
				close;
				
		Case 3:
			close;
	
	}
	
	OnInit:
	setarray .freebie_item[0],2357,2524,2421,2115,40138,7776;
	setarray .quantity[0],2,2,2,3,3,10;
}

 

SQL CODE:

CREATE TABLE IF NOT EXISTS `freebies` (
  `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;

 

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  23
  • Topics Per Day:  0.01
  • Content Count:  183
  • Reputation:   15
  • Joined:  06/10/12
  • Last Seen:  

14 hours ago, luxus2311 said:

SQL CODE:


CREATE TABLE IF NOT EXISTS `freebies` (
  `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;

 

So, do u imported SQL code to mysql?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  13
  • Topics Per Day:  0.00
  • Content Count:  44
  • Reputation:   1
  • Joined:  09/30/15
  • Last Seen:  

7 hours ago, Yug-WebDev said:


why not something like this .. getitembound ?
let me make a simple script for you ..


 

  Hide contents

yourmap,x,y,position    script    Freebies    npcname,{

    if(#freebie == 0){
    mes "freebies here";
next;
    getitembound 501,10,1;     //red potion
    set Zeny,Zeny+2000;
    set #freebie,1;
 next;
    warp "somemap",x,y;
    close;
    }

if(#freebie == 1) {
mes "Your Account already claimed";
next;
    warp "somemap",x,y;
    close;
    }
}

3

 

Then the players will just recreate an account again and again. The IP Based is for that sort of exploit.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  13
  • Topics Per Day:  0.00
  • Content Count:  44
  • Reputation:   1
  • Joined:  09/30/15
  • Last Seen:  

1 hour ago, HD Scripts said:

So, do u imported SQL code to mysql?

Yes I did and I've done it twice to make sure. But still the Script doesnt seem to read what is in the SQL on my Private Server only. But on the Test Server it works perfectly.

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