Panny Posted November 21, 2012 Group: Members Topic Count: 7 Topics Per Day: 0.00 Content Count: 19 Reputation: 0 Joined: 11/21/12 Last Seen: January 13, 2013 Share Posted November 21, 2012 Hey guys, im wanting to make an NPC where it gives you an item once per IP. I know you can do this per char or per account but is it possible to make it so only 1 item per IP? Quote Link to comment Share on other sites More sharing options...
GmOcean Posted November 21, 2012 Group: Members Topic Count: 31 Topics Per Day: 0.01 Content Count: 666 Reputation: 93 Joined: 04/27/12 Last Seen: August 17, 2015 Share Posted November 21, 2012 Yes, but we can only go by the ip they last used to log in. So, they could basically just hot spot them selves with their phone and get nearly an unlimited amount. Since from my experience my phone kept feeding me different WAN IPs. But we can make a custom sql table to store the used IPs and then search from. There. Quote Link to comment Share on other sites More sharing options...
Panny Posted November 30, 2012 Group: Members Topic Count: 7 Topics Per Day: 0.00 Content Count: 19 Reputation: 0 Joined: 11/21/12 Last Seen: January 13, 2013 Author Share Posted November 30, 2012 How would i do this? Help would be greatly appreciated. Quote Link to comment Share on other sites More sharing options...
AnnieRuru Posted November 30, 2012 Group: Members Topic Count: 18 Topics Per Day: 0.00 Content Count: 2044 Reputation: 682 Joined: 10/09/12 Last Seen: December 20, 2020 Share Posted November 30, 2012 /* create table itemperIP ( last_ip varchar(20) primary key ) engine = innodb; */ prontera,155,180,5 script ljdshfksjd 100,{ if ( query_sql( "select 1 from itemperip where last_ip = '"+ getcharip() +"'", .@dummy ) ) dispbottom "you already claimed the reward"; else { query_sql "insert into itemperip values ( '"+ getcharip() +"' )"; dispbottom "here is your item"; getitem 501,1; } end; } Quote Link to comment Share on other sites More sharing options...
Panny Posted November 30, 2012 Group: Members Topic Count: 7 Topics Per Day: 0.00 Content Count: 19 Reputation: 0 Joined: 11/21/12 Last Seen: January 13, 2013 Author Share Posted November 30, 2012 (edited) Thank you but i want to intergrate it into a script i have, with a goto function. Would this work? if ( query_sql( "select 1 from itemperip where last_ip = '"+ getcharip() +"'", .@dummy ) ) goto nothanks; nothanks: mes "you already have your reward"; close; My NPC only appeirs once every 6 hours so when click the npc i want it to also clear there IP so they can collect a reward again. Im using this so they can not login to mutiple account on same IP to collect free items. Edited November 30, 2012 by Panny Quote Link to comment Share on other sites More sharing options...
AnnieRuru Posted November 30, 2012 Group: Members Topic Count: 18 Topics Per Day: 0.00 Content Count: 2044 Reputation: 682 Joined: 10/09/12 Last Seen: December 20, 2020 Share Posted November 30, 2012 prontera,155,180,5 script ljdshfksjd 100,{ if ( query_sql( "select 1 from itemperip where last_ip = '"+ getcharip() +"'", .@dummy ) ) goto L_nothx; else goto L_reward; L_nothx: mes "you already claimed the reward"; close; L_reward: query_sql "insert into itemperip values ( '"+ getcharip() +"' )"; mes "here is your item"; getitem 501,1; close; } btw this script kinda feel out of place utilizing SQL table to store information, but using newbie scripting style... Quote Link to comment Share on other sites More sharing options...
Panny Posted November 30, 2012 Group: Members Topic Count: 7 Topics Per Day: 0.00 Content Count: 19 Reputation: 0 Joined: 11/21/12 Last Seen: January 13, 2013 Author Share Posted November 30, 2012 thank you for that, now after getitem 501,1; i want it to clear there IP from the database how can i do this? Quote Link to comment Share on other sites More sharing options...
AnnieRuru Posted November 30, 2012 Group: Members Topic Count: 18 Topics Per Day: 0.00 Content Count: 2044 Reputation: 682 Joined: 10/09/12 Last Seen: December 20, 2020 Share Posted November 30, 2012 (edited) http://www.w3schools.../sql_delete.asp EDIT for below ... ok you should go learn some SQL before you ask this question again ... suddenly I feels like teaching someone about addition/subtraction, but he don't even know how to count the numbers go read some SQL guide on the internet EDIT2: exactly like what emistry said Edited November 30, 2012 by AnnieRuru Quote Link to comment Share on other sites More sharing options...
Panny Posted November 30, 2012 Group: Members Topic Count: 7 Topics Per Day: 0.00 Content Count: 19 Reputation: 0 Joined: 11/21/12 Last Seen: January 13, 2013 Author Share Posted November 30, 2012 (edited) so it would be?? query_sql "DELETE FROM itemperip WHERE last_ip=( '"+ getcharip() +"' )"; Im new to this sorry if it looks so bad haha query_sql "insert into itemperip values ( '"+ getcharip() +"' )"; dispbottom "here is your item"; getitem 501,1; query_sql "DELETE FROM itemperip WHERE last_ip= ( '"+ getcharip() +"' )"; EDIT for above ... Im only asking a question and for a little help, why be so bitchy about it? Edited November 30, 2012 by Panny Quote Link to comment Share on other sites More sharing options...
Emistry Posted November 30, 2012 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10018 Reputation: 2369 Joined: 10/28/11 Last Seen: Sunday at 05:32 PM Share Posted November 30, 2012 @Panny 1 question ...... why are you want to delete the stored data right after they get the items ?? save data into SQL table... getitem ..... then delete query inside SQL table... LOL ?? do you really know the reason behind it ? adding a data into SQL ? ? Quote Link to comment Share on other sites More sharing options...
Panny Posted November 30, 2012 Group: Members Topic Count: 7 Topics Per Day: 0.00 Content Count: 19 Reputation: 0 Joined: 11/21/12 Last Seen: January 13, 2013 Author Share Posted November 30, 2012 Because the NPC loads every 6 hours and players tend to login 2/3/4 accounts, there is a 10 second timer on the NPC to collect items, so adding the IP will stop them from using the NPC on more than 1 account then once collected it clears it ready for the NPC again 6 hours later. Quote Link to comment Share on other sites More sharing options...
Emistry Posted November 30, 2012 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10018 Reputation: 2369 Joined: 10/28/11 Last Seen: Sunday at 05:32 PM Share Posted November 30, 2012 like this ? http://pastebin.com/raw.php?i=vS1y140c just some minor edit from Annie's script in previous post Quote Link to comment Share on other sites More sharing options...
Panny Posted November 30, 2012 Group: Members Topic Count: 7 Topics Per Day: 0.00 Content Count: 19 Reputation: 0 Joined: 11/21/12 Last Seen: January 13, 2013 Author Share Posted November 30, 2012 perfect, thank you ever so much. Quote Link to comment Share on other sites More sharing options...
AnnieRuru Posted November 30, 2012 Group: Members Topic Count: 18 Topics Per Day: 0.00 Content Count: 2044 Reputation: 682 Joined: 10/09/12 Last Seen: December 20, 2020 Share Posted November 30, 2012 (edited) btw let me remind something, for you and everyone else in this request section, we expecting your request is made based on your first post if you want to request for different feature, edit your first post, or open a new topic don't do something like this or this you are making other member's head spin your request on post#5 and post#11 is totally different than your post#1 EDIT: I almost feel like want to split topic just now ... Edited November 30, 2012 by AnnieRuru Quote Link to comment Share on other sites More sharing options...
Panny Posted December 4, 2012 Group: Members Topic Count: 7 Topics Per Day: 0.00 Content Count: 19 Reputation: 0 Joined: 11/21/12 Last Seen: January 13, 2013 Author Share Posted December 4, 2012 (edited) I am sorry for posting again here but im having a problem with the script when starting the server via putty. parse_callfunc: expected ')' to close argument list 46 : { 47 : 48 : //-------------------------------------------------- 49 : 50 : if(BaseLevel < 50) goto L_DENIED; * 51 : if ( query_sql( "SELECT 1 FROM itemperIP WHERE last_ip = '"+ getcharip'(') +"'", .@dummy ) ) goto error; Any ideas where i need to put the missing ) Regards, Edited December 4, 2012 by Panny Quote Link to comment Share on other sites More sharing options...
Emistry Posted December 4, 2012 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10018 Reputation: 2369 Joined: 10/28/11 Last Seen: Sunday at 05:32 PM Share Posted December 4, 2012 @panny update your svn to latest ~ Getcharip is added since r16957 and fixed in r16958 Quote Link to comment Share on other sites More sharing options...
Panny Posted December 4, 2012 Group: Members Topic Count: 7 Topics Per Day: 0.00 Content Count: 19 Reputation: 0 Joined: 11/21/12 Last Seen: January 13, 2013 Author Share Posted December 4, 2012 Im using eAthena :/ any ways to do this on that system? Quote Link to comment Share on other sites More sharing options...
AnnieRuru Posted December 4, 2012 Group: Members Topic Count: 18 Topics Per Day: 0.00 Content Count: 2044 Reputation: 682 Joined: 10/09/12 Last Seen: December 20, 2020 Share Posted December 4, 2012 /* create table itemperIP ( last_ip varchar(20) primary key ) engine = innodb; */ prontera,155,180,5 script asdf 100,{ query_sql "select last_ip from login where account_id = "+ getcharid(3), .@ip$; if ( query_sql( "select 1 from itemperip where last_ip = '"+ .@ip$ +"'", .@dummy ) ) dispbottom "you already claimed the reward"; else { query_sql "insert into itemperip values ( '"+ .@ip$ +"' )"; dispbottom "here is your item"; getitem 501,1; } end; OnClock0000: OnClock0600: OnClock1200: OnClock1800: query_sql "truncate itemperip"; end; } Quote Link to comment Share on other sites More sharing options...
Question
Panny
Hey guys, im wanting to make an NPC where it gives you an item once per IP.
I know you can do this per char or per account but is it possible to make it so only 1 item per IP?
Link to comment
Share on other sites
17 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.