R> IP & account based freebies npc

FearlesS

New member
Messages
38
Points
0
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.

 
/* 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

 
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~

 
this not hard to bypass too

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

 
Back
Top