Jump to content
  • 0
FearlesS

R> IP & account based freebies npc

Question

Please help me with the freebies NPC, who will check character IP and account ID.

 

If the user tried to log in with the same account using another IP, he won't get freebies.

Share this post


Link to post
Share on other sites

4 answers to this question

Recommended Posts

  • 0
/* Run below script to create table
 * CREATE TABLE IF NOT EXISTS `freebies_ip` AS
 * SELECT `LAST_IP` `IP` FROM `LOGIN` LIMIT 0;
 */

prontera,150,150,6	script	Test	4W_SAILOR,{
	if (!#FREEBIES && !query_sql("SELECT `IP` FROM `FREEBIES_IP` WHERE `IP` = '" + getcharip() + "'", .@ip$)) {
		.@i = 0;
		while (.@i < .size) {
			getitem .freebies[.@i], .freebies[.@i+1];
			.@i += 2;
		}
		#FREEBIES = 1;
		query_sql("INSERT INTO `FREEBIES_IP` VALUES ('" + getcharip() + "')");
		end;
	}
	mes "Already claimed freebies";
	close;
	
	OnInit:
		// <item id>,<amount>
		setarray .freebies[0],
			Speed_Up_Potion_Box10, 5,
			Yggdrasilberry_Box_, 10;
		.size = getarraysize(.freebies);
		end;
}

Run the sql script first on the comment header

Share this post


Link to post
Share on other sites
  • 0

IP based restrictions aren't good and easy to bypass. 

 

If more than one of a family plays on ur server only one will get a freebie and the other of the family will get nothing.

 

U should use one of the Hackshields. So u can restrict it by the unique ID or Mac addresses

 

Rynbef~

Share this post


Link to post
Share on other sites
  • 0
On 4/17/2020 at 5:53 PM, Patskie said:

/* Run below script to create table * CREATE TABLE IF NOT EXISTS `freebies_ip` AS * SELECT `LAST_IP` `IP` FROM `LOGIN` LIMIT 0; */ prontera,150,150,6 script Test 4W_SAILOR,{ if (!#FREEBIES && !query_sql("SELECT `IP` FROM `FREEBIES_IP` WHERE `IP` = '" + getcharip() + "'", .@ip$)) { .@i = 0; while (.@i < .size) { getitem .freebies[.@i], .freebies[.@i+1]; .@i += 2; } #FREEBIES = 1; query_sql("INSERT INTO `FREEBIES_IP` VALUES ('" + getcharip() + "')"); end; } mes "Already claimed freebies"; close; OnInit: // <item id>,<amount> setarray .freebies[0], Speed_Up_Potion_Box10, 5, Yggdrasilberry_Box_, 10; .size = getarraysize(.freebies); end; }


/* Run below script to create table
 * CREATE TABLE IF NOT EXISTS `freebies_ip` AS
 * SELECT `LAST_IP` `IP` FROM `LOGIN` LIMIT 0;
 */

prontera,150,150,6	script	Test	4W_SAILOR,{
	if (!#FREEBIES && !query_sql("SELECT `IP` FROM `FREEBIES_IP` WHERE `IP` = '" + getcharip() + "'", .@ip$)) {
		.@i = 0;
		while (.@i < .size) {
			getitem .freebies[.@i], .freebies[.@i+1];
			.@i += 2;
		}
		#FREEBIES = 1;
		query_sql("INSERT INTO `FREEBIES_IP` VALUES ('" + getcharip() + "')");
		end;
	}
	mes "Already claimed freebies";
	close;
	
	OnInit:
		// <item id>,<amount>
		setarray .freebies[0],
			Speed_Up_Potion_Box10, 5,
			Yggdrasilberry_Box_, 10;
		.size = getarraysize(.freebies);
		end;
}

Run the sql script first on the comment header

Thanks, its working.

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.