Yoona Posted April 26, 2013 Posted April 26, 2013 A IP based Freebies.. that they can use 1 IP at the same time Quote
Patskie Posted April 26, 2013 Posted April 26, 2013 Execute this on your database 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; Then try this code : prontera,150,150,0 script Freebies 100,{ mes .NPC$; mes "Wanna get the freebies " +strcharinfo(0)+ "?"; if (select("Yes:No") - 1) close; mes .NPC$; mes "Let me check if you are really a new member"; next; 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 .NPC$; mes "You already got the freebies " +strcharinfo(0); close; } 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; OnInit: set .NPC$, "[ " strnpcinfo(1)+ " ]"; setarray .freebie_item[0],607,608; setarray .quantity[0],1,1; } Did not test though. Post if an error occured. Quote
Yoona Posted July 10, 2013 Author Posted July 10, 2013 Execute this on your database 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; Then try this code : prontera,150,150,0 script Freebies 100,{ mes .NPC$; mes "Wanna get the freebies " +strcharinfo(0)+ "?"; if (select("Yes:No") - 1) close; mes .NPC$; mes "Let me check if you are really a new member"; next; 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 .NPC$; mes "You already got the freebies " +strcharinfo(0); close; } 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; OnInit: set .NPC$, "[ " strnpcinfo(1)+ " ]"; setarray .freebie_item[0],607,608; setarray .quantity[0],1,1; } Did not test though. Post if an error occured. there's an Error at line 17, what should i do ???? Quote
Patskie Posted July 10, 2013 Posted July 10, 2013 getitem .freebie_item[.@x], ..quantity[.@x]; Should be : getitem .freebie_item[.@x], .quantity[.@x]; Quote
Yoona Posted July 11, 2013 Author Posted July 11, 2013 (edited) getitem .freebie_item[.@x], ..quantity[.@x]; Should be : getitem .freebie_item[.@x], .quantity[.@x]; now there's a problem in line 23, i check the problem it says parse_line need ";" but i check the script its not missing ";" line 23 set .NPC$, "[ " strnpcinfo(1)+ " ]"; what should i do? Edited July 11, 2013 by Yoona Quote
Patskie Posted July 11, 2013 Posted July 11, 2013 set .NPC$, "[ " strnpcinfo(1)+ " ]"; Should be : set .NPC$, "[ " +strnpcinfo(1)+ " ]"; Quote
Yoona Posted July 11, 2013 Author Posted July 11, 2013 set .NPC$, "[ " strnpcinfo(1)+ " ]"; Should be : set .NPC$, "[ " +strnpcinfo(1)+ " ]"; Wow! thanks Patskie =) Quote
0 creed.sin Posted April 16, 2020 Posted April 16, 2020 On 4/26/2013 at 10:16 AM, Patskie said: Execute this on your database 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; Then try this code : prontera,150,150,0 script Freebies 100,{ mes .NPC$; mes "Wanna get the freebies " +strcharinfo(0)+ "?"; if (select("Yes:No") - 1) close; mes .NPC$; mes "Let me check if you are really a new member"; next; 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 .NPC$; mes "You already got the freebies " +strcharinfo(0); close; } 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; OnInit: set .NPC$, "[ " strnpcinfo(1)+ " ]"; setarray .freebie_item[0],607,608; setarray .quantity[0],1,1; } Did not test though. Post if an error occured. error occurred, if same user logged from another IP Please help Quote
Question
Yoona
A IP based Freebies..
that they can use 1 IP at the same time
8 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.